Skip to content

test(codex-operations): normalize collector stdout newlines on Windows - #50

Merged
kyle-sexton merged 1 commit into
mainfrom
ci-perf/s5-collector-crlf
Sep 8, 2026
Merged

test(codex-operations): normalize collector stdout newlines on Windows#50
kyle-sexton merged 1 commit into
mainfrom
ci-perf/s5-collector-crlf

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

No related issue: melodic-software/github-iac#378 tracks the ci-perf program (second-pass residual)

Summary

npm test on 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.md
during 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's
text-mode stdout writes the platform newline, so on Windows every line it prints arrives as
\r\n. The test splits stdout on \n and then compares one whole line for equality, so the
leftover \r reads as a content difference:

+ actual   - expected
+ '- Skill mentions: `$alpha-skill` (1), ... `$zeta-skill` (1)\r'
- '- Skill mentions: `$alpha-skill` (1), ... `$zeta-skill` (1)'

Every other case in the file asserts with .includes() or assert.match, which a trailing \r
does 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.mjs folds \r\n to \n once inside the
shared runCollector helper, for stdout and stderr, so every case gets the same text on every
platform. 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 spawnSync result is spread, so status and every other field are unchanged, and a
non-string stdout or stderr (both null when the spawn itself fails) passes through untouched.

No production code is touched. collect_recent_sessions.py is unchanged.

Verification

  • npm test: 114 passed, 0 failed on this branch. On origin/main in the same worktree the
    same command reports 113 passed, 1 failed.
  • Mutation check: with tests/codex-operations.test.mjs restored to origin/main and nothing else
    changed, node --test --test-name-pattern="tied skill mentions" tests/codex-operations.test.mjs
    fails with an AssertionError whose actual value ends in a literal \r. With the file restored
    to this branch it passes. The normalization is load-bearing.
  • npm run validate: 0 error(s), 0 warning(s).
  • An independent fresh-context verifier ran all of the above plus a scope check and returned PASS
    on 8 of 8 criteria, including that no path under plugins/ appears in the diff.

Related

  • Refs melodic-software/github-iac#378
  • Recorded as a pre-existing failure in .work/ci-perf/wave-d/phase-6b-ii-step3-result.md.

`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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T03:31:13.737446Z 3c3ef05 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kyle-sexton
kyle-sexton merged commit 3beff0d into main Sep 8, 2026
5 checks passed
@kyle-sexton
kyle-sexton deleted the ci-perf/s5-collector-crlf branch September 8, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant