Repository navigation
fix(downloads): retarget store on profile and server switch - #181
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
DownloadManager.onScopeChanged() existed but was never called, so an in-app profile or server switch kept the previous scope's registry, paths, and offline progress. New downloads and watch progress were written into the outgoing identity's store. Persist the outgoing scope before loading the destination, hold unmatched background completions instead of deleting them as orphans, and hook identity commits in AuthService and ServerRegistry. Co-authored-by: Quick <[email protected]>
This was referenced Sep 23, 2026
Contributor
|
Silo's pull request guidance changed today (#658). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: Before-and-after screenshots of the Downloads screen after switching profile or server, showing the right downloads. The rules are in Show visible changes, and the PR template shows the Evidence section layout. This PR is already a draft, so I've left it that way. Please fill in the Evidence section before marking it ready for review. Generated by Claude Code |
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.
Bug and impact
In-app profile or server switches left
DownloadManagerpointed at the previous(server, profile)scope. The Downloads UI, on-disk paths, and offline progress queue kept writing into the outgoing identity.Trigger: Sign in as Profile A, download something, then pick Profile B from Who's Watching without backgrounding the app. Profile B sees A's downloads; new downloads and offline watch progress persist into A's
store.jsonand media directory.This is data corruption and cross-profile leakage on a shared device.
Root cause
DownloadManager.onScopeChanged()was implemented but never called.ContentViewonly hydrates downloads on authenticated launch / foreground. Profile selection and server switch keepauthState == .authenticated, so that path never re-runs.Fix
URLSessioncompletions instead of deleting staged media as orphans — a transfer started as A can finish while B is active.onScopeChanged()after AuthService commits a profile activate/deactivate and after ServerRegistry finishes a server switch (including pairing).Validation
DownloadScopePolicyTestsfor the reload and unmatched-finish contracts.xcodebuildtest run was not executed from this Linux host (no Xcode).