Skip to content

feat(team): join placement records on canonical (kind, instance, pane), not raw ref (#1144) - #1167

Open
fujibee wants to merge 2 commits into
integration/terminal-driver-v1from
fix/1144-detector-contract
Open

feat(team): join placement records on canonical (kind, instance, pane), not raw ref (#1144)#1167
fujibee wants to merge 2 commits into
integration/terminal-driver-v1from
fix/1144-detector-contract

Conversation

@fujibee

@fujibee fujibee commented Sep 12, 2026

Copy link
Copy Markdown
Owner

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 reported
as unscoped_record instead 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 nothing
  • collisions: none_observed + coverage: partial -- something along the
    way 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 no teams/ directory to walk

Each of those four failure branches has a negative-control test that fails
when its guard is reverted to a silent continue (verified locally by
mutation before opening this PR).

Drops the old resident_agent: absent check (terminal_pane_state /
terminal_team_input_ready): that touches a live pane, which is the
actual-location layer's job, not this one. scripts/lib/placement-actual-location.sh
adds that layer's classifier (matched / stale_or_missing_target /
unknown) against a census snapshot shaped like #1155's own
agmsg_terminal_enumerate rows, with unit tests against a hand-built
census blob. It is intentionally not wired into placement-collisions.sh
yet: 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/14
  • bats tests/test_placement_actual_location.bats -- 7/7
  • Each of the four coverage-diagnostic branches and the canonicalization
    join were manually mutated (guard removed) and confirmed to turn their
    corresponding test red, then restored.

…), 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
fujibee force-pushed the fix/1144-detector-contract branch from 67a50d1 to 9470237 Compare September 13, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant