fix: preserve attachment files across startup and concurrent saves - #10
Open
KyleAMathews wants to merge 2 commits into
Open
Conversation
…wnership Hold a targeted live-query demand through transaction confirmation for eager and on-demand collections. Reject same-ID overlapping saves across queues sharing a database and preserve SDK filename-based relocation. Add intent oracles and separate native/integration repros for the unresolved upstream upload-completion race.
2 tasks
Author
|
All four GitHub workflow runs currently report action_required without any jobs having run. Please review/approve the fork workflow runs when ready. Local verification on the published changes passes (121 tests, TypeScript, changed-file lint, build); the separate upstream SDK repro command still fails all five intended contract checks. |
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
Fix attachment saves/deletes before their collection has loaded, and protect files from overlapping same-ID saves. Add a real SQLite/file/SDK intent oracle.
This is a companion to TanStack/db#1616, targeting
feat/powersync-attachments, not main. It includes the startup fix's intent from Tanner's 3572ec74, adapted to support on-demand collections too.Approach
The in-process reservation is not a cross-handle/tab/process lock. No SDK state machine or completion workaround is added.
Still blocked upstream
SDK upload completion can overwrite a newer QUEUED_DELETE on both success and failure/retry. A detached owner can leave remote bytes behind or cause an obsolete upload to retry. This companion does not make that overlap safe or clear the original PR's SDK merge blocker.
The same independent intent model retains those desired-contract assertions in an opt-in repro suite. Native SDK controls use no TanStack collection or subclass. Normal CI excludes this named upstream overlap; it does not hide it behind expected-failure assertions.
Verification
From
packages/powersync-db-collection:1616, path3:0:0:1shrinks to save → start-upload → delete → fail-upload → drain.See
packages/powersync-db-collection/tests/ATTACHMENT-ORACLE.mdfor scope and replay instructions.