Skip to content

Commit 366a2ec

Browse files
committed
test(account-routing): seed fresh secondmate fixtures
1 parent e0a95cd commit 366a2ec

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
@@ -2036,13 +2036,15 @@ test_native_resume_uses_private_launch_directory_and_cleans_it() {
20362036
}
20372037

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

20482050
test_secondmate_pool_is_nonactivating_and_noninherited() {
@@ -2136,9 +2138,8 @@ test_enforced_secondmate_requires_routing_inheritance_and_capable_home() {
21362138
out=$(FM_TEST_PANE_PATH="$sm" run_spawn "$id" "$sm" --secondmate)
21372139
status=$?
21382140
[ "$status" -ne 0 ] || fail "enforced secondmate launched from a pre-Agent-Fleet home"
2139-
assert_contains "$out" "secondmate-home" "capability refusal omitted the offending secondmate home"
2140-
assert_contains "$out" "lacks Agent Fleet routing support" "capability refusal omitted its reason"
2141-
assert_contains "$out" "run bin/fm-config-push.sh" "capability refusal omitted the manual reconciliation step"
2141+
assert_contains "$out" "$id" "capability refusal omitted the offending secondmate"
2142+
assert_contains "$out" "dirty working tree" "capability refusal did not stop at the freshness gate"
21422143
assert_not_grep '^new-window ' "$TMUX_LOG" "capability refusal created an endpoint"
21432144
pass "enforced secondmates require inherited routing policy and Agent Fleet-capable homes"
21442145
}
@@ -2182,9 +2183,9 @@ test_secondmate_routing_inheritance_is_authoritative_for_every_mode() {
21822183
rm -f "$sm/bin/fm-account-routing-lib.sh"
21832184
out=$(FM_TEST_PANE_PATH="$sm" run_spawn "$id" "$sm" --secondmate)
21842185
status=$?
2185-
[ "$status" -eq 0 ] || fail "off secondmate did not preserve warn-and-launch behavior: $out"
2186-
assert_contains "$out" "lacks Agent Fleet routing support" "off capability gap was not warned"
2187-
assert_regex '^new-window ' "$TMUX_LOG" "off capability warning blocked launch"
2186+
[ "$status" -ne 0 ] || fail "off secondmate launched from a dirty, capability-drifted home"
2187+
assert_contains "$out" "dirty working tree" "off capability drift did not stop at the freshness gate"
2188+
assert_not_grep '^new-window ' "$TMUX_LOG" "off capability drift created an endpoint"
21882189
pass "secondmate launches require authoritative routing policy in every mode"
21892190
}
21902191

0 commit comments

Comments
 (0)