GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice · Issue #2001 · developing-today/code

id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice #2001

New issue
Copy link
New issue
Copy link
Closed
#3357
Closed
id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice#2001
#3357
Copy link
Assignees
dezren39
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:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Summary

WaitingPool::insert in pkgs/id/src/waiting.rs promises that a duplicate is ignored — "An event whose key is already held or has arrived is a duplicate, and it is ignored" (insert docs, waiting.rs:180-184) — but the guard misses the one state an event can be in that is neither held nor arrived: ready. An event whose dependencies have all arrived is pushed onto the ready Vec (waiting.rs:206-211) without recording its key anywhere. Inserting the same key a second time before take_ready() is drained passes both guard checks (arrived.contains(&key) and by_key.contains_key(&key) are both false) and pushes a second copy, so take_ready() returns the same event twice and the caller applies / decides it twice.

Evidence (verified by code reading on main 77918e0, 2026-10-28)

  • insert (waiting.rs:193-212): the duplicate guard checks only self.arrived and self.by_key. The ready path (missing.is_empty()) does self.ready.push(event) and records the key in no index — not by_key, not arrived, no ready-key set exists in the struct (waiting.rs:124-141).
  • Deterministic trace with the pool's own test vocabulary (WaitingPool<u32, &str>):
    1. pool.arrived(10, 0) — dependency 10 is present.
    2. pool.insert(author(1), 1, [10], "first", 0) → ready = ["first"].
    3. pool.insert(author(1), 1, [10], "second", 0) → guard passes again → ready = ["first", "second"].
    4. pool.take_ready() returns both copies of key 1.
      The no-deps form (insert(author, 1, [], …) twice) behaves the same.
  • The existing duplicate test does not cover this state: test_a_duplicate_key_is_ignored (waiting.rs:578-589) pins the held-key duplicate and the arrived-key duplicate only; no test inserts a duplicate while the first copy is sitting in ready.
  • Caller impact today is bounded but real: the event store's drain (src/event_store/ingest.rs:725, 742) extends its work queue with take_ready() after every settle, so a duplicated ready event is decided a second time and only the store's own duplicate detection (Settled::Duplicate) keeps it harmless. The pool's documented contract is what other callers (the module is pub, and its caller-loop protocol in the module docs, waiting.rs:16-24, tells callers to apply what take_ready returns) rely on.

Related but distinct: #1730 (the arrived set grows unboundedly) and #1567 (no total cap on held events) — neither covers the ready-queue duplicate.

Why it matters

The waiting pool is the causal-order gate for event ingest: everything it returns is treated as "apply this, once". A pool that can hand the same event out twice breaks its own stated contract and pushes duplicate defence onto every present and future caller. The fix is small and the module is pure (no I/O, explicit clock), so a regression test is cheap and deterministic.

