Repository navigation
fix(logbook): index frame and batch queries - #129570
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision: accepted. I accept the same-version four-index rollout and its measured build/storage tradeoff. The representative 400k-row fixture added about 19.25 MB and took about 366 ms aggregate to build the indexes. Measured query improvements were about 14.3x for batch lookup, 3.7x for observation replacement, 1098x for keyframe lookup, and over 2000x for latest-frame lookup. Focused Logbook extension tests, query-planner assertions, and reopen/persistence coverage pass. This is the intended performance/storage tradeoff for this PR. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:03 PM ET / 21:03 UTC. ClawSweeper reviewWhat this changesThis PR adds four SQLite indexes to Logbook and planner/reopen tests to avoid table scans during capture, batch analysis, observation replacement, and frame cleanup. Merge readinessKeep open for maintainer review: the focused Logbook index change appears technically sound, but it changes persistent-store disk and open-time behavior without a linked accepted design record required by repository policy. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherLogbook stores captured frames, derived observations, and timeline cards in a plugin-owned SQLite database. Capture, analysis, and pruning read or update those records, with frame deletion also maintaining card keyframes. flowchart LR
A[Screen capture] --> B[Logbook SQLite store]
C[Batch analysis] --> B
B --> D[Indexes select query paths]
D --> E[Observations and cards]
E --> F[Timeline output]
Decision needed
Why: This changes a plugin-owned persistent representation and has stated disk and open-time costs, so repository policy requires maintainer acceptance before merge. Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +109. Total +113 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Record acceptance of the Logbook index lifecycle, disk footprint, startup cost, and same-version reopen behavior, then merge this owner-local schema and test change. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main has the relevant Logbook queries and foreign-key cleanup path without these supporting indexes; the PR adds direct planner coverage for them. Is this the best way to solve the issue? Yes technically: indexes belong in the canonical Logbook store schema that owns these queries; merge remains contingent on maintainer acceptance of the persistent-store trade-off. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e8b6a04ef5fb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Audit: https://gist.github.com/vincentkoc/10826f918dde7e23020cf2f390af95d3
What Problem This Solves
Fixes an issue where Logbook capture, batch analysis, observation replacement,
and frame cleanup scan or sort growing SQLite tables on normal paths.
Why This Change Was Made
Adds four indexes for global capture timestamps, completed-batch frame reads,
batch-owned observations, and card keyframe foreign-key maintenance. Logbook
continues to use schema version 1; its canonical schema runs idempotently on
open, so existing databases receive the indexes without a migration bump.
This is a bounded query-plan improvement under the SQLite review checkpoint.
The timestamp index is justified by the hot
lastFrame()path, not by anunmeasured retention claim.
User Impact
Periodic capture and batch processing avoid table-wide scans as Logbook history
grows. Frame cleanup no longer scans every card to maintain keyframe references.
Evidence
pnpm test:extension logbook: 66 passed.temporary ordering where relevant.
restoration without changing the version.
AI-assisted: yes. The implementation, benchmarks, and review findings were
independently verified before push.