This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Repository navigation
test: isolate Herdr behavior tests from ambient sessions - #75
Merged
Merged
Conversation
Running behavior tests from a live Herdr pane exported HERDR_ENV=1, so secondmate fixtures auto-selected the herdr backend and created real 2ndmate-* workspaces on the captain default session. Scrub ambient HERDR_* markers in the suite runner and tests/lib.sh, pin hermetic FM_BACKEND=tmux, and document the isolation contract.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Intent
Prevent Herdr test pollution of the captain default session by making hermetic behavior tests scrub ambient HERDR_* markers and pin FM_BACKEND=tmux when unset, while preserving explicit real-lab opt-ins. Keep the change limited to bin/fm-run-behavior-tests.sh, tests/lib.sh, tests/fm-run-behavior-tests.test.sh, and docs/herdr-backend.md; validate the ambient isolation with focused tests, open a PR targeting JTInventory/firstmate, and do not run real Herdr lab E2E against the captain default session.
What Changed
HERDR_*markers and default an unsetFM_BACKENDtotmux.FM_HERDR_ALLOW_AMBIENT=1opt-in.fm-lab-*requirements; the no-mistakes pipeline passed after review and lint auto-fixes.Risk Assessment
✅ Low: The updated change now scopes ambient bypassing to the explicit FM_HERDR_ALLOW_AMBIENT opt-in, scrubs and pins the normal path, and covers all six markers in focused fixtures.
Testing
The configured baseline was already green; independent focused and full-suite runs under simulated captain-pane
HERDR_*state completed successfully, real Herdr lab E2E remained disabled, the worktree stayed clean, and CLI evidence was captured. No UI artifact was applicable because this is a shell/CLI behavior change.Evidence: Focused Herdr isolation test transcript
Evidence: Full behavior suite under ambient markers
Evidence: Ambient contract transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed ✅
tests/lib.sh:47- The required criterion says hermetic tests must scrub ambient HERDR_* markers and pin FM_BACKEND=tmux when unset. This conditional skips both protections whenever a Herdr opt-in is set, so shared hermetic tests can retain HERDR_ENV=1 and spawn into the captain's default session.tests/fm-run-behavior-tests.test.sh:39- The fixture injects six HERDR_* markers but asserts only HERDR_ENV, HERDR_PANE_ID, and HERDR_SESSION. A regression leaving HERDR_TAB_ID, HERDR_WORKSPACE_ID, or HERDR_SOCKET_PATH set would pass; assert all scrubbed markers.bin/fm-run-behavior-tests.sh:145- The docs introduce FM_HERDR_ALLOW_AMBIENT=1 as an explicit ambient-detection opt-in, but the suite runner unconditionally unsets all HERDR_* variables before tests start. The documented opt-in therefore cannot work through the full runner; either honor it deliberately or narrow the documentation.🔧 Fix: Fixed Herdr isolation and ambient opt-in handling
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash bin/fm-run-behavior-tests.shenv HERDR_ENV=1 HERDR_SESSION=default HERDR_PANE_ID=w9:p9 HERDR_TAB_ID=w9:t9 HERDR_WORKSPACE_ID=w9 HERDR_SOCKET_PATH=/tmp/fake-herdr.sock FM_BACKEND= FM_HERDR_E2E=0 FM_HERDR_SMOKE=0 bash tests/fm-run-behavior-tests.test.shenv HERDR_ENV=1 HERDR_SESSION=default HERDR_PANE_ID=w9:p9 HERDR_TAB_ID=w9:t9 HERDR_WORKSPACE_ID=w9 HERDR_SOCKET_PATH=/tmp/fake-herdr.sock FM_BACKEND= FM_HERDR_E2E=0 FM_HERDR_SMOKE=0 bash bin/fm-run-behavior-tests.shManual environment checks for hermetic scrubbing, explicitFM_BACKEND=herdrpreservation, andFM_HERDR_ALLOW_AMBIENT=1preservation✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Fix ShellCheck SC1007 empty FM_BACKEND assignments
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.