docs/GOTCHAS.md's index row is the last single-anchor concurrent-write surface — two workers both minted hazard 79 and reded run 23830, stranding #298 (GOTCHAS 72 family) #300

Closed
opened 2026-10-22 00:08:30 +00:00 by matou-build-agent · 3 comments

Filed by the swarm healer for run https://git.matou.nz/Matou/dev-factory/actions/runs/23830 (signature 5b8242a74b26, heal run heal-Matou-dev-factory-1792627535-4154789).

Symptom

Run 23830's elitebook-distributed-server-03 leg went green through the worker's own work — #298 finished, the close-report gate passed, the ticket closed — then reded at sandcastle run (workers) exit 1 after the agent stopped (run-verdict.txt, job-log.txt:232):

Agent stopped
Merging to main
Git sync failed: Merge of 'sandcastle/worker/20261021-233637-f21837' onto 'main' failed.
SyncError (_tag: 'Fail')  [ELIFECYCLE] Command failed with exit code 1.

workdir-git.txt shows UU docs/GOTCHAS.md as the only conflicted path.

Root cause

This is the GOTCHAS 72 family's next instance, on a surface #230/#287 never covered. Run 23830 ran two workers concurrently:

  • ...-4baf64 worked #299 → added docs/gotchas/79-a-checkout-that-pushes-main-must-set-core-hookspath.md + index row 79, and landed first (315e0da).
  • ...-f21837 worked #298 → added docs/gotchas/79-a-stat-event-rm-marker-exit-double-writes-under-a-race.md + its own index row 79, forked from b5a8c78 before #299 landed.

Both minted the same hazard number (each read the max row from its own fork of main) and both appended a row at the same tail anchor of docs/GOTCHAS.md. Divergent inserts at one anchor is a textual conflict git cannot auto-resolve. Reproduced deterministically in a throwaway clone:

