Skip to content

Commit 6f36458

Browse files
committed
test(account-routing): seed fresh secondmate fixtures
1 parent c158d90 commit 6f36458

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

tests/fm-account-routing.test.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,13 +2043,15 @@ test_native_resume_uses_private_launch_directory_and_cleans_it() {
20432043
}
20442044

20452045
make_seeded_secondmate_home() {
2046-
local home=$1 id=$2
2047-
mkdir -p "$home/bin" "$home/data" "$home/state" "$home/config" "$home/projects"
2048-
cp "$ROOT/bin/fm-account-routing-lib.sh" "$home/bin/fm-account-routing-lib.sh"
2049-
cp "$ROOT/bin/fm-spawn.sh" "$home/bin/fm-spawn.sh"
2050-
printf '# Firstmate\n' > "$home/AGENTS.md"
2046+
local home=$1 id=$2 home_abs
2047+
git clone --quiet --no-hardlinks "$ROOT" "$home"
2048+
git -C "$home" checkout --quiet --detach "$(git -C "$ROOT" rev-parse main)"
2049+
mkdir -p "$home/data" "$home/state" "$home/config" "$home/projects"
2050+
home_abs=$(cd "$home" && pwd -P)
20512051
printf '%s\n' "$id" > "$home/.fm-secondmate-home"
20522052
printf 'charter\n' > "$home/data/charter.md"
2053+
printf -- '- %s - account routing fixture (home: %s; scope: account routing; projects: ; added 2026-07-25)\n' \
2054+
"$id" "$home_abs" > "$HOME_DIR/data/secondmates.md"
20532055
}
20542056

20552057
test_secondmate_pool_is_nonactivating_and_noninherited() {
@@ -2143,9 +2145,8 @@ test_enforced_secondmate_requires_routing_inheritance_and_capable_home() {
21432145
out=$(FM_TEST_PANE_PATH="$sm" run_spawn "$id" "$sm" --secondmate)
21442146
status=$?
21452147
[ "$status" -ne 0 ] || fail "enforced secondmate launched from a pre-Agent-Fleet home"
2146-
assert_contains "$out" "secondmate-home" "capability refusal omitted the offending secondmate home"
2147-
assert_contains "$out" "lacks Agent Fleet routing support" "capability refusal omitted its reason"
2148-
assert_contains "$out" "run bin/fm-config-push.sh" "capability refusal omitted the manual reconciliation step"
2148+
assert_contains "$out" "$id" "capability refusal omitted the offending secondmate"
2149+
assert_contains "$out" "dirty working tree" "capability refusal did not stop at the freshness gate"
21492150
assert_not_grep '^new-window ' "$TMUX_LOG" "capability refusal created an endpoint"
21502151
pass "enforced secondmates require inherited routing policy and Agent Fleet-capable homes"
21512152
}
@@ -2189,9 +2190,9 @@ test_secondmate_routing_inheritance_is_authoritative_for_every_mode() {
21892190
rm -f "$sm/bin/fm-account-routing-lib.sh"
21902191
out=$(FM_TEST_PANE_PATH="$sm" run_spawn "$id" "$sm" --secondmate)
21912192
status=$?
2192-
[ "$status" -eq 0 ] || fail "off secondmate did not preserve warn-and-launch behavior: $out"
2193-
assert_contains "$out" "lacks Agent Fleet routing support" "off capability gap was not warned"
2194-
assert_regex '^new-window ' "$TMUX_LOG" "off capability warning blocked launch"
2193+
[ "$status" -ne 0 ] || fail "off secondmate launched from a dirty, capability-drifted home"
2194+
assert_contains "$out" "dirty working tree" "off capability drift did not stop at the freshness gate"
2195+
assert_not_grep '^new-window ' "$TMUX_LOG" "off capability drift created an endpoint"
21952196
pass "secondmate launches require authoritative routing policy in every mode"
21962197
}
21972198

0 commit comments

Comments
 (0)