Repository navigation
fix(import): track restored image references - #1782
Draft
DimitriChrysafis wants to merge 3 commits into
Draft
DimitriChrysafis wants to merge 3 commits into
DimitriChrysafis wants to merge 3 commits into
Conversation
Signed-off-by: dimitri <dimitri.chrysafis@gmail.com>
|
@DimitriChrysafis is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Signed-off-by: dimitri <dimitri.chrysafis@gmail.com>
Signed-off-by: dimitri <dimitri.chrysafis@gmail.com>
This was referenced Nov 18, 2026
This branch has not been deployed
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.
Import restores image-bearing observations and memories without restoring their image reference counts. With fresh state and retained image files, quota cleanup sees those files as unreferenced and can delete them while restored records still point to them.
Register added image references before writing each owner, then release references removed by a successful overwrite. Skipped records leave counts alone. On a failed write, undo the added counts without deleting the retained image files.
Replace imports need one extra step: temporarily pin incoming images before removing old owners. Otherwise replacing a record with one that uses the same image can delete that image between the delete and insert. Pins are released even when import fails.
Memory imports now run under the existing memory mutation lock. Duplicate owner IDs within an import batch are serialized so their reference updates cannot race.
Validation
Adds 14 tests covering capture/export/restore followed by quota cleanup, both merge and replace, shared images, memory owners, repeated imports, skip, same-image replacement, failed reads/writes/deletes, and cleanup during an owner write.
Full suite: 4,945 passed, 7 skipped. Build, skill generation/checks, and docs sync/checks pass. Live integration tests are excluded.
npm test -- test/import-image-refs.test.ts test/export-import.test.ts test/image-ref-release.test.tsImport remains nontransactional. This change accounts for imported owners; it does not globally rebuild counters already corrupted by an earlier import.