You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
id(tag_claims): compacted_claims returns a claim twice when the applied list repeats an ID — the production fold diverges from live_claims on duplicate input #4359
compacted_claims — the fold production actually uses — returns a claim twice when its input contains two Applied entries with the same event ID, while the reference fold live_claims returns it once. The module header promises the two folds always agree: "Both give the same result (P5.3, #184)" (pkgs/id/src/tag_claims.rs:21).
Evidence (verified this run, laptop fuzz probe)
live_claims (tag_claims.rs:182) collects sets into a BTreeMap keyed by claim ID (:192), so a duplicated ID collapses to one claim (last entry wins).
compacted_claims (tag_claims.rs:232) builds its result by iterating applied directly (:281 ff.) and filtering only on the removed set — it never dedupes by ID. Its internal by_id map (:233) dedupes, but the output list does not.
Probe (laptop, verbatim tag_claims.rs @ 3d6deeae7, only the Hash/AuthorKey imports stubbed; probe dir ~/git/fleet/probe-2026-11-02-laneB-tagfold/):
Randomized DAG fuzz, duplicate-free inputs: 50,000 cases, 0 divergences — the folds agree on well-formed input.
Same fuzz with duplicate Applied entries injected: divergences on iteration 4 already — compacted_claims emits the duplicated claim twice, live_claims once.
Equivocation case (same ID, values Some("A") then Some("B")): live_claims → 1 claim ("B"); compacted_claims → 2 claims with the same ID, one per spelling.
Why it matters
EventStore::tag_claims (pkgs/id/src/event_store/claims.rs:76) returns compacted_claims output verbatim, and it feeds TagIndex and alias display. A duplicated claim in that output is not cosmetic: aliases_of (pkgs/id/src/aliases.rs) counts claims, so one real claim appearing twice reads as two claims and the view shows the alias as Contested instead of Only — and the tag index carries a phantom second claim. Today the store's caller happens to build applied from a table keyed by event, so duplicates should not occur; but the fold's documented contract is unconditional, nothing in either function states a no-duplicates precondition, and the reference fold already tolerates duplicates. The production fold should not be the fragile one. (Related: #1421 asks for a mutation/planted-bug check for this fold; this is a concrete divergence such a check would catch.)
Acceptance criteria
compacted_claims returns at most one claim per claim ID for any input, matching live_claims on duplicate and equivocating inputs (state the chosen winner — the reference fold's last-wins — in the doc comment).
The module docs state the input precondition or the dedup behaviour explicitly, so "both give the same result" is true as written.
Regression tests in tag_claims.rs: verbatim duplicate Applied set entry, and same-ID entries with different values, asserting both folds agree.
Existing tag-claims and event-store claim tests still pass (cargo test for the id lib on laptop/CI).
Agent: new-issue-creator job (new-issue-creator-code-b, Lane B)
Session / ID: cron new-issue-creator-code-b run 2026-11-02 06:20 CST
Found via: filed this run
Task: Filed after verifying on the laptop (verbatim tag_claims.rs @3d6deeae7, probe ~/git/fleet/probe-2026-11-02-laneB-tagfold/): 50,000 duplicate-free fuzz cases show live_claims and compacted_claims agree, but any repeated Applied ID makes compacted_claims (the production fold, event_store/claims.rs:76) emit the claim twice while live_claims emits it once; an equivocating same-ID pair yields two claims with one ID. Enqueued as a repo-task/v1 triage packet on queue repo-health-code-pilot.
Expectation: effort/s — triage confirms the reproduction, then the fix dedupes compacted_claims' output by claim ID (last-wins, matching the reference fold), documents the contract, and adds the two regression tests.
Links: issue body (probe output), packet creator-b-2026-11-02-0620/packets/packet-4359-triage.json
Finding: Current-main reproduction passed at 97e3e8e0ac2fb829afa0b8e2eb0645678c22f3fd: duplicate/equivocating IDs make compacted_claims return two claims while live_claims returns one (last-wins).
Verification: Targeted temporary test passed (1/1); temporary test removed afterward. Task worktree is clean; no implementation or PR was created. Existing full tag_claims/event_store test suite was not run.
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 2, 2026
Picked up: OpenChamber scheduled lane claimed triage task 6227.
5 remaining items
dezren39 commentedon Nov 2, 2026
Done: Triage task 6227 completed as
triaged; scoped fix task 6236 is queued.ses_e5e63b9e96dffetVlKEI4z5b0H)97e3e8e0ac2fb829afa0b8e2eb0645678c22f3fd: duplicate/equivocating IDs makecompacted_claimsreturn two claims whilelive_claimsreturns one (last-wins).tag_claims/event_storetest suite was not run.queue/queued,task/fix) with in-progress labels cleared.dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
fix(id): fold only the last entry per event ID in live_claims too (#4359
fix(id): deduplicate compacted tag claims by event ID (#4374)
dezren39 commentedon Nov 2, 2026
🤖 Agent note · done