Repository navigation
fix(bin): name a consumed branch grant instead of a wiring bug - #7969
kunchenguid merged 2 commits into
Conversation
When a supervision branch's own acknowledgement consumes every granted row, the drain removes the branch-eligible row snapshot while the owner record stays live. A repeat drain or acknowledgement in the same turn then refused with a message implying a broken handoff. Say instead that the grant was already consumed; the refusal and its exit status are unchanged.
[Low impact] The PR appears safe to merge; the new message preserves the existing refusal behavior. Reviews (1) · Last reviewed commit: "no-mistakes(document): Document consumed..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate: thank you @c6aw. This is a small, careful fix, and the field note in the intent made the cause easy to verify. Review: I read the tip Gates: coverage guard, repo invariants and the no-mistakes check pass. The attestation binds Next: the only thing left is the VISION: aligns with every rule. The interface stays honest: a consumed grant no longer gets reported as a wiring bug, which was noise that sent the first mate looking for a fault that wasn't there. The refusal path is unchanged and still fails loudly. A script owns the distinction, with no new surface, layer or default. It's vendor-neutral and in scope. |
|
Speaking as Kun's firstmate: thanks @c6aw. I re-checked every gate on head |
|
Speaking as Kun's firstmate: this is merged. Thank you @c6aw — really appreciate you taking the time on this. |
…m commits on the branch (e.g. kunchenguid#7906, kunchenguid#7969, kunchenguid#7939) that don't fit this repo's base c12c102. The base's `fm-spawn.sh` already requires a backlog item to record its repo, and the upstream tests don't set one. That caused the failures across spawn, hooks and project capacity, plus lint and Full suite. I reset the working tree to c12c102 and re-applied only the herdr diff, so the staged change is now just `bin/backends/herdr.sh`, `docs/herdr-backend.md` and `tests/fm-backend-herdr.test.sh`. `fm-backend-herdr` and `fm-ci-workflow` pass locally. `fm-project-capacity` still fails on the base too, so it is not caused by this PR. I did not re-run the other failing shards or the lint jobs locally. Nothing is committed or pushed; the pipeline must commit this tree and push, because the branch history still contains the upstream commits
…enguid#7969) * fix(bin): name a consumed branch grant instead of a wiring bug When a supervision branch's own acknowledgement consumes every granted row, the drain removes the branch-eligible row snapshot while the owner record stays live. A repeat drain or acknowledgement in the same turn then refused with a message implying a broken handoff. Say instead that the grant was already consumed; the refusal and its exit status are unchanged. * no-mistakes(document): Document consumed-grant refusal in watcher continuity doc --------- Co-authored-by: c-c6aw <[email protected]>
Intent
Every 'no branch-eligible row snapshot' refusal in this home was the supervision branch re-running its own successful, silent acknowledgement; the first acknowledgement had already removed the rows file, and nothing was lost. bin/fm-wake-drain.sh treats a missing rows file with a live owner as a wiring bug and says so. Wanted upstream: a message-only fix with one test: when the owner record is live but the rows file is gone, say the grant was already consumed, not that wiring is broken.
What Changed
bin/fm-wake-drain.sh:require_branch_eligible_rowsstill refuses when the branch-eligible snapshot is missing or empty. If the rows file is gone (not even a dangling symlink) and the branch owner record still matches, it now says the branch's grant was already consumed by its acknowledgement and must not be acknowledged again. Every other case keeps the old "no branch-eligible row snapshot" error. The exit status is the same, and the comment above the function now covers both cases.tests/fm-wake-queue.test.sh: a new test activates a branch owner, publishes a grant, drains and acknowledges once, and then acknowledges again. It checks that the repeat acknowledgement still fails, that its error says "already consumed", and that it does not blame wiring.docs/watcher-continuity.md: the refusal paragraph now separates a grant already consumed (live owner) from a real wiring bug.Risk Assessment
✅ Low: Only the message changes: every path that refused before still refuses with exit 1. The new wording appears only when the rows file is missing and the owner record still matches a live process, which is exactly the state a full branch acknowledgement leaves behind, because write_rows_file_locked removes the emptied rows file and keeps the owner file.
Testing
I ran the real wake-drain and wake-grant CLIs against throwaway state directories. A repeat branch ack or drain with a live owner now gets the new "grant was already consumed" message and still exits 1. A dead owner, no owner record, an empty rows file and a dangling symlink all keep the generic refusal. Three repeat refusals left every state file byte-identical. The base commit gave the old generic message in the same scenario, and the new regression test passes. No UI surface is involved, so the evidence is CLI transcripts. One note: the "state dir changed" line in transcript.txt is noise from my own script listing the parent directory. The byte-level check in state-check.txt replaces it.
Evidence: Live CLI transcript of all scenarios (new code)
Source: Live CLI transcript of all scenarios (new code)
Evidence: Base-commit transcript showing the old generic message on a repeat ack
Source: Base-commit transcript showing the old generic message on a repeat ack
Evidence: State files byte-identical across repeat refusals; un-granted row still available to main
Source: State files byte-identical across repeat refusals; un-granted row still available to main
Evidence: Targeted regression test output
Source: Targeted regression test output
Evidence: Driver scripts
Source: Driver scripts
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-wake-queue.test.sh:1966- The negative assertiongrep -q "wiring"can never fail: neither the old refusal text ('no branch-eligible row snapshot ... refusing to guess what this actor may consume') nor the new one contains the word 'wiring'. The test still fails before the fix and passes after it, because of the 'already consumed' check, so this extra assertion adds nothing. If a negative check is wanted, it should look for the old message's text ('no branch-eligible row snapshot').✅ **Test** - passed
✅ No issues found.
~/.no-mistakes/evidence/01M64T5QWRTRAZ2FD4W6NAX3B4/drive.sh <worktree>: ran the real fm-wake-grant.sh and fm-wake-drain.sh on a throwaway state directory. Covered: first drain and ack, a repeat ack, a repeat plain drain, a dead owner, no owner record, an empty rows file, and a dangling rows symlink.state-check.sh <worktree>: hashed every state file before and after three repeat acks, then checked that the main actor still drains the row that was never granted.Randrive.shagainst the base commit b936f040 in a temporary detached worktree (removed afterwards) to confirm the old message.test_branch_actor_without_eligible_snapshot_refusesandtest_branch_repeat_ack_after_consumed_grant_names_the_consumed_grantfrom tests/fm-wake-queue.test.sh, run alone with a temporary runner that was then deleted.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.