Acceptance criteria

  • WaitingPool::insert (and park, if it shares the path) ignores a second insert of a key that is already in the ready queue, matching the documented duplicate rule for held and arrived keys.
  • A regression test alongside test_a_duplicate_key_is_ignored covers the ready-state duplicate (deps already arrived, and the no-deps form), asserting take_ready() returns the event exactly once.
  • Existing waiting-pool tests still pass (cargo test --lib waiting or the crate's equivalent targeted run).
  • No change to held / parked / restore semantics or to the per-author cap.

Filed by new-issue-creator-code-a (Lane A), 2026-10-28 run. Verification: code reading + deterministic trace on main 77918e0; no probe crate was compiled (per the laptop-only probe rule, and the trace needs no execution to settle — every step is a direct read of insert's guard and push).

Activity

Next
  1. developing-today commented on Oct 28, 2026

    @developing-today
    developing-todayBot
    on Oct 28, 2026 – with developing.today
    Contributor
    More actions

    CODE-925

  2. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 28, 2026
  3. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-a
    • Session / ID: creator Lane A run 2026-10-28 18:35 CDT (filed this run)
    • State: filed — verified on main 77918e0f by code reading + deterministic trace (no probe compiled; every step is a direct read of insert's guard and push).
    • Finding: WaitingPool::insert (pkgs/id/src/waiting.rs:193-212) guards duplicates against arrived and by_key only; the ready path pushes the event with its key recorded in no index, so a second insert of the same key before take_ready() returns the event twice — contradicting insert's own documented duplicate rule (waiting.rs:180-184). Existing duplicate test (waiting.rs:578-589) pins held/arrived duplicates only. Store impact bounded today by ingest drain's own Settled::Duplicate (ingest.rs:725, 742); the pool contract is the defect.
    • Routing: small_fix packet enqueued to repo-health-code-pilot this run; labels kind/bug, queue/queued, source/creator, task/small-fix, status/needs-triage, priority/normal, app/id, effort/s. Not self-solved: queue small-fix packet is the faster path this run.
    • Links: issue id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice #2001 · related (distinct) id(waiting): WaitingPool's arrived set grows with every event ever applied — +37 MB per 2M arrivals in a pool that reports itself empty, and no production caller ever reads it #1730, id(waiting): the waiting pool has no total cap — the per-author cap is Sybil-defeated, so one peer can make a node hold (and persist) unbounded waiting events #1567
  4. github-actions
    assigned
    dezren39
    on Oct 29, 2026
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    on Nov 1, 2026
  6. 26 remaining items

  7. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1 — queue task 2918 (lane A, shift close-out) — targeted test PASSED

    Update after the park: the laptop run left going at park time has finished — cargo test --features web --lib waiting in ~/git/fleet/2918-2001-waiting-ready: test result: ok. 38 passed; 0 failed (log: laptop /tmp/2918-waiting-test.log, EXIT:0).

    The resuming lane can go straight to the merge step: PR #3357 (head 20a8d5b, Codex clean, no findings) → merge → close #2001 → complete task 2918 as fixed_merged.

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

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up (resume)

    • Agent: repo-worker-code (lane A)
    • Session / ID: queue task 2918
    • Found via: queue claim (small_fix packet, queue repo-health-code-pilot) — resume of parked state
    • Task: Fix id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice #2001 — WaitingPool ready-queue duplicate guard. PR fix(id): WaitingPool duplicate guard covers the ready queue (#2001) #3357 @20a8d5bc2 is this task's own queue PR (branch queue/2918-2001-ready-dup-guard); the earlier Drew-owned flag was author-login inference, already corrected by lane A.
    • Resume verification (fresh, this shift): diff = pkgs/id/src/waiting.rs only (+46/-6, ready_keys index consulted by insert/park, cleared in take_ready); Codex review completed on head 20a8d5b with no findings; laptop /tmp/2918-waiting-test.log read back: cargo test --features web --lib waiting — 38 passed, 0 failed, EXIT:0. Proceeding to merge.
    • Links: fix(id): WaitingPool duplicate guard covers the ready queue (#2001) #3357
  11. dezren39
    added a commit that references this issue on Nov 1, 2026

    Merge pull request #3357 from developing-today/queue/2918-2001-ready-…

    7eb507e
  12. dezren39
    closed this as completedin #3357on Nov 1, 2026
  13. developing-today
    added
    status:done
    on Nov 1, 2026
  14. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code (lane A)
    • Session / ID: queue task 2918
    • Result: fixed_merged — PR fix(id): WaitingPool duplicate guard covers the ready queue (#2001) #3357 merged (merge commit 7eb507e); id(waiting): WaitingPool::insert's duplicate guard misses the ready queue — the same key inserted twice before take_ready is handed out twice #2001 closed by the merge.
    • Verification: fresh diff review (waiting.rs ready_keys guard only); Codex review on head 20a8d5b completed with no findings; laptop targeted tests read back from /tmp/2918-waiting-test.log: 38 passed, 0 failed, EXIT:0.
    • Links: fix(id): WaitingPool duplicate guard covers the ready queue (#2001) #3357
  15. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

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:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.