test(codex-operations): normalize collector stdout newlines on Windows - #50
Merged
Conversation
`collector orders tied skill mentions deterministically` compared a whole output line for equality after splitting stdout on `\n`. The collector is a Python script and Python's text-mode stdout writes the platform newline, so on Windows each line arrives as `\r\n` and the split leaves a trailing `\r` on the compared line. The suite's other assertions use `.includes()`, which the `\r` does not disturb, so this was the only case that went red. The collector's platform-native line endings are correct for a CLI, so the defect is the test. `runCollector` now folds `\r\n` to `\n` in `stdout` and `stderr` once, for every case, instead of each assertion guarding for itself. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No related issue: melodic-software/github-iac#378 tracks the ci-perf program (second-pass residual)
Summary
npm teston this repository has one failing case on Windows,collector orders tied skill mentions deterministically, and has had it for as long as the ci-perf sweep has been running it.It was recorded as a pre-existing failure in
.work/ci-perf/wave-d/phase-6b-ii-step3-result.mdduring Phase 6b-ii step 3 and left alone there because it is unrelated to CI. This closes it.
The cause is a trailing carriage return, not an ordering defect. The collector under test is
plugins/codex-operations/skills/find-skill-candidates/scripts/collect_recent_sessions.py. Python'stext-mode stdout writes the platform newline, so on Windows every line it prints arrives as
\r\n. The test splits stdout on\nand then compares one whole line for equality, so theleftover
\rreads as a content difference:Every other case in the file asserts with
.includes()orassert.match, which a trailing\rdoes not disturb, which is why this was the only red one.
Fix
The collector's platform-native line endings are correct behaviour for a command-line tool, so the
defect is on the test side.
tests/codex-operations.test.mjsfolds\r\nto\nonce inside theshared
runCollectorhelper, forstdoutandstderr, so every case gets the same text on everyplatform. The fix is in the helper rather than at the one call site that noticed, because the next
equality assertion any case adds would hit the same wall.
The original
spawnSyncresult is spread, sostatusand every other field are unchanged, and anon-string
stdoutorstderr(bothnullwhen the spawn itself fails) passes through untouched.No production code is touched.
collect_recent_sessions.pyis unchanged.Verification
npm test: 114 passed, 0 failed on this branch. Onorigin/mainin the same worktree thesame command reports 113 passed, 1 failed.
tests/codex-operations.test.mjsrestored toorigin/mainand nothing elsechanged,
node --test --test-name-pattern="tied skill mentions" tests/codex-operations.test.mjsfails with an
AssertionErrorwhose actual value ends in a literal\r. With the file restoredto this branch it passes. The normalization is load-bearing.
npm run validate:0 error(s), 0 warning(s).on 8 of 8 criteria, including that no path under
plugins/appears in the diff.Related
.work/ci-perf/wave-d/phase-6b-ii-step3-result.md.