Repository navigation
fix: roll back incomplete archive schema creation - #335
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe PR wraps fresh SQLite schema creation in one transaction so failed initialization rolls back newly created objects. Example: An unversioned archive contains a table named idx_sync_state_updated with a sentinel value of 'retained'.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a concrete initialization defect still present on main, and source review found no introduced correctness bug. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDatabase-backed CLI commands open the archive through Crawlkit; Slacrawl selects fresh creation, migration, or repair and returns a usable SQLite store or an error. flowchart TD
A[Database backed CLI command] --> B[Crawlkit SQLite connection]
B --> C[Slacrawl schema version check]
C --> D[Fresh schema transaction]
C --> E[Existing archive migration or repair]
D --> F[Journal and search initialization]
E --> F
F --> G[Usable archive store]
Technical reviewBest possible solution: Keep the focused transaction around fresh schema objects while preserving connection pragmas and existing-archive migration and repair behavior. Do we have a high-confidence way to reproduce the issue? The current-main execution path and concrete conflicting-table fixtures establish the failure mechanism; the author reports baseline leftovers, but this read-only review did not execute target code. Is this the best way to solve the issue? The patch fixes the transaction boundary in the existing schema owner, preserves the existing SQL and archive paths, and adds no competing initialization mechanism. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against 35493fb5f717. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 20, 2026, 11:16 AM ET / 16:16 UTC. |
What Problem This Solves
A failed first archive initialization can leave earlier tables, indexes and FTS objects committed. Retrying then sees a partial archive. Creating those objects through separate commits also adds startup work.
User Impact
Fresh schema creation now rolls back its DDL when a schema statement fails, while preserving pre-existing data. After the conflict is repaired, initialization can be retried. Existing-archive repair, migrations and journal initialization keep their current behavior.
Why This Change Was Made
Apply connection pragmas before one transaction for fresh schema objects. Keep the same schema SQL for existing archives. Regression tests cover early failure, failure after FTS creation, preserved data, successful retry and connection settings.
Evidence
Baseline leaves 9 and 28 new schema objects in the two failure cases; the candidate leaves none and passes both retries.
Five alternating local benchmark pairs: fresh-open median 5.068 ms → 3.599 ms (29% lower), with one slower candidate pair. Reopen measurements were noisy and do not establish an improvement.
Fresh baseline ns/op: 5068210, 10243985, 4749745, 4137878, 5672416. Candidate: 3144358, 3599025, 3430797, 6358074, 5410978.
Independent P0–P3 review: scoped-clean.
Full local tests, vet and module checks passed with GOWORK=off and CGO_ENABLED=0 in isolated temporary home/config directories. Hosted Linux race and native macOS validation remain required.
These timings measure synthetic archive startup, not whole-CI duration or billing savings.
Hosted CI run 44767958752 passed on
cea7bcb3f4c034200e6d5a9fae92a0c37bf82a9f, including Linux race, native macOS, lint, dependencies and snapshot builds. Docker, CodeQL and both secret scans also passed.