Repository navigation
feat(store): add an opt-in in-store reader change contract - #275
Conversation
Journal every insert, update and delete of the tables the research reader and history captures read, with declared row keys, through in-store triggers that run in the writer's own transaction and from every writer binary. A bounded log, per-table high-water sequences, families, a generation for rewrites the triggers cannot observe, and a documented reader algorithm let a consumer skip unchanged families and rebuild changed ones incrementally. Writable opens re-arm tables whose triggers a rebuild removed. Portable and cloud snapshots strip the contract.
…tention at once Portable prune and cloud snapshots remove contract objects in one transaction. A partial contract is replaced by a new epoch on enable or writable open. Lowering retention prunes the existing log and advances pruned_through in the same transaction.
…hout migrating Treat any surviving change_contract object as present so partial contracts are replaced with a new epoch, keeping a valid stored retention. Contract management opens an existing archive without schema migration or convergence work and refuses a different schema version.
|
🦞👀 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: blocked before merge. What this changesThis PR adds an opt-in SQLite change journal that lets archive readers identify changed tables and rows. Example: An enabled archive receives a hash-conflict update to blobs row 1.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR adds a useful capability absent from main. No concrete introduced bug was found; the failed coverage checks remain unattributed. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGitcrawl stores GitHub archive data in SQLite; database triggers turn committed writer mutations into bounded change records for read-only consumers, while portable and cloud publication remove the local contract. flowchart LR
A[Gitcrawl and SQLite writers] --> B[Archive tables]
B --> C[Transactional change triggers]
C --> D[Bounded journal and cursor]
D --> E[Read-only consumers]
B --> F[Portable and cloud copies]
F --> G[Contract removed before publication]
Technical reviewBest possible solution: Land the opt-in contract with existing archive contents preserved and contract state excluded from published copies. Do we have a high-confidence way to reproduce the issue? This is a feature request implemented by a patch; the supplied CLI trace demonstrates its core behavior on a disposable fixture. Is this the best way to solve the issue? Database triggers are an appropriate owner for changes made by unaware writers, and the implementation keeps management, repair, and stripping within existing storage and publication boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f1c40bc03f86. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 October 28, 2026, 11:18 AM ET / 15:18 UTC. |
Summary
Add an opt-in, in-store reader change contract (
gitcrawl change-contract status|enable|bump|disable). SQLite AFTER triggers on the tables the research reader and history captures read journal every insert, update (including ON CONFLICT DO UPDATE) and delete (including FK cascades) in the writer's own transaction, from every writer binary. Row-mode tables log declared primary keys; table-mode tables advance only a high-water sequence. The log is bounded by a prune trigger; a generation advances when a writable open re-arms tables whose triggers a rebuild removed or on explicit bump. Portable prune and cloud snapshots strip the contract.docs/change-contract.mdspecifies the reader algorithm (cursor = epoch, generation, schema_version, seq).No GitHub provider behavior, schema user_version or existing reader contract changes; the contract is absent until enabled.
Fixes after local review
Contract management opens an existing archive without migration and refuses a different schema version. Portable prune and cloud snapshots strip the contract in one transaction. Any surviving partial contract is replaced with a new epoch, keeping its retention. Lowering retention prunes the existing log immediately.
Validation
go test ./...,go vet ./..., gofmt on tracked files (re-run on the final head), deadcode,make docs,go mod tidycheck.Shipped-CLI trace (disposable fixture archive, built binary)
Follow-up
Test-only commit e3f6234 covers contract refusal and write-failure paths so the CI coverage floor (85%) holds.