Skip to content

Phase 5: persisted incremental tag index #183

Open

Description

@dezren39

The tag fold and index are rebuilt on every call by scanning all events with a signature check (src/tag_claims.rs, src/tag_index.rs). Needed before P5.5 search. Persist the fold and update it incrementally as events are kept.

Activity

  1. dezren39 commented on Oct 24, 2026

    @dezren39
    MemberAuthor

    id train triage (2026-10-24): too-big-needs-design — persisted incremental tag index; the fold/index is rebuilt each call by full scan + signature check (src/tag_claims.rs, src/tag_index.rs).

  2. added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Oct 27, 2026
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane D
    • Session / ID: queue task 2024
    • Found via: queue claim
    • Task: Triage issue Phase 5: persisted incremental tag index #183 — verify persisted incremental tag index claim against current main, then route as scoped follow-up or close with evidence
    • Expectation: s — triage verdict backed by code citation at HEAD
    • Links: n/a yet
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane D
    • Session / ID: queue task 2024
    • Found via: queue claim
    • Task: Triage verdict for Phase 5: persisted incremental tag index #183 — CONFIRMED at current main
    • Expectation: done — verdict below, follow-up routed

    Verdict: CONFIRMED — the fold and index are rebuilt on every call at HEAD a3cdf6c9a35df1ff8b88b7a02d62e5c04ca4c94a, and nothing is persisted.

    Evidence (fresh gh api reads of current main, not the issue text):

    • pkgs/id/src/event_store/claims.rs — tag_claims() iterates the whole EVENTS table, decodes every stored event, builds the parents map for every event, and folds compacted_claims; tag_index() is exactly TagIndex::new(&self.tag_claims()?) — a full rebuild per call.
    • pkgs/id/src/search.rs module header states it outright: "The index is rebuilt on each call, as [EventStore::tag_index] rebuilds it (Phase 5: persisted incremental tag index #183). Nothing is persisted here." — so P5.5 search, the consumer this issue said it was needed before, has already landed on top of the rebuild behaviour; the cost now grows with every event the store keeps.
    • pkgs/id/src/tag_index.rs module header: "The index is local and rebuilt from the store's live claims." TagIndex is two in-memory BTreeMaps built by TagIndex::new(claims).

    No competing work: no open PR implements a persisted tag index (open PR #1806 is the unrelated author-index search).

    Routing: the 2026-10-24 triage comment on this issue called this "too-big-needs-design", so the follow-up packet pins the design instead of leaving it open: persisted fold state in the store's existing redb database (parents / live claims / α+Ω index tables + a meta row with schema version and an EVENTS-position watermark), an incremental fold_new_events() path that folds only rows past the watermark while preserving the causal-past clear semantics exactly, and the existing full scan kept as the rebuild/reference fallback on version mismatch or corruption. Enqueued as queue task 2974 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:183, packet queue-packets/packet-183-fix.json). This issue stays open and is labelled queue/queued for that task.

  5. added
    queue/queuedHas a queued task in the Supabase agent queue
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  6. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), Lane C
    • Session / ID: queue task 2974
    • Found via: queue claim
    • Task: Implement persisted incremental tag index for Phase 5: persisted incremental tag index #183 per pinned design in task 2974 (redb persisted fold state + position watermark, rebuild fallback)
    • Expectation: effort l; done = PR opened with incremental fold, equivalence/persistence/fallback tests, CI green or parked for CI
    • Links: task 2974; branch to follow
  7. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · blocked

    • Agent: queue worker (repo-worker-code), Lane C
    • Session / ID: queue task 2974
    • Found via: queue claim
    • Task: Blocked as packet_defect — the packet's pinned design cannot satisfy its own acceptance criteria at current HEAD (ce5c72b2, laptop primary, fetched 2026-10-29). Not a verdict on the issue: Phase 5: persisted incremental tag index #183 itself stays CONFIRMED and open.
    • Expectation: a corrected packet (per-author change tracking or ingest-time fold maintenance) can be claimed and implemented as written.

    Defect: the single scalar EVENTS-position watermark is unsound.

    1. There is no global EVENTS position. pkgs/id/src/event_store/mod.rs:1102-1106 — position_key(author, seq) is author[32] || seq_be64, and the module header states the same. EVENTS rows sort by author, then seq. A watermark = "highest EVENTS position folded" therefore orders authors, not time: fold author 0xFF…'s events, set the watermark there, then author 0x00… ingests a tag.set — its position is below the watermark, a scan of "rows with position > watermark" never sees it, and tag_claims() permanently diverges from the full fold. That breaks the packet's own acceptance criterion 2 (incremental result == full-rebuild result after any interleaved sequence).
    2. The fold's inputs change without any new EVENTS row past any watermark. pkgs/id/src/event_store/ingest.rs refresh() re-resolves the whole store and rewrites the APPLIED table wholesale on ingest — a fork or a satisfied dependency flips applied status for events already stored (a previously-unapplied tag.clear becoming applied changes live claims with zero new tag rows). PROOF_HEADERS rows likewise extend the parents map for clears already folded, and EventStore::prune_behind_cut (mod.rs:540) deletes EVENTS rows, which no > scan detects.
    3. Minor: the packet says persist "alpha+omega index entries", but TagIndex at HEAD has a third map, by_author (id phase-5: search by author/kind and multi-term AND are designed but not built or tracked #800, see pkgs/id/src/tag_index.rs header). Persisting live claims and building the index in memory covers it — worth stating explicitly in the corrected packet.

    What a corrected packet needs to pin: per-author (author → highest folded seq) watermarks plus a way to catch applied-status flips, proof-header additions, and prunes — or drop the read-time scan entirely and maintain the persisted fold inside the ingest/refresh() write transaction, where every mutation already passes. The worker instruction (§2/§7) forbids improvising a different design under a pinned packet, so this is blocked as packet_defect for re-packeting rather than silently redesigned in-flight.

  8. added
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    mode/onlineFully doable remotely: design, config, code, cloud
    queue/queuedHas a queued task in the Supabase agent queue
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 29, 2026
  9. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 2974 (small_fix, blocked, priority 30) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

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)mode/onlineFully doable remotely: design, config, code, cloudqueue/blockedQueue or user escalation statequeue/queuedHas a queued task in the Supabase agent queuesource/creatorFiled by the new-issue-creator jobstatus/blockedQueue or user escalation statetask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions