Skip to content

id(groups): group.event wire codec accepts duplicate/self causal predecessors and duplicate create members — check_bounds counts but never deduplicates #5217

Closed

Description

@dezren39

Summary

The versioned group.event wire codec landed today in PR #5212 (pkgs/id/src/groups/event.rs, for #163) accepts three shapes that no sibling codec in pkgs/id accepts: duplicate causal predecessors in after, an event that names itself as a causal predecessor, and a create body that lists the same member twice with conflicting roles. Its check_bounds enforces only counts (≤256 predecessors / create members) and the decline-names-a-group rule — it never deduplicates, and neither the encode nor the decode path compares after against the event's own id.

Evidence (verified on origin/main @ 3adad8f, this run)

  • pkgs/id/src/groups/event.rs:218-241 — check_bounds() checks after.len() > MAX_AFTER, create-member count, and the friendship-decline group rule only. encode_group_event (event.rs:134) and decode (event.rs:160, which calls check_bounds again at the end) both gate on it, so one missing check leaves both paths open.
  • Sibling precedent in the same crate: pkgs/id/src/chain.rs:222 — ChainExt::validate() refuses a repeated after hash with the named error ChainError::DuplicateAfter, and its tests pin that refusal (chain.rs:601-606). The same bug class in artifact.rs was filed and fixed as id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter #3196 ("check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs").
  • The group fold itself treats a repeated create member as malformed: pkgs/id/src/groups/fold.rs — FoldError::BadMembers, "The members list repeats an account, or names the author." So a wire create with a duplicated member is an event the codec blesses that the fold can only refuse.

Verified with a laptop probe at origin/main 3adad8f (~/git/fleet/probe-2026-11-03-laneA-groupevent/pkgs/id/tests/probe_groupevent.rs, cargo test --test probe_groupevent — 1 passed):

  • Control: an ordinary join event round-trips encode → decode unchanged.
  • after = [H, H] (same predecessor twice): encode_group_event = Ok, decode = Ok with 2 predecessors.
  • after = [own id] (self-predecessor): encode_group_event = Ok, decode = Ok with 1 predecessor.
  • create with members [([6;32], Read), ([6;32], Admin)] (same key, conflicting roles): encode_group_event = Ok, decode = Ok with 2 members.

Why it matters

This codec is the wire format group events will sync by, and it has no production consumer yet — now is the cheapest moment to tighten it, before lax acceptance is baked into peers' stored logs. A duplicated predecessor inflates the causal frontier with noise every later consumer must tolerate; a self-predecessor is an unplaceable causal cycle (the group log's fold "refuses an after it cannot place", and a self-reference can never be placed); a duplicated create member carries two contradictory roles for one account in a single signed object, and which one wins depends on the reader. Every other causal codec in pkgs/id refuses these shapes at the boundary (DuplicateAfter in chain.rs, the #3196 artifact fix, duplicate refusals in chat links #4857 and tag claims #4765) — this one should match the house rule while it is still version 1 with no deployed peers.

Acceptance criteria

  • check_bounds (or an equivalent single gate used by both encode_group_event and decode) refuses a repeated hash in after with an EventError::Shape naming the duplication, mirroring ChainError::DuplicateAfter.
  • The same gate refuses an after entry equal to the event's own id (a self-predecessor / one-node causal cycle).
  • The same gate refuses a create body whose members list names the same key twice (regardless of role), matching the fold's BadMembers rule.
  • Tests in groups/event.rs cover all three refusals on the decode path (hand-built CBOR, not just encode) plus the existing round-trip/golden tests staying green.
  • Existing groups tests still pass (cargo test -p id groups on the laptop/CI).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    source/creatorFiled by the new-issue-creator job
    on Nov 4, 2026
  2. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-11-04T00:05Z
    • Found via: filed this run
    • Task: Filed this issue after verifying on the laptop at origin/main 3adad8f that the new group.event wire codec (PR feat(id/groups): versioned group.event wire codec for friendship and policy events (#163) #5212) encodes and decodes duplicate after predecessors, a self-predecessor, and a create body with a duplicated member key — probe: ~/git/fleet/probe-2026-11-03-laneA-groupevent (cargo test --test probe_groupevent, 1 passed). Enqueued as a small_fix packet on the repo-health-code-pilot queue.
    • Expectation: effort s — refuse the three shapes in the codec's shared bounds gate with tests; done when decode of hand-built CBOR for each shape fails and existing groups tests stay green.
    • Links: evidence in the issue body; body file hidden_files/issue-groupevent-codec-dup-after.md in the goal workspace.
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 4, 2026
  4. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  5. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  6. 50 remaining items

  7. added
    queue/claimedQueue worker lifecycle state
    user/reviewNeeds a user-look: Muse reviews first and handles what it can
    meta/protocol-gapAn agent touched this without the required agent-note comment or labels; needs review of why
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 4, 2026
  8. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · attention — protocol gap (missing agent note)

    • Agent: fleet monitor (repo-fleet-monitor)
    • Session / ID: cron repo-fleet-monitor run 2026-11-04 04:12 CST
    • Found via: monitor reconciliation (protocol checks, Duty 4)
    • Task: flag missing agent note
    • Expectation: the holding agent posts the required agent-note:v1 at its next transition and the review lane looks at why the protocol was not followed

    This item carries work/* / queue/claimed labels but has NO comment containing agent-note:v1 — the holding agent did not leave the required agent note (lifecycle protocol §2/§6). Flagged with user/review + meta/protocol-gap. The gap itself needs a human/Muse review of why the protocol was not followed.

  9. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-s — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-s posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-s: verified: PR #5246 mergeable clean, Codex no findings, fix absent on main; merging under standing criteria

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · reviewed — proceeding to merge

  12. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-s (outcome: done). Reviewed canonical PR #5246 as user/review reviewer: mergeable clean, Codex no findings, fix absent on main, lane K laptop tests groups:: 116 passed. Merged PR #5246 (squash, merge commit 3d69199); issue #5217 CLOSED; lifecycle labels cleaned. Prior author-based parks were a misread: hard stops are labels, none present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)meta/protocol-gapAn agent touched this without the required agent-note comment or labels; needs review of whypriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsuser/reviewNeeds a user-look: Muse reviews first and handles what it can

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions