fix: make watcher rewind archival APSW-safe#595
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_20b109d9-39a9-43b3-b758-432dae62250d) |
|
@coderabbitai review |
|
@codex review |
|
You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor |
✅ Action performedReview finished.
|
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe changes add BrainBar coverage for naive local timestamps, make rewind archival use explicit APSW transaction boundaries, add commit and rollback regression tests, and document the implementation and validation plan. ChangesTruth and rewind behavior
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
BEGIN IMMEDIATE/COMMITtransaction with guarded rollbackTruth investigation
created_at >= datetime('now', '-10 minutes')count was not valid for mixed ISO timestamp formats because it compared timestamp strings lexicallywatcher_liveness_eventsfor watcher activity; the installed BrainBar 1.4.2 build ata2fd98d1predates those source truth fixesVerification
pytest: 3,622 passed, 60 skipped, 5 xfailedswift test: 751 passed, 2 skippedgit diff --checkcleanDeploy / integration QA
com.brainlayer.watchafter deploying the Python rewind fixThis PR must remain OPEN. The orchestrator owns integration and merge timing.
Note
Medium Risk
The change mutates
realtime_watcherchunk archival on rewind in production, but the diff is small, transaction-scoped, and backed by new APSW durability and rollback tests; BrainBar changes are test-only.Overview
Watcher rewind archival no longer calls
Connection.commit()on APSW._RewindArchiveBatcher.flushnow runs an explicitBEGIN IMMEDIATE→ UPDATE →COMMIT, withROLLBACKif anything fails after the transaction starts, while keeping telemetry and pending-session batching behavior.Regression coverage adds real-VectorStore/APSW tests: archived rows survive after close, failed flushes roll back with pending sessions left for retry and error telemetry, plus the existing batching mocks still pass.
BrainBar gains a deterministic XCTest (Asia/Jerusalem
TZ, naive localcreated_atstring) asserting agent pipeline window buckets treat that timestamp as local wall clock—locking already-shipped normalization, not changing dashboard SQL in this diff.An implementation plan doc captures truth-investigation notes and verification steps.
Reviewed by Cursor Bugbot for commit c3be151. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix watcher rewind archival to use explicit SQL transactions instead of APSW connection commit
UPDATEin_RewindArchiveBatcher.flushin an explicitBEGIN IMMEDIATE/COMMITtransaction via SQL statements, replacing a direct call tovector_store.conn.commit()which does not exist on APSW connections.ROLLBACKbefore re-raising, ensuring partial updates do not persist.BrainDatabaseWindowedBucketsTeststo verify correct bucket bucketing across timezones.📊 Macroscope summarized c3be151. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.
Summary by CodeRabbit
Bug Fixes
Tests
Documentation