beads/internal/validation
Jim Wordelman f1db5a9fa5
fix(close): refuse silent close on actor/assignee mismatch (#3734)
* fix(close): be-035 refuse silent close on actor/assignee mismatch

bd close now requires the actor to match the bead's assignee (or have
--force) before persisting. Without this, an actor whose claim was
overwritten by a concurrent re-claim could call bd close, see "✓ Closed"
on stdout, and leave the bead open in the store — silent data loss.

The storage UPDATE was already id-only with proper rowcount checking,
so this is purely a CLI-layer authority guard implemented as a new
validation.AssigneeMatches validator wired into validateIssueClosable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: release gate PASS for be-07y (be-035 close authority guard)

Cherry-pick of 7a925e304 onto a clean branch off origin/main. Verified
delta byte-identical to reviewed commit. All four be-035 acceptance
criteria covered; reviewer-recorded PASS verdict in bead notes; tests
pass on the touched surfaces (TestAssigneeMatches 6/6, TestEmbeddedClose
35/35 incl. four new authority-guard cases, TestEmbeddedCloseConcurrent).
Three full-suite flakes observed are pre-existing baseline (reproduce
on plain origin/main).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(count): close alice-assigned fixture with --force under be-035 guard

TestEmbeddedCount's setup created a fixture assigned to alice and closed it
as the test actor ("Test"). With this PR's be-035 close-authority guard, that
cross-actor close is now correctly refused (exit 1), failing the test setup at
count_embedded_test.go:84.

The fixture must remain assigned to alice for the --assignee alice count
assertion below (expects >=3), so close it with --force rather than dropping
the assignee. Fixes the Test (Embedded Dolt Cmd 5/20) shard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(validation): note identity-by-string semantics of AssigneeMatches

Addresses review question: two principals sharing one actor name both pass
the check, because the actor string is compared verbatim and bd has no
identity layer. Document this as intentional — the guard removes silent
cross-actor closes without adding new identity guarantees.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(close): update proxied-server call site for validateIssueClosable actor param

Maintainer branch-update for #3734: upstream added cmd/bd/close_proxied_server.go
after this PR's base; align its call with the PR's widened signature.

Agent-Signature: claude-fable-5-high on behalf of matt wilkie

---------

Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
2026-07-05 23:51:45 -07:00
..
bead.go fix(create): normalize trailing hyphen in dbPrefix before prefix validation (#4233) 2026-06-16 10:21:06 -07:00
bead_test.go fix(create): normalize trailing hyphen in dbPrefix before prefix validation (#4233) 2026-06-16 10:21:06 -07:00
issue.go fix(close): refuse silent close on actor/assignee mismatch (#3734) 2026-07-05 23:51:45 -07:00
issue_test.go fix(close): refuse silent close on actor/assignee mismatch (#3734) 2026-07-05 23:51:45 -07:00
template.go fix: --validate checks --acceptance field, add validation.on-close config (PR #2654) 2026-03-18 22:21:23 -07:00
template_test.go fix: --validate checks --acceptance field, add validation.on-close config (PR #2654) 2026-03-18 22:21:23 -07:00