fix(bin): scrub inherited fleet-home overrides in the serial test lane - #3540
fix(bin): scrub inherited fleet-home overrides in the serial test lane#3540zeeshaanahmad wants to merge 1 commit into
Conversation
The parallel worker subshell already unset FM_HOME and the other fleet- home overrides before running a test script, but the serial lane passed them straight through. A test script builds its own fleet home, so an inherited FM_HOME is a second, invisible input that can decide a verdict: bin/fm-arm-pretool-check.sh, for one, reads FM_HOME as a classification input. A script's outcome could then depend on which lane the runner happened to schedule it into. Define the override list once and scrub it in both lanes: the serial lane through an env -u prefix on the child process (it shares the runner's own shell, unlike the parallel worker's subshell), and the parallel lane through the same list it already unset. Add a regression test that runs a fixture script in both lanes under leaked overrides and asserts neither lane lets any of them through, while an unrelated variable passes through untouched. Verified failing on unpatched upstream main (8988af2): the serial lane leaks FM_HOME into the child script while the parallel lane does not.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The shared array remains available in worker subshells, the serial Reviews (1): Last reviewed commit: "fix(bin): scrub inherited fleet-home ove..." | Re-trigger Greptile |
|
Speaking as Kun's firstmate: HEAD Attestation: MISSING — no head-bound no-mistakes attestation. NM 33658985494 approved/queued this pass (will fail body-compliance without attestation, same as siblings). CI 33658985315 approved this pass and queued. Contract-class: restore — the parallel worker subshell on main already VISION (per rule, evidence = fm-test-run.sh parallel unset on main + this diff):
This is waiting on you (the author), not a captain decision. Please workflow-approvals this pass: 33658985315, 33658985494 |
Summary
Fixes #3536.
bin/fm-test-run.sh's parallel worker subshell already unsetFM_HOMEand the other fleet-home overrides before running a test script, but the serial lane passed them straight through. A test script builds its own fleet home, so an inheritedFM_HOMEis a second, invisible input that can decide a verdict —bin/fm-arm-pretool-check.sh, for one, readsFM_HOMEas a classification input (see #3534 / #3538). A script's outcome could then depend on which lane the runner happened to schedule it into, rather than only on its own behavior.Changes
Note:
bin/fm-test-run.shhas diverged from the commit this port is based on, so this is a re-implementation against the current structure rather than a direct cherry-pick. Currentmainroutes every script execution — both lanes — through a sharedrun_script_bounded()helper, which the earlier structure did not have.FM_TEST_INHERITED_OVERRIDES), reused by both lanes.run_script_bounded()'s serial branch (stream == 1), prefix the childbashinvocation (and thefm_run_timedtimeout wrapper'sbash -cinvocation) withenv -u ...built from that list, so the scrub is scoped to the child process rather than the runner's own shell.unsetlist with a reference to the same array, so the two lanes can't drift apart again.test_fleet_home_overrides_are_scrubbed_in_both_lanes) that runs a fixture script in both lanes under every override exported and asserts neither lane lets any of them through, while confirming an unrelated variable still passes through untouched (so the scrub is proven targeted, not a blanket environment wipe).Test plan
bash tests/fm-test-run.test.shpasses with this change, including the new regression test.FM_HOMEinto the child script) and passes once patched.bin/fm-lint.shpasses.🤖 Generated with Claude Code