feat(team): join placement records on canonical (kind, instance, pane), not raw ref (#1144) - #1167
Open
fujibee wants to merge 2 commits into
Open
feat(team): join placement records on canonical (kind, instance, pane), not raw ref (#1144)#1167fujibee wants to merge 2 commits into
fujibee wants to merge 2 commits into
Conversation
…), not raw ref (#1144) Record-only layer of the #1144 detector: two seats' records collide only when both resolve to the same canonical locator. A ref with no instance component to resolve (every herdr ref today; a legacy bare tmux %N/@n) is reported as unscoped_record instead of being joined by raw string equality, since record-only evidence cannot tell such refs apart across terminal instances (measured for herdr in #1155: two live instances answered the same bare pane id). Every empty-return path in the walk now says why it is empty: a team whose agents could not be enumerated, a path-resolution failure, an unreadable placement record, and an empty ref field each surface as a named coverage diagnostic with count and target, rather than a silent continue. collisions: none means the walk completed and found nothing; collisions: none_observed plus coverage: partial means something could not be read; collisions: not_attempted means there was no teams/ directory to walk. Each failure branch has a negative-control test that fails when its guard is removed. Drops the old resident_agent: absent check (terminal_pane_state / terminal_team_input_ready): that touches a live pane, which belongs to the actual-location layer, not this one. scripts/lib/placement-actual-location.sh adds that layer's classifier against a census snapshot, matching #1155's own row shapes, but it is not wired here yet -- it needs a real census (#1155 is still landing) and must not be exercised end-to-end against a stub.
CI log showed the real cause instead of a guess: 'cfgs[@]: unbound
variable' at scripts/placement-collisions.sh:147, macos-latest only.
macOS's default /bin/bash is 3.2, where referencing "${cfgs[@]}" on a
ZERO-element array under set -u raises unbound variable (fixed upstream
well after 3.2; ubuntu-latest's modern bash does not reproduce it).
Reproduced directly with /bin/bash 3.2.57 locally, confirmed the fix
against the same interpreter, and reran the full suite.
fujibee
force-pushed
the
fix/1144-detector-contract
branch
from
September 13, 2026 09:55
67a50d1 to
9470237
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Record-only layer of the #1144 detector, per the design note reached from
the issue: two seats' records collide only when both resolve to the same
canonical (kind, instance, pane) locator. A ref with no instance component
to resolve (every herdr ref today; a legacy bare tmux
%N/@N) is reportedas
unscoped_recordinstead of being joined by raw string equality --record-only evidence cannot tell such refs apart across terminal instances
(measured for herdr in #1155: two live instances answered the same bare
pane id).
Every empty-return path in the walk now says why it is empty:
collisions: none-- the walk completed and found nothingcollisions: none_observed+coverage: partial-- something along theway could not be read (a team's agents could not be enumerated, a
placement path could not be resolved, a record was unreadable, a ref was
empty), each surfaced as a named diagnostic with count and target
collisions: not_attempted-- there was noteams/directory to walkEach of those four failure branches has a negative-control test that fails
when its guard is reverted to a silent
continue(verified locally bymutation before opening this PR).
Drops the old
resident_agent: absentcheck (terminal_pane_state/terminal_team_input_ready): that touches a live pane, which is theactual-location layer's job, not this one.
scripts/lib/placement-actual-location.shadds that layer's classifier (
matched/stale_or_missing_target/unknown) against a census snapshot shaped like #1155's ownagmsg_terminal_enumeraterows, with unit tests against a hand-builtcensus blob. It is intentionally not wired into
placement-collisions.shyet: it needs #1155's real census (still landing) and must not be exercised
end-to-end against a stub.
Test plan
bats tests/test_placement_collisions.bats-- 14/14bats tests/test_placement_actual_location.bats-- 7/7join were manually mutated (guard removed) and confirmed to turn their
corresponding test red, then restored.