Skip to content

superseded_by reports zero holders for a chain of two dead-lane TAKEOVERs on one object #74

Closed

Description

@brettheap

superseded_by's "is there another lane's TAKEOVER here" test does not stop at the CURRENT one: a chain of two dead-lane takeovers on one object makes who report ZERO holders, not one.

Where this was found

Writing regression tests for PR #61 (issue #30, claim --force taking over a dead lane's hold whatever its verb) for the three open verbs the PR's own suite had not yet exercised for a dead-lane takeover — LANDING, WITHDRAWN, and an earlier TAKEOVER — the third case exposed this. tests/test_lane_helpers.sh, lane family repoL (repoL-5/repoL-6 in PR #61's branch), fixture:

# lane repoL-5's own object log
STARTED  — lane repoL-5, session <DEAD_ID>@Eagle, <old-utc>, lane:repoL-5 → home opensoft/repoL; estate repoL
TAKEOVER — lane repoL-5, session <DEAD_ID>@Eagle, <old-utc>, opensoft/repoL#40 ← lane:repoL-0
RETIRED  — lane repoL-5, session <DEAD_ID>@Eagle, <now-utc>, lane:repoL-5

repoL-5 is dead (log ends RETIRED, no live session backs <DEAD_ID> up — the same shape issue #30 was filed for), and its own last line on opensoft/repoL#40 is itself a TAKEOVER (it had, at some point, taken the object over from a repoL-0). LANES_LANE=repoL-6 lanes-edit.sh claim opensoft/repoL#40 --no-github --force correctly succeeds — holder_is_dead repoL-5 is true, so the dead-lane path (issue #30) fires — and correctly writes:

TAKEOVER — lane repoL-6, session <repoL-6's-session>@Eagle, <utc>, opensoft/repoL#40 ← lane:repoL-5

But lanes-edit.sh who opensoft/repoL#40 immediately afterward reports zero holders (HOLDS appears for neither repoL-5 nor repoL-6), where it should report exactly one: repoL-6.

Why

holders_of asks superseded_by(object, lane, lane's-own-last-verb) about EVERY lane that has ever written on the object, including the CURRENT (rightful) holder:

# lanes-edit.sh, superseded_by()
state_events | awk -v sep="$US" -v o="$1" -v me="$2" '
  function pos(pf, pn) { return pf "\034" sprintf("%09d", pn) }
  BEGIN { FS = sep; mel = tolower(me) }
  $6 == o && tolower($2) != mel { p = pos($10, $11); ll = tolower($2)
    if (!(ll in q) || p >= q[ll]) { q[ll] = p; v[ll] = $3; u[ll] = $1; nm[ll] = $2 } }
  END { for (l in q) if (v[l] == "TAKEOVER" && (!seen || q[l] >= b)) { seen = 1; b = q[l]; bl = nm[l]; bu = u[l] }
        if (seen) print bl "@" bu }'

For me = repoL-6, the only "other lane" with any line on opensoft/repoL#40 is repoL-5 — and repoL-5's own last line on that object is TAKEOVER. The test only asks "does some other lane's last line here read TAKEOVER" — it never asks whether that lane's own TAKEOVER has since been superseded itself. So repoL-5's stale, already-superseded TAKEOVER is read as evidence that repoL-6 is also superseded, and holders_of drops both rows.

For a single-hop takeover (the ordinary case, and the only shape the existing suite tested before PR #61's repoL-1..4 additions) this never fires: the dispossessed lane's own last line is whatever it originally held (CLAIMED/OPENED/LANDING/WITHDRAWN), never TAKEOVER itself, so there is exactly one TAKEOVER-ending lane in the set and it is correctly read as un-superseded. The bug is specific to a chain of two or more takeovers on the same object — which issue #30's dead-lane exception newly makes reachable in one --force call (a dead lane's own TAKEOVER was, before #30, never itself "stale-takeable" the way a CLAIMED was, so a chain like this could previously only arise from the pre-existing "two lanes each end on a TAKEOVER" race the docs already call out — never from one lane cleanly re-taking a dead lane's own prior takeover).

superseded_by's docstring already gestures at the limit ("R14 — ... the file-ordered position picks which one is NAMED; both are holders either way") — that assurance is for the simultaneous-race shape (two lanes each independently taking over the same stale claim), not for a chain (A claims, B takes over from A, C takes over from B), which was apparently never a reachable shape when this was written.

Suggested direction (not attempted here)

pos() compares <file>\x1c<zero-padded line> across different lanes' own files, which R14 says has no shared clock to justify treating as an order at all — it is used today only to pick a deterministic name among simultaneous racers, not to decide correctness. A correct fix likely needs superseded_by (or a caller building on it) to resolve the whole chain per object — e.g., compute, once per object, the set of lanes whose own TAKEOVER is not itself named as the lane:<x> in some other lane's TAKEOVER payload on the same object (reliable for the issue #30 dead-lane payload shape, TAKEOVER ← lane:<dead lane>; the original stale-CLAIMED shape's payload is a GitHub comment URL instead, so that half of the chain needs its own answer) — rather than the current one-hop, pairwise "does anyone else end on TAKEOVER" test.

Scope note

This is a pre-existing gap in superseded_by's own design (the "is there another lane's TAKEOVER" test has always compared positions this way); PR #61 does not introduce the mechanism, but its broadening of superseded_by's open-verb gate to include dead-lane TAKEOVER/OPENED/LANDING/WITHDRAWN (issue #30) is what makes a chain of takeovers newly reachable in the ordinary course of using claim --force, rather than only through the pre-existing simultaneous-race shape. who's misreport here does not corrupt any log — every line written is correct and in order — only the derived "who currently holds this" view drops both ends of the chain.

Activity

  1. brettheap commented on Sep 15, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-15T01:38:13Z, for #74

    Logged in lanes/log/openRepoTools-3.md at dbbbaf9ef72f7f0f92e48f9ef8b829ba7054b957.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#74:
       none
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#74"`, kept where the row or its body names `#74`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `74` as a whole token:
       none
    
  2. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    TAKEOVERopenRepoTools-3 — lane openRepoTools-5, session 0d83dca2-c18c-4bb0-99ce-896e6cafea02@Eagle, 2026-10-11T16:55:01Z, for #74

    Logged in lanes/log/openRepoTools-5.md at 7824dea1fadad2b80700cdf3646df64f61838a46 (takeover of the stale claim held by lane openRepoTools-3).

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#74:
    6:CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-15T01:38:13Z, for opensoft/openRepoTools#74
    13:1. existing `CLAIMED —` comments on opensoft/openRepoTools#74:
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#74"`, kept where the row or its body names `#74`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `74` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions