Repository navigation
feat(store): atomically restore selected project annotations - #1688
Merged
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.
Project annotation restore needs the target preview rechecked under the actual write lock. Add an optional provider-neutral store.projectAnnotations port over the existing connection: preview and atomic selected-facet restore requiring an exact preview fingerprint.
Restore rechecks real target content/namespace/preconditions within BEGIN IMMEDIATE, maps external and owned references, preserves alias/project metadata, fact lifecycle/authorship and generic-link provenance, and rolls back all insertions on failure. It opens or migrates no additional store. Native read-only handles still refuse writes. Hosts must enforce owner authorization; this SDK adds no CLI/MCP mutation host or live reset, and omitted facets remain outside the selected format.
Thin hosts also reuse the exported structural snapshot schema and readBoundedUtf8File (ordinary-file size preflight, bounded reads, fatal UTF-8 decoding), keeping the shared batch-input limit unchanged. Graph/total-byte validation remains in the snapshot decoder.
Validation: 58 focused synthetic cases, typecheck and build/docs checks pass. Nine restore cases cover different IDs and logical snapshot equality, unchanged shared/unrelated records, exact retry refusal, injected mid-insertion rollback, stale target/source/namespace, unknown fields, decision replacement/reversal, later owned-fact references and native read-only refusal; two file cases cover exact budgets, oversize, invalid UTF-8 and invalid budgets. Full coverage/parity/Bun/old-Node/restart checks run in CI. Captured0.373 source/changelog stays unchanged.