fix(android): preserve queued upload scheduling - #439
Conversation
Obiente previewNC Native · Obiente updates this comment as the preview changes. |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 454d73b427
ℹ️ 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".
e2a8728 to
d4e541c
Compare
4482b93 to
c2f0cc7
Compare
c2f0cc7 to
84677b8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84677b8a69
ℹ️ 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".
84677b8 to
abcbb66
Compare
abcbb66 to
7b2e575
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b2e575cd6
ℹ️ 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".
7b2e575 to
a86e5ec
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a86e5ec1fa
ℹ️ 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".
a86e5ec to
3ed84f8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2c2188b6c
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec3af1c3f5
ℹ️ 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".
| var cancelledAfterAcquire = false | ||
| val acquisitionFailure = runCatching { | ||
| synchronized(CAPABILITY_LOCK) { | ||
| val existing = loadCapabilitySnapshot() |
There was a problem hiding this comment.
Isolate malformed capability rows from new selections
When any persisted upload_* record contains malformed JSON, an invalid field type, or an unknown phase after process restart, loadCapabilitySnapshot() throws while loading the entire capability map here; this acquisition is then converted into a generic rejection, so one damaged record prevents every subsequent attachment selection. Startup reconciliation uses the same all-or-nothing snapshot and cannot remove the bad record, making the picker unusable until application data is cleared. Fresh evidence beyond the earlier malformed-capability comment is this final snapshot-wide load on every new selection; isolate the malformed row or provide a durable cleanup path instead of failing the whole picker.
AGENTS.md reference: AGENTS.md:L281-L285
Useful? React with 👍 / 👎.
Outcome
Failure path
The upload job was persisted before WorkManager scheduling, but any exception from awaiting the scheduling operation deleted that journal and released its source. WorkManager can already have accepted or started the work before its completion signal fails, leaving a server-visible upload without a durable outcome record and allowing the same attachment to be submitted again.
Validation
On the dedicated Linux build host, from exact parent
8d1989297bb99efd8e5bb40bc7e1761c98299ad2::androidApp:testDebugUnitTest --tests dev.obiente.nextcloudnative.AndroidDurableMultipartUploadPolicyTest:androidApp:assembleDebugbash tools/check-kotlin-architecture.shbash tools/check-repository.shThe deterministic tests cover scheduler acceptance followed by a lost completion signal, restart-visible queued state, cancellation after persistence, and persistence failure before scheduling.
Evidence boundaries
This validates the transaction policy and Android debug build on Linux. It does not include an emulator lifecycle run, a live Nextcloud attachment upload, or an injected failure inside Android's real WorkManager database.
This PR is intentionally based on #438 because that ready account-isolation change owns the adjacent queued-account credential lookup.
Advances #52