$ git merge --no-commit --no-ff origin/sandcastle/worker/20261021-233637-f21837
Auto-merging docs/GOTCHAS.md
CONFLICT (content): Merge conflict in docs/GOTCHAS.md
$ sed -n '96,100p' docs/GOTCHAS.md
<<<<<<< HEAD
| 79 | ... core.hooksPath ... (#299)
=======
| 79 | ... marker-exit double-write ... (#298)
>>>>>>> origin/sandcastle/worker/20261021-233637-f21837

Note what did not conflict: the hazard body files (one file per hazard) and the journal entries (one file per ticket) both merged cleanly — #230's append-only-file design works. Only the shared index row collides. #287 closed STATUS.md's single rewritten header line but nobody generalised the lesson to docs/GOTCHAS.md, whose #196 index is still a tail-append plus a monotonically-minted number — i.e. two writers contend on both the anchor and the number.

Residual damage (needs a human land — MERGE_AUTHORITY=human)

#298 is closed green but its work is not on main — the #282/#283/#285 family again, the documented push-mode close-before-land residual (#288). The commit is stranded:

  • eb47cac on origin/sandcastle/worker/20261021-233637-f21837
  • carries limit-lib.sh, tests/limit-lib-test.sh, tests/swarm-db-test.sh, the hazard body, and docs/journal/2026-10-22-298.md

Landing it needs a decision this healer must not make: the stranded hazard has to be renumbered 79 → 80 (79 is taken by #299 on main), which renames its body file and rewrites its index row and in-body heading.

Why product-class

The fix surface is all harness source at the repo root — the docs/GOTCHAS.md index design, the CLAUDE.md rule that mints the next number, and tests/docs-budget-test.sh's ratchet. Per the healer charter the healer filed this ticket instead of editing it. A root fix is inert in the running .sandcastle/ self-copy and in every consumer until a human re-vendors and bumps FACTORY_REF (currently 6de4c309df03473bb53227d8e57591fabe5207d8) — GOTCHAS 4.

Acceptance criteria

  1. Two concurrent writers can each add a hazard without a textual conflict in docs/GOTCHAS.md. Pick a design and record the trade-off — e.g. generate the index from docs/gotchas/*.md front-matter (writers only ever add their own body file), or key hazards by a collision-free id instead of a shared monotonic counter.
  2. Hazard-number minting is collision-safe, or numbers stop being the identity. Two workers forked from the same main must not be able to mint the same number.
  3. A test in tests/ proves it: simulate two forked branches each adding a hazard, merge both onto main, assert no conflict and no duplicate id. Offline, like the rest of the suite.
  4. tests/docs-budget-test.sh keeps its index budget green under the new design (and keeps skipping cleanly in a vendored copy, #294).
  5. Update the CLAUDE.md "Docs homes" rule and GOTCHAS 72's Related line to name this surface as closed.
  6. Decide and state whether STATUS.md's surface table rows have the same residual contention (writers touching the same row), or confirm they do not.

Separate from this ticket

Landing stranded eb47cac (with the 79 → 80 renumber) is a human merge-authority action — it is not part of this fix and should not wait on it. Flagged in the healer's escalation.

Filed by the swarm healer for run https://git.matou.nz/Matou/dev-factory/actions/runs/23830 (signature `5b8242a74b26`, heal run `heal-Matou-dev-factory-1792627535-4154789`). ## Symptom Run 23830's `elitebook-distributed-server-03` leg went green through the worker's own work — #298 finished, the close-report gate passed, the ticket closed — then reded at `sandcastle run (workers)` exit 1 *after* the agent stopped (`run-verdict.txt`, `job-log.txt:232`): ``` Agent stopped Merging to main Git sync failed: Merge of 'sandcastle/worker/20261021-233637-f21837' onto 'main' failed. SyncError (_tag: 'Fail') [ELIFECYCLE] Command failed with exit code 1. ``` `workdir-git.txt` shows `UU docs/GOTCHAS.md` as the **only** conflicted path. ## Root cause This is the GOTCHAS 72 family's next instance, on a surface #230/#287 never covered. Run 23830 ran two workers concurrently: - `...-4baf64` worked **#299** → added `docs/gotchas/79-a-checkout-that-pushes-main-must-set-core-hookspath.md` + index row `79`, and **landed first** (`315e0da`). - `...-f21837` worked **#298** → added `docs/gotchas/79-a-stat-event-rm-marker-exit-double-writes-under-a-race.md` + its own index row `79`, forked from `b5a8c78` before #299 landed. Both **minted the same hazard number** (each read the max row from its own fork of `main`) and both **appended a row at the same tail anchor** of `docs/GOTCHAS.md`. Divergent inserts at one anchor is a textual conflict git cannot auto-resolve. Reproduced deterministically in a throwaway clone: ``` $ git merge --no-commit --no-ff origin/sandcastle/worker/20261021-233637-f21837 Auto-merging docs/GOTCHAS.md CONFLICT (content): Merge conflict in docs/GOTCHAS.md $ sed -n '96,100p' docs/GOTCHAS.md <<<<<<< HEAD | 79 | ... core.hooksPath ... (#299) ======= | 79 | ... marker-exit double-write ... (#298) >>>>>>> origin/sandcastle/worker/20261021-233637-f21837 ``` Note what did **not** conflict: the hazard **body** files (one file per hazard) and the **journal** entries (one file per ticket) both merged cleanly — #230's append-only-file design works. Only the shared index row collides. #287 closed STATUS.md's single rewritten header line but nobody generalised the lesson to `docs/GOTCHAS.md`, whose #196 index is still a tail-append *plus* a monotonically-minted number — i.e. two writers contend on both the anchor and the number. ## Residual damage (needs a human land — MERGE_AUTHORITY=human) #298 is **closed green but its work is not on `main`** — the #282/#283/#285 family again, the documented push-mode close-before-land residual (#288). The commit is stranded: - `eb47cac` on `origin/sandcastle/worker/20261021-233637-f21837` - carries `limit-lib.sh`, `tests/limit-lib-test.sh`, `tests/swarm-db-test.sh`, the hazard body, and `docs/journal/2026-10-22-298.md` Landing it needs a decision this healer must not make: the stranded hazard has to be **renumbered 79 → 80** (79 is taken by #299 on `main`), which renames its body file and rewrites its index row and in-body heading. ## Why product-class The fix surface is all harness source at the repo root — the `docs/GOTCHAS.md` index design, the CLAUDE.md rule that mints the next number, and `tests/docs-budget-test.sh`'s ratchet. Per the healer charter the healer filed this ticket instead of editing it. **A root fix is inert in the running `.sandcastle/` self-copy and in every consumer until a human re-vendors and bumps `FACTORY_REF`** (currently `6de4c309df03473bb53227d8e57591fabe5207d8`) — GOTCHAS 4. ## Acceptance criteria 1. Two concurrent writers can each add a hazard without a textual conflict in `docs/GOTCHAS.md`. Pick a design and record the trade-off — e.g. **generate** the index from `docs/gotchas/*.md` front-matter (writers only ever add their own body file), or key hazards by a collision-free id instead of a shared monotonic counter. 2. Hazard-number minting is collision-safe, or numbers stop being the identity. Two workers forked from the same `main` must not be able to mint the same number. 3. A test in `tests/` proves it: simulate two forked branches each adding a hazard, merge both onto `main`, assert no conflict and no duplicate id. Offline, like the rest of the suite. 4. `tests/docs-budget-test.sh` keeps its index budget green under the new design (and keeps skipping cleanly in a vendored copy, #294). 5. Update the CLAUDE.md "Docs homes" rule and GOTCHAS 72's **Related** line to name this surface as closed. 6. Decide and state whether `STATUS.md`'s surface **table rows** have the same residual contention (writers touching the *same* row), or confirm they do not. ## Separate from this ticket Landing stranded `eb47cac` (with the 79 → 80 renumber) is a **human merge-authority** action — it is not part of this fix and should not wait on it. Flagged in the healer's escalation.
Author
Member

swarm-claim host=bens-mac-04 run=23841
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=23841 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #300 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #300 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #300 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261021-191646-b93327 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 300,
  "status": "success",
  "commits": [
    "b915827ef8037b4450850b47c69bf4a41d184f1b"
  ],
  "changed_files": [
    ".gitattributes",
    "CLAUDE.md",
    "docs/GOTCHAS.md",
    "docs/gotchas/300-gotchas-index-was-the-last-single-anchor-concurrent-write-surface.md",
    "docs/gotchas/72-merge-to-head-reds-a-landing-pr-run-on-a-status-conflict.md",
    "docs/journal/2026-10-22-300.md",
    "onboarding/vendor-exclude",
    "tests/gotchas-index-merge-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/gotchas-index-merge-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "1. two concurrent writers add a hazard with no textual conflict in docs/GOTCHAS.md": ".gitattributes sets `docs/GOTCHAS.md merge=union` (append-only surface); proven by tests/gotchas-index-merge-test.sh merging two forked branches with rc=0 and no conflict markers, plus a control proving the same appends conflict WITHOUT the attribute. Trade-off recorded in .gitattributes/the journal: union is safe only on an append-only surface.",
    "2. hazard-number minting is collision-safe / numbers stop being identity": "A hazard is now keyed by its CLOSING TICKET number (#<ticket>), tracker-assigned and held by one worker, so two forks of one main can never mint the same id — no max+1 step. Documented in CLAUDE.md Docs homes + docs/GOTCHAS.md header; hazards 1-79 keep legacy numbers.",
    "3. a tests/ test proves it (two forked branches, merge both, no conflict + no dup id, offline)": "tests/gotchas-index-merge-test.sh — offline throwaway git repo, forks two ticket-keyed hazard adds, merges both onto main, asserts no conflict, no markers, both rows, no duplicate id; control asserts conflict without merge=union. 10 passed, 0 failed.",
    "4. tests/docs-budget-test.sh stays green and still skips in a vendored copy": "Index grew 20.3 -> ~20.6 KB, under the 24 KB ratchet; docs-budget-test passes. The new test carries the same vendored-copy visible-skip guard (#294), verified in a simulated .sandcastle/ root.",
    "5. update CLAUDE.md Docs homes rule and GOTCHAS 72 Related line to name this surface closed": "CLAUDE.md Docs homes GOTCHAS bullet rewritten (ticket-keyed ids + merge=union, #300); docs/gotchas/72-*.md Related line names #300 as closing the last surface in the family.",
    "6. decide/state whether STATUS.md surface table rows have the same residual contention": "Stated in the #300 hazard body, the journal entry, and the commit: STATUS.md rows are updated IN PLACE and two writers touch DIFFERENT rows (git 3-way-merges cleanly), with no mint step — so STATUS.md does NOT share this failure. Union would corrupt same-row edits, so STATUS.md keeps the #287 'writers touch different rows' discipline and is deliberately NOT merge=union. Residual: two writers editing the SAME row — narrower, not addressed here."
  },
  "summary": "docs/GOTCHAS.md stops being a concurrent-write conflict surface: .gitattributes merge=union on the append-only index plus ticket-keyed collision-free hazard ids, proven by a new offline merge test.",
  "blockers": []
}
**close-report** for #300 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261021-191646-b93327` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 300, "status": "success", "commits": [ "b915827ef8037b4450850b47c69bf4a41d184f1b" ], "changed_files": [ ".gitattributes", "CLAUDE.md", "docs/GOTCHAS.md", "docs/gotchas/300-gotchas-index-was-the-last-single-anchor-concurrent-write-surface.md", "docs/gotchas/72-merge-to-head-reds-a-landing-pr-run-on-a-status-conflict.md", "docs/journal/2026-10-22-300.md", "onboarding/vendor-exclude", "tests/gotchas-index-merge-test.sh" ], "tests": [ { "command": "bash tests/gotchas-index-merge-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh", "exit_code": 0 } ], "criteria": { "1. two concurrent writers add a hazard with no textual conflict in docs/GOTCHAS.md": ".gitattributes sets `docs/GOTCHAS.md merge=union` (append-only surface); proven by tests/gotchas-index-merge-test.sh merging two forked branches with rc=0 and no conflict markers, plus a control proving the same appends conflict WITHOUT the attribute. Trade-off recorded in .gitattributes/the journal: union is safe only on an append-only surface.", "2. hazard-number minting is collision-safe / numbers stop being identity": "A hazard is now keyed by its CLOSING TICKET number (#<ticket>), tracker-assigned and held by one worker, so two forks of one main can never mint the same id — no max+1 step. Documented in CLAUDE.md Docs homes + docs/GOTCHAS.md header; hazards 1-79 keep legacy numbers.", "3. a tests/ test proves it (two forked branches, merge both, no conflict + no dup id, offline)": "tests/gotchas-index-merge-test.sh — offline throwaway git repo, forks two ticket-keyed hazard adds, merges both onto main, asserts no conflict, no markers, both rows, no duplicate id; control asserts conflict without merge=union. 10 passed, 0 failed.", "4. tests/docs-budget-test.sh stays green and still skips in a vendored copy": "Index grew 20.3 -> ~20.6 KB, under the 24 KB ratchet; docs-budget-test passes. The new test carries the same vendored-copy visible-skip guard (#294), verified in a simulated .sandcastle/ root.", "5. update CLAUDE.md Docs homes rule and GOTCHAS 72 Related line to name this surface closed": "CLAUDE.md Docs homes GOTCHAS bullet rewritten (ticket-keyed ids + merge=union, #300); docs/gotchas/72-*.md Related line names #300 as closing the last surface in the family.", "6. decide/state whether STATUS.md surface table rows have the same residual contention": "Stated in the #300 hazard body, the journal entry, and the commit: STATUS.md rows are updated IN PLACE and two writers touch DIFFERENT rows (git 3-way-merges cleanly), with no mint step — so STATUS.md does NOT share this failure. Union would corrupt same-row edits, so STATUS.md keeps the #287 'writers touch different rows' discipline and is deliberately NOT merge=union. Residual: two writers editing the SAME row — narrower, not addressed here." }, "summary": "docs/GOTCHAS.md stops being a concurrent-write conflict surface: .gitattributes merge=union on the append-only index plus ticket-keyed collision-free hazard ids, proven by a new offline merge test.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#300
No description provided.