Repository navigation
Scrub color env in hermetic test children - #1964
Conversation
Assisted-by: Claude Code:claude-opus-5-5
hermetic::command now removes NO_COLOR, CLICOLOR, CLICOLOR_FORCE and COLUMNS, so an ambient CLICOLOR_FORCE=1 no longer puts ANSI codes into captured stdout (it failed a cli_parse_list test). TERM is left to the PTY suites. The HOSTILE_SEEDS list and the Yarn/Pnpm/Bundle seeds are deleted: each seed was removed right after it was set, so a dropped scrub could never show. spawn_env_hygiene now sets the hostile values in the test process and asserts the child (piped and PTY) never sees them. The module doc now says which builder pins HOME. Assisted-by: Claude Code:claude-opus-5-5
The canary now sets every GLOBAL/LOCAL_ARG_ENV_VARS name, so a new flag-bound var is covered without a hand-kept list. command keeps the by-name removal of SOCKET_UPDATE_BASE_URL and SOCKET_UPDATE_STATE_DIR that the deleted seed loop used to give. Stale seed comments in the golang and vendored-production suites now point at spawn_env_hygiene. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit df7d599. Configure here.
Assisted-by: Claude Code:claude-opus-5-5
|
[burn-down agent] Labeled Ready for review at df7d599.
Generated by Claude Code |
Final review briefWhat it does. Test-only. Risk: low. No production code changes. The scrub only gets stricter. The one behavior change is that test children no longer inherit Look here
Verified
Changes I made: none. Open questions: none. Note that Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed df7d599bde11417b8194bd6f8534b5626db59b24. Checked color/environment scrubbing and hostile-ambient regression coverage for regular and PTY children. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1958
Register row T59 (register); living document Part 5 (tests).
Why
hermetic::commandremoved theSOCKET_*env but none of the env the CLI's color and width policy reads (ui::color_enabled,ui::width_of). An ambientCLICOLOR_FORCE=1put ANSI codes into captured stdout. ItsHOSTILE_SEEDSwere set and then removed by the same list, so a dropped scrub line could never show up in a test.Changes (test-only)
tests/common/hermetic.rsCOLOR_ENV(NO_COLOR,CLICOLOR,CLICOLOR_FORCE,COLUMNS), whichcommandremoves.pty_commandinherits this.TERMis left alone because the PTY suites choose their own.HOSTILE_SEEDS, its seed loop and the false "turns tests red" doc. Deletes theExtra::Yarn/Pnpm/Bundleseed-then-remove pairs and their docs.SOCKET_UPDATE_BASE_URL/SOCKET_UPDATE_STATE_DIR. They aren't flag-bound, and the deleted seed loop was the only thing removing them by name.run_bin_with_env(and suites that calljvm_env::isolate_cli) pinHOME. Moving the pin intocommandwould change HOME for about 150 suites and their package-manager grandchildren. That is a separate, riskier change, so this PR only corrects the doc.tests/spawn_env_hygiene.rscommand_never_leaks_its_hostile_seedsand the PTY variant withcommand_scrubs_hostile_ambient_envandpty_command_scrubs_hostile_ambient_env_and_keeps_caller_env. Both set everyGLOBAL_ARG_ENV_VARS/LOCAL_ARG_ENV_VARSname (except the 3 forced opt-outs), the token, the update vars and the color env in the test process, then assert the child never sees any of them.extra_seeds_are_scrubbed_whatever_the_ambient_value. It could not fail, because the ambient-seededExtratests above it already cover the same thing.e2e_golang_build.rs,e2e_vendored_production.rsandvendor/e2e_golang_redirect.rs.Evidence
main@ cbbbdb9,CLICOLOR_FORCE=1 cargo test -p socket-patch-cli --test cli_parse_listfailspopulated_manifest_plain_lists_full_record_via_binary(68/1). On this branch it passes 69/69, and also withCLICOLOR_FORCE=1 NO_COLOR= COLUMNS=20.CLICOLOR_FORCEremoved fromCOLOR_ENV, both canary tests fail withambient CLICOLOR_FORCE must be scrubbed.CLICOLOR_FORCE=1 COLUMNS=20, thecli,scan,update,rollbackandremovesuites pass: 654 tests, including the PTY render and prompt tests.spawn_env_hygienepasses 19/19. clippy-D warningsis clean onspawn_env_hygiene.e2e_vendored_production's clippy--testserrors are pre-existing on main, and this PR changes only comments there.Size
+69 / −82 across 5 test files. No production lines change.
Behavior
None in the product. Test children no longer inherit
NO_COLOR/CLICOLOR/CLICOLOR_FORCE/COLUMNS, and a test that wants them sets them explicitly, aftercommand.Risk
Low. The change is test-only and no
cfg(windows)code changed./code-review highraised 6 findings and all are fixed: the by-name update-var removal, 2 stale comments, the doc reflow, the PTY test'sOptionround-trip, and the canary now seeding every flag-bound var.🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aePX7rzgjWUhucTZmxi
Note
Low Risk
Test-only changes to hermetic spawn helpers and hygiene tests; no production code paths modified.
Overview
Hermetic test spawns no longer inherit terminal color/width env (
NO_COLOR,CLICOLOR,CLICOLOR_FORCE,COLUMNS), which the CLI uses for output formatting—so ambient values likeCLICOLOR_FORCE=1stop polluting captured stdout assertions.The old
HOSTILE_SEEDSpattern (set hostile values then remove them in the same builder) is removed because it could never fail if a scrub line was dropped.spawn_env_hygienenow seeds the full hostile set in the test process (flag-boundSOCKET_*, token/update vars, color env) and asserts the child never sees them; the same approach replaces the PTY canary. Package-managerExtrascrubs (Yarn/Pnpm/Bundle) drop their seed-then-remove steps;commandstill removesSOCKET_UPDATE_BASE_URL/SOCKET_UPDATE_STATE_DIRby name. Docs/comments in a few e2e files are updated to match.Product behavior is unchanged—test harness only (~+69/−82 lines).
Reviewed by Cursor Bugbot for commit df7d599. Configure here.
Generated by Claude Code