Skip to content

id: DEVICE_OPS hardening follow-ups from PR #8144 review (sync delivery, ingest atomicity, expiry cleanup, upgrade recovery) #8160

Closed

Description

@dezren39

id: DEVICE_OPS hardening follow-ups from PR #8144 review (sync delivery, ingest atomicity, expiry cleanup, upgrade recovery)

Source: CodeRabbit review of PR #8144 (task 14249, issue #5656). The PR's packet acceptance is met and verified by targeted tests; the four findings below are adjacent hardening the review surfaced. Each was dispositioned as follow-up work at merge time rather than expanding PR #8144.

  1. Range sync does not deliver device-operation bodies (PR fix(id/event-store): honor settled device authority in tag clears (#5656) #8144 thread 4522516137, ingest.rs ~291-308). A fresh peer receiving an Admin-device grant through range sync stores only the header and never populates DEVICE_OPS, so its default view can retain a claim a directly-ingesting peer hides. Sync must deliver the committed device-operation body and run it through the receiving peer's ingest flow.
  2. DEVICE_OPS rows leak when held events expire (thread 4522516148, ingest.rs ~309). A stream of signed device events with missing dependencies can repeatedly fill and expire the waiting pool; each expiry leaves a DEVICE_OPS row, growing disk use beyond the waiting-pool limit. Delete the row when a held event expires or is dropped; keep rows for stored events and for held events that are released.
  3. Device operation is not written in the ingest transaction (thread 4522516157, ingest.rs ~313-338). If the process stops or the second write fails after ingest_event commits, the device operation is lost: a missing grant blocks an authorized clear, a missing revocation can let a revoked device hide another author's claim. Write the device operation in the ingest transaction before resolution, including duplicate and waiting paths.
  4. Upgraded stores have no DEVICE_OPS rows for pre-change grants (thread 4522516168, mod.rs ~668-675). Admin-device clears can leave claims visible until the original bodies are supplied again. Provide a recovery path from verified grant/revocation bodies, or explicitly report when recovery is not possible.

Acceptance: each item either lands with tests covering the named scenario, or is closed with evidence the scenario cannot occur.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 10, 2026
  2. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  3. added this to the ID platform program milestone on Nov 12, 2026
  4. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    state: triaged
    lane: any-b, worker: repo-worker-code, task 18592

    Triage verdict for #8160 (checked fresh this shift, 2026-11-17): real, still-open work — routed as a scoped follow-on fix packet.

    • Work kind: task/small_fix (bounded 4-item hardening bundle, each item testable). Priority: priority/normal (kind/bug in the id event store; no expedite signal). Effort: effort/m (four items, each needs a scenario test).
    • Fresh evidence: PR fix(id/event-store): honor settled device authority in tag clears (#5656) #8144 is MERGED (2026-11-10T14:24Z); the follow-ups were dispositioned at its merge and none has landed since. On origin/main c4404b8, pkgs/id/crates/id-events/src/event_store/ingest.rs still shows the item-3 pattern — record_device_op (~line 239) opens its own write transaction after ingest commits (call sites ~lines 218-223) — and there is no device_ops.remove anywhere in ingest.rs, so the item-2 expiry cleanup is absent. No post-fix(id/event-store): honor settled device authority in tag clears (#5656) #8144 event-store commit mentions DEVICE_OPS hardening for this issue.
    • First concrete step for the fix: item 3 (write the device op inside the ingest transaction, including duplicate and waiting paths) — it underpins items 1 and 2; then item 2 (delete the row on held-event expiry/drop), item 1 (range sync delivers bodies through the receiver's ingest flow), item 4 (recovery path from verified bodies, or an explicit not-possible report).
    • Acceptance check: per the issue — each item lands with tests covering its named scenario, or is closed with evidence the scenario cannot occur; targeted id-events tests pass.
    • Follow-on packet enqueued: dedupe_key repo-health:v1:fix:developing-today/code:issue:8160 (kind small_fix, priority 30, status queued at 2026-11-17T03:46Z; dedupe checked this shift against the live queue).
  5. added
    task/small_fixQueue packet kind: implement a small scoped change
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 17, 2026
  6. 20 remaining items

  7. added
    queue/claimedQueue worker lifecycle state
    and removed
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 17, 2026
  8. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: parked
    task: 20078 (queue repo-health-code-pilot, worker repo-worker-code, lane any-c)

    Parked awaiting test verification; all implementation work is durable. Lane any-c took this task direct under runbook 1b: the lane record showed the opencode assignment with session_id null (binding cleared 2026-11-17T10:25Z via expire_leases), so the assignment was flipped direct with the exclusion reason recorded.

    State at park:

    Resume: read /tmp/lane-id-events-test.out. If the id-events lib tests are green, merge PR #11283 and complete task 20078 as fixed_merged with the PR as evidence. If the log is still empty, rerun cargo test -p id-events --lib in worktree ~/git/fleet/queue-20078-8160-device-ops through the build lock. If tests fail, the failing names point at the item to fix in the same worktree.

  9. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 17, 2026
  10. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    task: 20078 (queue repo-health-code-pilot, worker repo-worker-code, lane code-f, origin openchamber-scheduled-lane)

    All four items are landed on main via PR #11265 (merged 4fdbd89, 2026-11-17T12:11Z) plus its follow-up commits (d57a650 ingest hardening, 6a8ea29 recovery/sync gaps, 3a9d1a6 warning scope, b5691b9 held-drop ownership). Verified fresh today against origin/main bcb79c8:

    1. Range sync delivers device-op bodies — the receiver's batch ingest decodes each delivered body's device op and records it in the batch transaction; loopback test test_range_sync_ingests_device_operation_body_on_receiver.
    2. Expiry cleanup — every drop of a held-but-not-stored event goes through waiting_rows::drop_held, which removes the DEVICE_OPS row in the same transaction (expiry, reload rebuild, pool-full, stale-row paths); test_expiring_a_held_event_removes_its_device_operation_row.
    3. Ingest atomicity — store_device_op writes inside the ingest transaction for stored, duplicate (late body), waiting and parked paths; the old own-transaction record_device_op is deleted; test_a_device_operation_body_on_a_duplicate_attaches_in_the_same_transaction, test_a_held_device_operation_is_written_with_its_event_and_kept_when_released.
    4. Upgrade recovery — EventStore::open runs recover_device_ops from retained verified bodies (stored + held), one-shot meta flag, warning when recovery is incomplete; test_open_recovers_device_operation_from_a_retained_verified_body, test_open_recovers_device_operation_for_a_held_event.

    Verification on a fresh laptop worktree of origin/main: cargo test -p id-events --lib — 327 passed, 0 failed, 2 ignored.

    Also closed duplicate PR #11283 (lane code-d's parallel implementation) after diffing it against this merged canonical work; salvage note with the item-by-item comparison is on #11265. Closing #8160 as completed.

  11. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 17, 2026
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)effort/mMedium: expected under 1 day of workepic/id-programReprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)status:donetask/small_fixQueue packet kind: implement a small scoped change

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions