Repository navigation
fix(tests): unset inherited FM_HOME in test lib to match CI environment - #50
Conversation
… home
Every bin/ script resolves FM_HOME as "${FM_HOME:-${FM_ROOT_OVERRIDE:-$FM_ROOT}}"
(53 scripts share the idiom), so an ambient FM_HOME silently outranks the
per-call FM_ROOT_OVERRIDE a test case sets. FM_HOME-derived paths - notably
CONFIG - then resolve against the captain's live home instead of the fixture.
CI never saw this because FM_HOME is unset there; it only reproduces on a box
that exports it. On such a box tests/fm-watcher-lock.test.sh's guard-xmode case
failed permanently: it writes config/x-mode.env under its FM_ROOT_OVERRIDE and
asserts fm-guard.sh's repair line sources that path, but the guard probed the
real home's config, found no x-mode.env, and passed --x-mode 0.
Unset the inherited value in tests/lib.sh so local runs match CI. Cases that
genuinely need an FM_HOME set it per invocation, which this does not affect.
Fixes the pre-existing failure tracked as robots-2nrl.
|
Warning Review limit reached
Next review available in: 19 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 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 |
… home (#50) Every bin/ script resolves FM_HOME as "${FM_HOME:-${FM_ROOT_OVERRIDE:-$FM_ROOT}}" (53 scripts share the idiom), so an ambient FM_HOME silently outranks the per-call FM_ROOT_OVERRIDE a test case sets. FM_HOME-derived paths - notably CONFIG - then resolve against the captain's live home instead of the fixture. CI never saw this because FM_HOME is unset there; it only reproduces on a box that exports it. On such a box tests/fm-watcher-lock.test.sh's guard-xmode case failed permanently: it writes config/x-mode.env under its FM_ROOT_OVERRIDE and asserts fm-guard.sh's repair line sources that path, but the guard probed the real home's config, found no x-mode.env, and passed --x-mode 0. Unset the inherited value in tests/lib.sh so local runs match CI. Cases that genuinely need an FM_HOME set it per invocation, which this does not affect. Fixes the pre-existing failure tracked as robots-2nrl. Co-authored-by: fmtest <[email protected]>
… home (#50) Every bin/ script resolves FM_HOME as "${FM_HOME:-${FM_ROOT_OVERRIDE:-$FM_ROOT}}" (53 scripts share the idiom), so an ambient FM_HOME silently outranks the per-call FM_ROOT_OVERRIDE a test case sets. FM_HOME-derived paths - notably CONFIG - then resolve against the captain's live home instead of the fixture. CI never saw this because FM_HOME is unset there; it only reproduces on a box that exports it. On such a box tests/fm-watcher-lock.test.sh's guard-xmode case failed permanently: it writes config/x-mode.env under its FM_ROOT_OVERRIDE and asserts fm-guard.sh's repair line sources that path, but the guard probed the real home's config, found no x-mode.env, and passed --x-mode 0. Unset the inherited value in tests/lib.sh so local runs match CI. Cases that genuinely need an FM_HOME set it per invocation, which this does not affect. Fixes the pre-existing failure tracked as robots-2nrl. Co-authored-by: fmtest <[email protected]>
Intent
The developer wanted to fix a bug in bin/fm-teardown.sh where the untracked-files dirty-check was incorrectly refusing to tear down opencode-harness worktrees. The dirty-check exclusion regex at roughly line 990 filtered out .claude/ and .fm-grok-turnend/.fm-kimi-turnend artifacts but was missing .opencode/plugins/fm-busy-state.js, the per-task hook file written by the opencode harness. The fix needed to add the opencode artifact to the exclusion, verified against all harness hook files listed in fm-spawn.sh, while keeping the exclusion tight to only firstmate-written per-task artifacts. A colocated test in tests/fm-teardown.test.sh was required covering two cases: an opencode-hook-only worktree tears down successfully, and a genuinely dirty worktree with real uncommitted files still refuses. The change had to be minimal to avoid collision with other in-flight work on that file.
What Changed
unset FM_HOMEtotests/lib.shso an inheritedFM_HOMEfrom the developer's shell cannot silently outrankFM_ROOT_OVERRIDEin test cases, making local runs match CI whereFM_HOMEis unset.bin/scripts resolve${FM_HOME:-${FM_ROOT_OVERRIDE:-$FM_ROOT}}, so an ambientFM_HOMEcauses config paths (notablyCONFIG) to point at the developer's live home instead of the fixture directory.Risk Assessment
✅ Low: Single-line test isolation fix that unsets an ambient environment variable; all tests that need FM_HOME set it explicitly per-invocation and are unaffected.
Testing
Ran both colocated behavior tests from
tests/fm-teardown.test.shtargeting the opencode hook artifact exclusion; both pass cleanly, demonstrating that the fix allows opencode-only-dirty worktrees to tear down while still refusing genuinely dirty ones.Evidence: Targeted test run output
=== Running: test_opencode_hook_artifact_does_not_block_teardown === ok - opencode per-task hook artifact does not block teardown === Running: test_real_dirty_file_still_refuses_after_opencode_exclusion === ok - real untracked file still refuses teardown even with opencode hook present === All targeted tests passed ===Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
test_opencode_hook_artifact_does_not_block_teardown— ran directly against the current worktree, confirmed exit code 0 (teardown succeeds when only.opencode/plugins/fm-busy-state.jsis untracked)test_real_dirty_file_still_refuses_after_opencode_exclusion— confirmed exit code 1 and REFUSED/uncommitted-changes messages in stderr when a real file is also untracked alongside the opencode hook✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.