Repository navigation
test(state): reuse canonical database template - #118552
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 3:05 AM ET / 07:05 UTC. ClawSweeper reviewWhat this changesThe branch creates one real canonical shared SQLite database before the state test suite and copies it into selected canonical-schema drift and read-only test directories instead of rebuilding the full schema each time. Merge readinessKeep this PR open for explicit maintainer review. The test-only optimization is coherent, preserves the fresh-create and migration cases that need independent databases, and matches an existing closed-template fixture pattern on current main; no correctness or security defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw state-database tests create isolated SQLite files, mutate them into specific schema or integrity conditions, and then exercise the shared-state open, validation, and repair paths. This change affects only the canonical-input setup for selected audit and read-only tests; production state-database behavior remains unchanged. flowchart LR
A[State database test] --> B[Isolated test state directory]
B --> C{Needs canonical current schema?}
C -->|Yes| D[Copy closed canonical SQLite template]
C -->|No: fresh or migration path| E[Create independent database]
D --> F[Schema drift or read-only assertion]
E --> F
F --> G[State database validation or repair result]
Decision needed
Why: The patch has no supported mechanical repair target, but the Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +13. Total +13 across 1 file. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the focused test-fixture optimization after the explicit maintainer review gate, retaining independent database creation for fresh initialization, migrations, journal behavior, concurrency, integrity, and subprocess ownership coverage. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR improves test-fixture cost rather than fixing a user-facing failure. The stated benchmark and passing owner/sibling test evidence provide a concrete validation path for the changed behavior. Is this the best way to solve the issue? Yes. Reusing one real, closed canonical database for tests whose assertions begin after initialization removes duplicated setup while keeping fresh-create, migration, WAL, concurrency, integrity, and subprocess cases independent. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c6bcd935619b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fourteen current-schema drift and read-only tests rebuilt the complete shared SQLite schema even though their assertions begin after canonical initialization.
Why This Change Was Made
Create one canonical state database in beforeAll, close it cleanly, and copy it into each selected test state directory. Fresh initialization, every migration, WAL and hot-journal behavior, concurrent schema creation, integrity checks, and subprocess path ownership continue to use real independently created databases.
User Impact
No user-visible behavior changes. All state-database assertions remain, while repeated fixture-only DDL work and memory use are reduced; production code is unchanged.
Evidence