C2: Claim arbitration per mode #23

Closed
opened 2026-10-28 11:07:49 +00:00 by jacisjake · 0 comments
jacisjake commented 2026-10-28 11:07:49 +00:00 (Migrated from github.com)

Epic: #21. Depends on: #22

Goal

Enforce claim classes (#5) per request mode: solo/split first-claim-wins (a second claim on the same request is refused and the refuser is told who owns it); conspiracy accepts every claim.

Acceptance criteria — falsifiable tests

  1. TestSoloSecondClaimRefused — Given a stored solo request R addressed nobody, when Hugin claims R, then 201 + to becomes R's author; when Munin then claims R, then 409 whose message names "Hugin". Red now (no claim bookkeeping), green after.
  2. TestConspiracyMultipleClaims — Given a stored conspiracy request R, when Hugin claims and Munin claims, then both 201 and both claims stored with refers_to == R.msg_id. Red now, green after.
  3. TestSplitSubtaskFirstClaimWins — Given a split request with two subtask messages (mode split, refers_to = parent), two claims on the same subtask: second 409; claims on different subtasks: both 201. Red now, green after.

Test command

go test -race -run 'TestSoloSecondClaimRefused|TestConspiracyMultipleClaims|TestSplitSubtaskFirstClaimWins' .

Blockers / unknowns

Reads mode from the request record (C1). Split subtask creation may be stubbed via direct msgs.Append in tests.

Epic: #21. Depends on: #22 ## Goal Enforce claim classes (#5) per request mode: solo/split first-claim-wins (a second claim on the same request is refused and the refuser is told who owns it); conspiracy accepts every claim. ## Acceptance criteria — falsifiable tests 1. `TestSoloSecondClaimRefused` — Given a stored solo request R addressed nobody, when Hugin claims R, then 201 + `to` becomes R's author; when Munin then claims R, then 409 whose `message` names "Hugin". Red now (no claim bookkeeping), green after. 2. `TestConspiracyMultipleClaims` — Given a stored conspiracy request R, when Hugin claims and Munin claims, then both 201 and both claims stored with `refers_to == R.msg_id`. Red now, green after. 3. `TestSplitSubtaskFirstClaimWins` — Given a split request with two subtask messages (mode `split`, `refers_to` = parent), two claims on the *same* subtask: second 409; claims on *different* subtasks: both 201. Red now, green after. ## Test command `go test -race -run 'TestSoloSecondClaimRefused|TestConspiracyMultipleClaims|TestSplitSubtaskFirstClaimWins' .` ## Blockers / unknowns Reads `mode` from the request record (C1). Split subtask creation may be stubbed via direct `msgs.Append` in tests.
Sign in to join this conversation.