Skip to content

id(event-store): frozen-rival arrival order can strand dependent events #12050

Open

Description

@dezren39

Problem

The event-store's result for an after dependency can depend on arrival order when that dependency names an event above a later fork point. ingest.rs says applied state depends on the event set, and that stored-but-unapplied events remain present as voids (pkgs/id/crates/id-events/src/event_store/ingest.rs:29-41). But its “Known limit: a rival refused as frozen” section documents that a post-fork arrival is refused (not stored), while the same event arriving before the fork is retained voided (:82-90). Since an after hash is satisfied by a stored voided event (:57-60), the dependency is present in one order and absent in the other.

This can strand an otherwise identical dependent event: one replica can accept it after the event is retained as voided; another can keep it waiting after the post-fork event is refused. This is a source-traced consistency/availability gap, not a claim of a reported production incident.

Existing focused tests pin the two sides separately: test_an_after_hash_naming_a_voided_event_is_applied (ingest.rs:2281-99) and test_an_event_released_into_a_frozen_chain_leaves_no_row (:3765-98). The current batch property compares batch and per-event paths for one arrival order (:86-90), so it does not catch this cross-order difference.

Expected improvement

Define one order-independent rule for the presence/availability of authenticated events above a fork point, then cover it with an order/API matrix. At minimum, compare these same events in both orders: a chain through sequence 2, a conflicting sequence-1 event, and a different author's event whose after names sequence 2. Assert the dependent event has the same final disposition and the same dependency-presence result whether the fork arrives before or after sequence 2; include batch and per-event ingestion where supported.

Verification

On e8da4a4ae111601dbca602fd6bacfd3ea17f8693, cargo test -p id-events test_an_after_hash_naming_a_voided_event_is_applied and cargo test -p id-events test_an_event_released_into_a_frozen_chain_leaves_no_row both pass (1 test each). These tests verify the two existing behaviors; no full end-to-end order-matrix reproduction was added in this creator pass.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 19, 2026
  2. developing-today commented on Nov 19, 2026

    @developing-today
    Contributor
  3. removed their assignment
    on Nov 20, 2026
  4. dezren39 commented on Nov 21, 2026

    @dezren39
    MemberAuthor

    Issue-sweep verification on fresh main 5eeb88064f: the reported order dependence still reproduces. I ran a temporary id-events unit probe (removed afterward) using the same signed event set in two orders:

    • Order A: x0, x1, x2, rival-at-seq-1 (Fork), then y0 whose after names x2 → Accepted (x2 is retained voided, so the dependency is present).
    • Order B: x0, x1, rival-at-seq-1 (Fork), x2 (refused Frozen), then the same y0 → Waiting (x2 was never stored, so the dependency is absent).

    The probe passed with both outcomes asserted (command: ~/tools/fleet-build-lock cargo test --manifest-path pkgs/id/Cargo.toml -p id-events --lib zz_probe_frozen_rival_arrival_order -- --nocapture), confirming the exact order dependence the issue describes.

    Disposition: blocked on the protocol semantics choice, not fixed. The current docs explicitly say a stored voided event satisfies after, while a frozen arrival is refused without storage. Making the rule order-independent requires choosing one of two invariants: (a) an authenticated post-fork event is retained as voided even when it arrives after the fork (changes the Refusal::Frozen contract and has waiting-cap/resource implications), or (b) a voided event no longer satisfies after (changes the existing Phase 1 contract pinned by test_an_after_hash_naming_a_voided_event_is_applied). I did not make a product change without settling that invariant; please choose the intended rule, then the order/API matrix in this issue can drive the implementation. The temporary probe and worktree were removed; no source diff remains.

  5. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Decided: Preserve Phase 1 dependency presence: retain a valid post-fork event as voided evidence, never apply it, so after dependencies can resolve independent of arrival order.
    Why: ingest.rs explicitly says stored voided events remain present for after and for detecting later conflicts (lines 37–60); making voided events unavailable would reverse that existing contract, while retaining a frozen arrival extends the same rule to the missing arrival order.
    Undo: Revert the post-fork retention rule and its order-matrix tests, then restore Refusal::Frozen for such arrivals if a later protocol decision selects the narrower dependency rule.
    By: issue-sweep agent

  6. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Pickup — xaltha lane taking this slice now.

    Implementing the decision record already posted on this issue: preserve Phase 1 dependency presence — retain a valid post-fork event as voided evidence (stored, never applied) so after dependencies resolve independent of arrival order, instead of refusing the post-fork arrival as Refusal::Frozen without storage.

    Plan: narrow change in pkgs/id/crates/id-events/src/event_store/ingest.rs, an order-matrix regression test (same signed event set in both arrival orders, per-event and batch paths where supported) that fails before and passes after, verified on the laptop. PR to follow.

  7. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Progress (xaltha): implemented per the decision record above — option (a), preserve Phase 1 dependency presence.

    PR: #13184 (OPEN, base main, head xaltha/12050-frozen-rival @ 1ea1e5f50, "Closes #12050")

    Change: a proof at an event's own seq still governs it (merge / Frozen / Fork as before); an event above the fork point with no own-seq proof now falls through to the normal conflicts/backlink/deps path and is stored as voided evidence when it links — never applied. Scope boundary: an event at a fork proof's own seq that displaces neither header is still refused Frozen (the position holds one event per (author, seq), so it cannot be retained); the issue's matrix covers above-point events.

    Verification — remote dispatch (fleet-run workflow, GitHub-hosted runners):

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:in-reviewtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions