Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
One finding on the added test in apps/server/src/persistence/NodeSqliteClient.test.ts. The PRAGMA synchronous = FULL change in Layers/Sqlite.ts is already covered by the new Sqlite.test.ts.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Pull request overview
This PR hardens the server’s SQLite durability configuration by explicitly setting PRAGMA synchronous = FULL in the shared persistence setup layer, and adds focused tests to verify the setting is in effect.
Changes:
- Set
PRAGMA synchronous = FULLalongside existing WAL/foreign key PRAGMAs in the SQLite persistence setup layer. - Add a new persistence-layer test to assert the runtime PRAGMA value is
FULLfor the in-memory persistence layer. - Add a
PRAGMA synchronousassertion in the low-levelNodeSqliteClienttest suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/server/src/persistence/Layers/Sqlite.ts | Sets PRAGMA synchronous = FULL in the shared SQLite persistence setup. |
| apps/server/src/persistence/Layers/Sqlite.test.ts | Adds a focused test that the persistence setup results in synchronous = FULL. |
| apps/server/src/persistence/NodeSqliteClient.test.ts | Adds a PRAGMA synchronous assertion for the raw Node sqlite client layer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it.effect("uses full synchronous durability", () => | ||
| Effect.gen(function* () { | ||
| const sql = yield* SqlClient.SqlClient; | ||
|
|
||
| const rows = yield* sql<{ readonly synchronous: number }>`PRAGMA synchronous;`; | ||
|
|
||
| assert.equal(rows[0]?.synchronous, 2); | ||
| }), | ||
| ); |
There was a problem hiding this comment.
Addressed in 4f0a464 — removed the test from NodeSqliteClient.test.ts; that file is untouched now. The pragma is verified only in Layers/Sqlite.test.ts via SqlitePersistenceMemory, which runs the setup layer that sets it.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9119a52e09ef41f76b3a5da133ab1d0279c06459. Configure here.
ApprovabilityVerdict: Approved 4f0a464 Adds a single SQLite PRAGMA configuration for enhanced write durability, following the existing pattern of PRAGMA statements in the setup function. The change is small, self-contained, and includes appropriate test coverage. You can customize Macroscope's approvability policy. Learn more. |
cad7a6c to
4f0a464
Compare
|
All three review findings (same root concern: the durability test sat in the wrong layer) are addressed in 4f0a464:
PR is now 2 files, +20/-0. Re-verified: |
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. Closing this global durability change for now. The test proves that the pragma was set, but not that it fixes the reported failure under real disk writes or interruption. A replacement should reproduce the failure with a disk-backed database and show the streaming-write cost of the chosen setting. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. If GitHub does not let you reopen it, leave a comment here and we'll take another look. |

Refs #961
What Changed
Set
PRAGMA synchronous = FULLfor the production and in-memory SQLite persistence layers, and add focused coverage that the SQLite client is running with FULL durability.Why
T3's persisted state is a WAL SQLite database receiving a high volume of small streaming writes. When an I/O or transaction-state failure occurs during that stream, the transaction cleanup path can surface a later
cannot rollback - no transaction is activeerror instead of the original SQLite error and leave the shared connection unusable until restart. In one local repro, the database passedPRAGMA integrity_checkbut every subsequent orchestration command failed atOrchestrationCommandReceiptRepository.getByCommandIdwithdisk I/O error.SQLite's WAL default is
synchronous = NORMAL, which does not sync on every commit. SettingFULLmakes committed transactions durable before SQLite reports success, reducing the window where WAL checkpoint/checkpoint-restart behavior can leave the main database inconsistent under heavy write streams. This keeps the existing WAL mode and schema unchanged.Related upstream context:
Validation
corepack pnpm exec vp test run apps/server/src/persistence/NodeSqliteClient.test.tscorepack pnpm exec vp test run apps/server/src/persistence/Layers/Sqlite.test.tscorepack pnpm exec vp lint apps/server/src/persistence/Layers/Sqlite.ts apps/server/src/persistence/Layers/Sqlite.test.ts apps/server/src/persistence/NodeSqliteClient.test.tscorepack pnpm --filter t3 exec tsgo --noEmitChecklist
Kimi K3 via Cursor
Note
Medium Risk
Changes core persistence durability and write behavior (more disk sync per commit); scope is small and localized to SQLite setup with test coverage.
Overview
Hardens SQLite persistence by setting
PRAGMA synchronous = FULLduring layer setup inSqlite.ts, immediately after WAL journal mode and before foreign keys. WAL mode stays the same; commits are flushed more aggressively than the WAL default (NORMAL), targeting fewer I/O / transaction failures under heavy small writes.Adds
Sqlite.test.tswith a layer test that readsPRAGMA synchronousand asserts the value is 2 (FULL) onSqlitePersistenceMemory.Reviewed by Cursor Bugbot for commit 4f0a464. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Set
PRAGMA synchronous = FULLon SQLite connections to harden durabilityAdds
PRAGMA synchronous = FULLto the SQLite setup in Sqlite.ts, applied between the existing WAL journal mode and foreign keys pragmas during layer initialization. A new test in Sqlite.test.ts asserts the pragma value is set to 2. Risk:FULLsync mode flushes to disk on every write, which reduces throughput compared to the previous default.Macroscope summarized 4f0a464.