test(ci): bind the Windows shard assertion to an executable command (#1185) - #1301
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesWindows CI command validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
tests/ci-workflows.test.ts
| /** 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); | ||
| } | ||
|
|
There was a problem hiding this comment.
🎯 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.
There was a problem hiding this comment.
💡 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".
| .filter(line => line.length > 0 && !line.startsWith("#")) | ||
| .includes(expected); |
There was a problem hiding this comment.
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 👍 / 👎.
|
CI here is blocked by a base-branch problem, not by this diff, and I've stopped rerunning it. Both attempts on 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 I had been calling this flake all day — five occurrences across four unrelated branches plus 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. |
f09ef15 to
454b1d3
Compare
|
Rebased onto current Reason for the respin: the two runs I held this on both ended Re-verified on the rebased head rather than reusing the old numbers: full suite 10055 pass / 7 skip / 0 fail across 627 files, Watching the new run. If it hangs again I will record it on #1302 rather than rerunning past it. |
…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.
…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.
454b1d3 to
e239b96
Compare
… 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.
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 viaCo-authored-by.The assertion that the Windows leg shards the suite used
.includes()against the step'sruntext, so any occurrence of the command anywhere in the script satisfied it — inside anecho, or in a comment. A Windows job that printed the command instead of running it kept the suite green.hasExactShellCommandsplits the script into lines, drops blanks and comments, and requires the command as a whole line; the negative assertion againstecho <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 theechohole but not the neighbouring one: a step carrying the exact command still runs nothing underif: 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
14e948525and verified after the rebase:bun run test— 10009 pass / 7 skip / 0 fail across 626 filesbun test tests/ci-workflows.test.ts— 125 pass / 0 failbun run typecheck— cleanbun run privacy:scan— passedTwo ablations against
.github/workflows/ci.yml, each restored afterwards. Both mutations neuter the Windows test leg, and neither is caught bydevtoday:devtodayrun: bun test …→run: echo bun test …if: false, command unchangedThe first is the contributor's assertion; the second is the maintainer commit.
Checklist
Note on #1185's red CI: its
Cross-platform CIfailure atbff31d1e0is not caused by that diff. The shard crashed while loadingtests/autostart-health.test.tswithEEXIST: file already exists, epoll_ctlin a BunWriteStream, followed by a collateralCannot call describe() after the test run has completed. #1185 touches onlytests/ci-workflows.test.tsand has no path to that file. Root cause of the Bun-level crash is unknown and not diagnosed here.Summary by CodeRabbit