feat(ios): keep owed originals across relaunch, sign-out, and purge - #230
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
A stale queue can still persist pending-original state via dismiss/settle paths without checking isLive(), which can violate the “writes nothing after session end” guarantee and risk overwriting a successor shell’s document.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR makes “delete remote original” requests durable in the iOS offline-downloads queue by persisting owed deletions (pendingOriginals) and ensuring the queue won’t let a stale signed-in shell overwrite state after a session boundary.
Changes:
- Persist owed remote-original deletions in
queue.jsonand retry them on next launch viarestore(). - Add session-liveness gating for original-deletion work using
PutioSessionStore.authenticationGeneration. - Expand
OfflineDownloadsTeststo cover relaunch survival, dismissal/retry behavior, purge behavior, and session-end behavior.
File summaries
| File | Description |
|---|---|
| Tests/iOS/Sources/OfflineDownloadsTests.swift | Adds coverage for pending-original persistence, session-end behavior, and purge/in-flight handling. |
| Packages/PutioCore/Sources/PutioCore/Session/PutioSessionStore.swift | Makes authenticationGeneration publicly readable to support session-bound work. |
| Apps/iOS/Sources/PutioApp.swift | Captures a session generation and wires isLive into the offline queue factory. |
| Apps/iOS/Sources/OfflineRemoval.swift | Makes PutioOfflineRemovalTarget Codable so pending originals can be persisted. |
| Apps/iOS/Sources/OfflineDownloads.swift | Implements pendingOriginals persistence, restore-time retry, and liveness/purge safety for original deletions. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d243fd399c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Originals put.io has not answered for are persisted in the queue document in the same write as the local removal and retried on the next launch. Dismissing the report gives them up; retrying keeps them owed. A purge ends requests in flight, and a queue whose session ended writes nothing. Refs #106
d243fd3 to
30e74d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30e74d3ac1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…, and keep a newer debt over a stale request Every document write is refused once the owning session ended. The debt is written before the package is deleted and an interrupted removal is finished on the next launch. Downloading the file again supersedes its debt. A stale request that completes or fails never replaces the newer confirmation for the same file or its failure report.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1c6ecdc81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Problem
After #229, an original the user asked put.io to take is only remembered in memory. If iOS suspends or kills the app while the request is in flight, or after a failure but before the report is handled, the next launch has no queue item and no retry target: the original stays on put.io with no trace of the request.
Refs #106. Second of three stacked PRs on top of #229.
Solution
pendingOriginals, written in the same document update as the local removal, so no kill can record one without the other.restore()retries them on the next launch and surfaces failures in the report. OK gives them up; Try again keeps them owed. One debt per file: a newer confirmation replaces the older name and mode.purgeAccountStorage()(Clear Data, Destroy Account) drops owed originals and the report and ends requests in flight without writing.PutioSessionStore.authenticationGenerationbecomes public for that.Proof
mise run verify,mise run harness -- test --platform ios, andmise run harness -- journey --platform ios --scenario files-browserpassed locally on this commit.OfflineDownloadsTestscover pending originals surviving a relaunch and being given up on dismissal, retry keeping them owed, a purge ending in-flight requests, a queue whose session ended writing nothing, and a newer confirmation replacing the debt for the same file.