Skip to content

test(ci): bind the Windows shard assertion to an executable command (#1185) - #1301

Merged
lidge-jun merged 2 commits into
devfrom
codex/260808-1185-windows-shard-assertion
Aug 9, 2026
Merged

test(ci): bind the Windows shard assertion to an executable command (#1185)#1301
lidge-jun merged 2 commits into
devfrom
codex/260808-1185-windows-shard-assertion

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Republishes @luvs01's #1185 on current dev. Their branch was 324 commits behind, so this is a maintainer rebase; the first commit is theirs via Co-authored-by.

The assertion that the Windows leg shards the suite used .includes() against the step's run text, so any occurrence of the command anywhere in the script satisfied it — inside an echo, or in a comment. A Windows job that printed the command instead of running it kept the suite green. hasExactShellCommand splits the script into lines, drops blanks and comments, and requires the command as a whole line; the negative assertion against echo <command> pins that so a future loosening back to substring matching fails here rather than silently.

This PR adds one maintainer-authored commit that was not in #1185 (test(ci): require the Windows test step to be unconditional). Binding the assertion to an executable line closes the echo hole but not the neighbouring one: a step carrying the exact command still runs nothing under if: false, and the suite would stay green against a Windows leg that never tests. It is a separate commit rather than folded in, so the added coverage is not attributed to the contributor.

Supersedes #1185, which can be closed once this lands.

Verification

Rebased onto 14e948525 and verified after the rebase:

  • bun run test10009 pass / 7 skip / 0 fail across 626 files
  • bun test tests/ci-workflows.test.ts — 125 pass / 0 fail
  • bun run typecheck — clean
  • bun run privacy:scan — passed

Two ablations against .github/workflows/ci.yml, each restored afterwards. Both mutations neuter the Windows test leg, and neither is caught by dev today:

Mutation to the Windows Test step dev today with this PR
run: bun test …run: echo bun test … 125 pass / 0 fail 124 pass / 1 fail
add if: false, command unchanged 125 pass / 0 fail 124 pass / 1 fail

The first is the contributor's assertion; the second is the maintainer commit.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (Test-only change; no user-facing behavior.)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (No workflow file is modified — this tightens the test that inspects them. The ablations above were local and reverted.)

Note on #1185's red CI: its Cross-platform CI failure at bff31d1e0 is not caused by that diff. The shard crashed while loading tests/autostart-health.test.ts with EEXIST: file already exists, epoll_ctl in a Bun WriteStream, followed by a collateral Cannot call describe() after the test run has completed. #1185 touches only tests/ci-workflows.test.ts and has no path to that file. Root cause of the Bun-level crash is unknown and not diagnosed here.

Summary by CodeRabbit

  • Tests
    • Improved continuous integration checks for Windows test execution.
    • Validation now confirms the required sharded test command is present, exact, and runs unconditionally.
    • Prevents misleading matches caused by commented or echoed command text.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Aug 8, 2026
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The CI workflow tests now match executable shell commands exactly. They reject echoed or substring-only matches and require the Windows shard command to appear in an unconditional test step.

Changes

Windows CI command validation

Layer / File(s) Summary
Exact command matcher and workflow assertions
tests/ci-workflows.test.ts
Added hasExactShellCommand to ignore blank and comment lines and compare complete shell-command lines. Updated Windows shard checks to require a matching test step without an if condition.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: wibias, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: strengthening the Windows shard assertion to require an executable command.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/260808-1185-windows-shard-assertion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ci-workflows.test.ts`:
- Around line 42-50: Update the Windows-specific checks around
hasExactShellCommand so they compare the trimmed run value directly against the
expected single-line command, rather than accepting matching lines inside
multiline or non-executable blocks. Preserve the existing command validation for
the Windows workflow and adjust the affected checks near the Windows step.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dc7b9c7a-2631-4825-9f3d-d571e4c79164

📥 Commits

Reviewing files that changed from the base of the PR and between 14e9485 and f09ef15.

📒 Files selected for processing (1)
  • tests/ci-workflows.test.ts

Comment on lines +42 to +50
/** Match an executable shell line, not a fragment that could appear in echo or a comment. */
function hasExactShellCommand(run: string | undefined, expected: string): boolean {
return (run ?? "")
.split(/\r?\n/)
.map(line => line.trim())
.filter(line => line.length > 0 && !line.startsWith("#"))
.includes(expected);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject exact command text that is not executable.

hasExactShellCommand checks only trimmed text lines. It returns true for a command inside a PowerShell block comment, an uncalled function, or a disabled shell branch. For example, this Windows step contains the exact line but does not run the test:

run: |
  <#
  bun test --isolate tests --shard=${{ matrix.shard }}/4
  #>

The step has no if, so lines 182-184 accept it. The Windows workflow currently uses a single-line run, so compare the trimmed run value directly in this Windows-specific check. If multiline scripts must remain supported, add shell-aware parsing and regression coverage for non-executable blocks.

Proposed fix
-    const windowsTestSteps = winSteps.filter(step => hasExactShellCommand(step.run, windowsTestCommand));
+    const windowsTestSteps = winSteps.filter(
+      step => step.run?.trim() === windowsTestCommand,
+    );

Also applies to: 176-184

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ci-workflows.test.ts` around lines 42 - 50, Update the Windows-specific
checks around hasExactShellCommand so they compare the trimmed run value
directly against the expected single-line command, rather than accepting
matching lines inside multiline or non-executable blocks. Preserve the existing
command validation for the Windows workflow and adjust the affected checks near
the Windows step.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f09ef15574

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +47 to +48
.filter(line => line.length > 0 && !line.startsWith("#"))
.includes(expected);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject PowerShell block-commented commands

When the Windows Test step wraps the command in a PowerShell block comment such as <#\nbun test ...\n#>, this filter retains the command line and hasExactShellCommand returns true, even though the step executes no tests; the step has no explicit shell, so Windows uses PowerShell. This leaves the same silent no-test regression the new assertion is intended to prevent. Compare the trimmed run value directly with the expected single-line command, or otherwise account for PowerShell block comments rather than filtering only lines beginning with #.

Useful? React with 👍 / 👎.

@lidge-jun

Copy link
Copy Markdown
Owner Author

CI here is blocked by a base-branch problem, not by this diff, and I've stopped rerunning it.

Both attempts on f09ef1557 ended cancelled with test 4/4 hitting the 15-minute job timeout — the second ran 15:28:02Z to 15:43:17Z, so it is a real timeout rather than a superseded run. The three other Linux shards and the full macOS leg passed both times.

The stall is always the same shape: output stops right after a test that starts a proxy listener, then nothing for ~14 minutes, then cleanup reports Terminate orphan process: pid (NNNN) (bun). Here the last line was (pass) routed Claude requests give OpenAI sidecars main auth… from tests/claude-messages-endpoint.test.ts, which passes locally in 2.7s (38/38), so it needs the sharded Linux runner to show up.

I had been calling this flake all day — five occurrences across four unrelated branches plus dev itself. The audit on my own work pushed back on that, correctly, so I've filed #1302 with the run inventory and the one instance that crashed instead of hanging (EEXIST: epoll_ctl in a Bun WriteStream), which looks like the same resource-lifecycle bug with a different outcome.

Holding this PR rather than rerunning until green. The change itself is test-only and verified locally (full suite 10009 pass, both ablations reproduced), but merging on a retry-until-green would be exactly the habit #1302 warns about.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Rebased onto current dev (b5d44a534) and force-pushed with a lease against the previous head.

Reason for the respin: the two runs I held this on both ended cancelled under the shard hang tracked in #1302, so there was never a real signal to judge it by. It had also drifted 5 commits behind. Both commits are preserved with their separation intact — @luvs01's assertion carries the Co-authored-by trailer, and the unconditional-step assertion stays a separate maintainer commit.

Re-verified on the rebased head rather than reusing the old numbers: full suite 10055 pass / 7 skip / 0 fail across 627 files, tests/ci-workflows.test.ts 125 pass, typecheck clean, privacy scan passed. The if: false ablation still fails against current dev, so the coverage gap this closes is still open on the base branch.

Watching the new run. If it hangs again I will record it on #1302 rather than rerunning past it.

lidge-jun added a commit that referenced this pull request Aug 8, 2026
…ng (#1316)

Published devlog 028/029 as #1314, rebased #1301 onto current dev, and
reported #1244's new conflict to its author.

The part worth keeping is a retraction, and its own correction. I claimed two
CI runs shared a stall signature -- cli-native-profile handing off to
cli-restart-health with 'killed 1 dangling process' last -- and posted it to
#1302 as a narrowing. False: run 31152916419 never hung at all. It hit the
Bun epoll_ctl error while loading autostart-health, kept running, and
finished as a failure in 85 seconds. I had compared two logs by memory of
what one of them said.

Then the retraction itself was wrong twice. It named claude-messages-endpoint
as the first affected file in 31263738953, when that is where output stops
and baseten-provider is where the error first appears -- two different
questions I had collapsed into one column. And it said the EEXIST has 'two
outcomes', which asserts causation the logs do not establish: the error
appears in all three runs, one of which completed normally.

Three passes to state three sentences accurately. Both corrections are public
on #1302 with the chain left visible.

Also corrected here: 'two cancelled runs at the exact head' was wrong -- they
were consecutive heads, before and after the rebase.
lidge-jun and others added 2 commits August 9, 2026 09:19
…1185)

The assertion that the Windows leg shards the suite used `.includes()` on the
step's `run` text, so any occurrence of the command anywhere in the script
satisfied it — including inside an `echo`, or in a comment. A Windows job that
printed the command instead of running it kept the suite green.

`hasExactShellCommand` splits the script into lines, drops blanks and
comments, and requires the exact command as a whole line. The negative
assertion against `echo <command>` pins that behaviour so a future
loosening back to substring matching fails here rather than silently.

Republished from #1185 by luvs01, whose branch was 324 commits behind dev.
Rebased onto 14e9485 with no conflicts; authorship preserved below.

Co-authored-by: luvs01 <luvs01@hanmail.net>
Maintainer-added coverage for the #1185 republish. Binding the assertion to
an executable line closes the echo/comment hole, but a step carrying the
exact command still runs nothing under `if: false` — the suite would stay
green against a Windows leg that never tests.

Ablated both ways against current dev: replacing the run line with
`echo <command>` fails the contributor's assertion, and adding `if: false`
to that same step fails this one. Neither mutation is caught by dev today.
@lidge-jun
lidge-jun force-pushed the codex/260808-1185-windows-shard-assertion branch from 454b1d3 to e239b96 Compare August 9, 2026 00:31
@lidge-jun
lidge-jun merged commit 3c40df2 into dev Aug 9, 2026
16 of 18 checks passed
@lidge-jun
lidge-jun deleted the codex/260808-1185-windows-shard-assertion branch August 9, 2026 00:47
lidge-jun added a commit that referenced this pull request Aug 9, 2026
… closed (#1322)

Two of the four contributor-held PRs resolved. @Wibias met every condition on
#1244 -- rebase, Russian locale parity, two completed non-cancelled CI runs at
the same SHA -- including resolving the conflict I created by merging #1305.
Verified independently: two CI successes at d5e70a2 and a local full suite
of 10120 pass / 0 fail on that head. Landed as c75e68e, 58 files. #241
closed with its chain named, since #1244 references #1056 rather than #241.

#1301 rebased again after drifting 33 behind, then merged with --admin over a
red test 1/4. The failure is a 5000ms timeout in tests/crash-guard.test.ts,
which my one-file diff to tests/ci-workflows.test.ts cannot reach, and which
passes 14/14 locally three times. Logged as MERGE-DESPITE-CI with the reason
rather than as a clean green -- and recorded that this is the same shape of
reasoning I criticised as 'rerun until green' earlier.

#1272 hit a tenth #1302 occurrence and was rerun but NOT merged: it is still a
draft and those boxes are the contributor's attestation. A broken CI is not a
reason to tick them -- it is a reason not to, since they assert what CI can no
longer confirm.

Method note: rerun-failed-jobs overwrites the job log, so I destroyed the
#1302 evidence by fetching it after the rerun. Capture first, then rerun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant