Repository navigation
Closed
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)Package/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/performancePerformance problem or optimizationPerformance problem or optimizationmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientNice to have; do when convenientqueue/claimedQueue worker lifecycle stateQueue worker lifecycle statesource/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobstatus/in-progressQueue worker lifecycle stateQueue worker lifecycle statetask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue worker lifecycle state
Description
Finding
Codex review on PR #4099 (round 2, 2026-11-02) flagged a quadratic lookup in the membership layer replay added for issue #165:
pkgs/id/crates/id-core/src/membership/layer.rs: when a concurrent create displaces the standing create, the layer re-decides held events in canonical order and finds each event's latest outcome by scanning the accumulatedlatestvector — O(N²/2) event-ID comparisons over a history of N events.- This is on a production path:
event_store::resolvefeeds the entire history into the layer, and bothEventStore::rosterandingest::refreshinvoke that resolver, so the cost repeats on subsequent resolutions once conflicting creates are retained.
Fix
Index replay outcomes instead of scanning: keep a hash-indexed outcome-position map (event ID -> position in latest), or append outcomes directly when they cannot repeat. Preserve the exact canonical-order semantics and the latest-outcome-per-event truth rule from PR #4099.
Acceptance
- Replay outcome lookup is O(1) amortized per event (map-based), with the existing PR fix(id): canonical winner for concurrent group creates (#165) #4099 convergence tests (both arrival orders, derived friendship group ID) still passing.
- A test or benchmark note demonstrating the replay no longer scans
latestper event.
Filed by queue worker lane A (task 2950) as the tracked follow-up for the Codex P2 disposition on PR #4099.
Acceptance criteria
- The membership layer replay in
pkgs/id/crates/id-core/src/membership/layer.rsno longer finds each event's latest outcome by scanning the accumulatedlatestvector: outcomes are hash-indexed (event ID -> position) or appended under a proven no-repeat invariant. - Replay verdicts are byte-identical to the scanning implementation for the same event histories (existing membership/layer tests pass unchanged; a conflicting-create history is covered).
- The fix lands on or after PR fix(id): canonical winner for concurrent group creates (#165) #4099's layer code (it is a follow-up to that PR's replay), not as a conflicting rewrite of it.
Metadata
Metadata
Assignees
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)Package/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/performancePerformance problem or optimizationPerformance problem or optimizationmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientNice to have; do when convenientqueue/claimedQueue worker lifecycle stateQueue worker lifecycle statesource/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobstatus/in-progressQueue worker lifecycle stateQueue worker lifecycle statetask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue worker lifecycle state
Activity
dezren39 commentedon Nov 2, 2026
Intake review
🤖 Fleet monitor (repo-fleet-monitor) intake pass, 2026-11-02.
event_store::resolvefeeds the whole history; roster + ingest refresh both re-invoke it), but impact scales with retained conflicting creates, hence priority/low with a clear fix shape.latest, keep the scan in a debug assertion during development if cheap, run the membership test suite in CI.2 remaining items
dezren39 commentedon Nov 3, 2026
🤖 Agent note · parked (CI pending)
queue/8350-4128-membership-replay-index@784595a7c, MERGEABLE, no held/Drew-owned labelcargo test -p id-core --lib membership→ 48 passed (includes both PR fix(id): canonical winner for concurrent group creates (#165) #4099 arrival orders and the derived friendship group ID); newtest_a_long_conflicted_history_replays_in_canonical_orderpins verdicts over a 230-event history.basic: production line limit (2500)queued). Parked 20 min rather than holding the claim; the next lane pass merges when checks are green.developing-today commentedon Nov 3, 2026
agent-note:v1
state: triaged (coverage pass)
Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 30 (priority/low). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
Found via: coverage pass 2026-11-03
dezren39 commentedon Nov 4, 2026
🤖 Agent note · handed off
opencode— handed off to the laptop claimant. Prior park context: CI was pending on PR perf(id): index the canonical replay's outcomes instead of scanning (#4128) #5002 (still OPEN at this handoff) — the claimant session should read PR/check state fresh and drive task 8350 to a terminal state.dezren39 commentedon Nov 4, 2026
agent-note:v1
state: handed off
task: 8350
session_id: ses_e5e5af679c2ffe6w7Bu6GViTZn
lane: opencode
launched_by: opencode-claimant
Merge pull request #5002 from developing-today/queue/8350-4128-member…
dezren39 commentedon Nov 4, 2026
agent-note:v1
state: handed off
task: 8350
session_id: ses_e5e5af679c2ffe6w7Bu6GViTZn
lane: opencode
launched_by: opencode-claimant