fix(sqlite): eliminate unchanged reference-fact rewrites - #773
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #767.
No schema migration, new index, public API change, checkpoint tuning, store deletion, or live-daemon restart.
Measured result
1,000 facts + 10,000 unrelated nodes; Apple M1 Pro, Go 1.27.0, modernc SQLite v1.58.0; baseline
0f462eff. Medians of three 20-iteration runs.The changed-target case includes the underlying node update in WAL/time, but counts only fact refreshes in the row metric. This is a 92.3% WAL reduction for that case, not a whole-daemon/SSD-write claim.
Validation
Passed locally on the final production code:
The lifecycle leaves the primary dirty after creating, editing, querying, and removing an automatic linked worktree, then warm-restarts only the isolated child. The long run began before the two final harness safeguards; an explicit 45-minute deadline and independent before/after primary-scope checks supplied those protections. The finalized harness was separately smoke-tested against the same daemon binary.
The daemon harness is opt-in; ordinary CI runs its helper tests without launching a daemon. Reproduction commands and binary fingerprint are in the specification.
Scope and remaining uncertainty
This fixes a proven, profiled incremental write-amplification mechanism. It does not establish that it explains every observation in #767: both baseline and fixed tiny-fixture runs had low, nonzero background I/O and did not reproduce the production-scale incident.
The measured SQL frontier is 1,000 facts. Larger-frontier/transient-sort I/O and incident-scale post-deployment profiling remain follow-ups. Zero fact-row/WAL writes is not a guarantee of zero temporary-file or other daemon writes. Existing enlarged stores are not automatically compacted.
Commits
627432c5: storage fix, correctness regressions, and benchmark.c1e0d8eb: isolated validation harness and specification.