Repository navigation
fix: preserve learned provider facts across concurrent saves - #1824
Merged
Merged
Conversation
…ks-restart-write-drain
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.
Concurrent learned-provider saves could lose a fact at restart: an older save could copy only fact A, a newer save could persist A and B, then the older snapshot could replace that newer file with A. Atomic replacement kept valid JSON but did not preserve save ordering.
A separate writer mutex now covers the snapshot through atomic replacement within one process. Fact recording and readers keep using the short-lived memo mutex, and requests continue to schedule saves in the background. A regression drives actual concurrent learning and persistence, drains completed writes, and verifies every fact in a fresh store. The manual and performance documentation state the in-process guarantee and retain the separate-process cache limitation.
Controlled diagnostic overlays reproduce old-snapshot fact loss and verify the repair while learning and reads remain responsive. Diagnostic hooks are absent from the patch. Required local gates against merged dev base
401a1e032af93fecdc4bd299c84c6c22d5c9be4dpassed, including a fresh provider suite in 68.143 seconds with every selected test passing on its first run. Focused race-detector checks and independent review passed; the canonical build passed on the publication candidate. This repair is separate from the test-only restart-fixture ownership repair.Maintainer review and merge are required. Any staging attempt must use the final merged release record and its successful exact-SHA Full check. This PR performs no promotion; stable and production are outside scope.
Final candidate:
a4804de6ce0d1d1e674e86c27f54f30c725eae57, including its assigned-number change entry for #1824. Independent final-entry review passed; production source matches the reviewed publication candidate.