Repository navigation
fix(libraries): leave hidden libraries out of navigation on phone and TV - #517
Conversation
The apps ignored the profile's ui.disabled_library_ids, so a library hidden in the web app's Settings → Libraries still showed in phone and TV navigation and opened to "Library not found". The library list now leaves those libraries out. The setting is read with the first list load for each profile and refreshed on foreground and reconnect; a change there re-loads the TV tabs, the phone media modes and the phone Libraries list. Closes #515 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Wait out an identity change in progress before reading, so a read can't carry the previous profile's hidden libraries under the new generation. Announce a successful read that follows a failed one, since lists may have gone out unfiltered, and filter the phone's retained list when a re-check fails. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The TV Audio and Libraries routes load their library list once, so a library hidden or shown on another device stayed until the screen was recreated. Re-load it when the hidden-library revision changes, as the phone Libraries screen does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (13)
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. Comment |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| // A switch advances the generation before it installs the new | ||
| // identity; wait it out so this read can't answer for the old one. | ||
| identityTransitions.withCurrentGeneration(generation) { } ?: return@withLock | ||
| val result = settingsRepository.getEffectiveValues(listOf(KEY)) |
There was a problem hiding this comment.
Identity-binding failure affects settingsRepository.getEffectiveValues(listOf(KEY)): the preceding withCurrentGeneration protects only an empty block, allowing an identity transition before the request resolves its identity, while the subsequent generation check can discard the response but cannot bind the request to the operation's captured identity. Capture a server/profile/authentication snapshot, pass it explicitly through a captured-scope repository API, and validate that scope's generation before storing the result.
Kody rule violation: Bind settings operations and serialization to their captured identity
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/repository/HiddenLibrariesStore.kt:
Line 70:
Identity-binding failure affects settingsRepository.getEffectiveValues(listOf(KEY)): the preceding withCurrentGeneration protects only an empty block, allowing an identity transition before the request resolves its identity, while the subsequent generation check can discard the response but cannot bind the request to the operation's captured identity. Capture a server/profile/authentication snapshot, pass it explicitly through a captured-scope repository API, and validate that scope's generation before storing the result.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Not changing this. IdentityTransitionBarrier.changing() sets the new generation before it runs the block that installs the new identity (IdentityTransitionBarrier.kt:117-120), so a request can never see the new identity while the generation is still the captured one. Any request that overlaps a switch, under either identity, ends with generation != identityTransitions.generation.value and is dropped (HiddenLibrariesStore.kt:71) before anything is stored. The withCurrentGeneration fence covers the remaining case, a read that starts mid-switch, by waiting until the new identity is installed. aReadStartedMidSwitchAnswersForTheNewIdentity fails without the fence. Pinning an explicit snapshot would add no protection the generation check doesn't already give.
There was a problem hiding this comment.
Agreed—given the barrier ordering you describe, my original suggestion does not establish a correctness bug in this read path.
The two protections cover different cases:
- A read starts during a transition:
withCurrentGenerationwaits for identity installation to finish, or rejects the captured generation if it is no longer current. - A transition starts after that fence: the generation advances before the identity changes, so the subsequent generation check rejects the response before it is stored, regardless of which identity the request used.
The empty block is therefore a synchronization fence, not an attempt to bind the request’s identity. I mischaracterized its purpose.
An explicit identity snapshot would bind the request itself, but that is stronger than necessary to prevent stale results from entering this read-only store under the ordering you described. I would not require that change here or retain the high-severity finding on this basis.
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: 43a0e561bc
ℹ️ 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".
Return identity_changed when the profile changes while a library list waits for the hidden-library read, instead of the old profile's list. On TV, a new Audio or Libraries load replaces one still running, and a hidden-library change drops newly hidden libraries before the re-load, so a failed re-load can't keep them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc62cd4067
ℹ️ 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".
A hidden-library change re-loads the TV shell's library list once. When that re-load failed, the shell kept the newly hidden library and nothing retried. Filter the list it keeps instead. Also drop the phone MainScreen re-load on a hidden-library change: its media modes feed only visibleMobileTabs, which ignores them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Kotlin runs property initializers and init blocks in source order, so
the TV view model's loadJob initializer ran after init { load() } and
dropped the first load's job, which a hidden-library re-load then
couldn't cancel. Declare the revision and load-tracking properties above
init in both library view models.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b534f42ded
ℹ️ 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".
…again A hidden-library change re-loads the TV shell's list once. If that load failed after a library was shown again on another device, the tab stayed missing until the shell was recreated. Mark the load pending on failure and retry it when reachability returns to reachable. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34037dd81c
ℹ️ 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".
| val result = if (fetched.canServeCache() && known.isNotEmpty()) { | ||
| ApiResult.Success(personalDataRepository.withoutHidden(known)) |
There was a problem hiding this comment.
Retry the phone reload after an unhide failure
When another device unhides a library and this recheck returns a network error or 5xx, known contains only the previously visible libraries, so this fallback cannot restore the newly unhidden one. The revision has already been consumed by onHiddenLibrariesRevision, and a reconnect refresh that reads the same hidden-ID set does not emit another revision; unlike the TV shell, the phone has no reconnect-triggered retry, so the library remains absent until another lifecycle resume or manual refresh. Keep this reload pending and retry it after connectivity returns.
AGENTS.md reference: AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not adding a reconnect retry on the phone. LibrariesScreen already re-checks the list on every ON_RESUME: entering the Libraries tab and coming back to the app (#487). That's its existing recovery path for a failed load, and a library un-hidden during an outage comes back on the next one. The TV shell needed a reachability retry because it has no such hook; the phone does. This case also errs toward showing less, never toward an unopenable library. Leaving this open for a maintainer.
If the server was already reachable when the failed load returned, the status key never changed again and the retry never ran. Key it on the probe time too, so the next reachable probe retries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
The pending flag stayed set while a retry ran, so the next reachable probe bumped the retry key and cancelled it; a slow load could be restarted indefinitely. Clear the flag when a load starts, so it means the last load failed and none is running. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c13c7e5148
ℹ️ 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".
…e probe When a library was shown again on another device and the route's re-load failed, nothing retried it: the hidden-library revision had been consumed, and the shell's reachability retry only covers the shell's own list. Keep the load pending on failure and retry it on the next reachable probe, as the shell does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2204e7cd3b
ℹ️ 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".
listUserLibraries falls back to the offline cache on a network failure, so a hidden-library re-load during an outage looked like a success with a stale list, and nothing retried it. After the first load, the TV shell and the Audio/Libraries view model now re-check, which reports the failure, keeps what's shown and leaves the load pending for the next reachable probe. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55095f9fa2
ℹ️ 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".
| // re-checks, so a failure stays a failure and stays pending, rather | ||
| // than a cached list that misses a library shown again since. | ||
| val result = if (librariesLoaded) { | ||
| personalDataRepository.recheckUserLibraries(value.mapTo(mutableSetOf()) { it.id }) |
There was a problem hiding this comment.
Retry successful short reloads after an unhide
When a library is unhidden remotely and the first successful /user/libraries response is transiently short and omits that library, value contains only the previously visible libraries, so this known-ID check accepts the short response without a second read. Unlike the earlier error-path case, this returns ApiResult.Success, so librariesReloadPending remains false and reachable probes do not retry; the restored media-type tab stays absent until the shell is recreated. Preserve the full previously known server IDs or otherwise retry additions after an unhide.
AGENTS.md reference: AGENTS.md:L11-L11
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. It needs the server to return a short list right after an un-hide, one that leaves out the newly visible library. The client can't tell that apart from the library not being there, and keeping "previously known server ids" would mean keeping hidden ids in the shell's list, which is the state this PR removes. The short-response recovery from #487 confirms a shrink of libraries already shown; it can't detect a missing addition. A server returning short lists is a separate bug that would need its own fix. Leaving this open for a maintainer.
The cache write suspends after the last identity check, so a profile switch during it could still hand the old profile's list to the caller. Check the generation again after the write and answer identity_changed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Conflicts with main's library-list re-check (Silo-Server#487), hidden libraries (Silo-Server#517), household management (Silo-Server#493), and TV library browse (Silo-Server#468, Silo-Server#532) were resolved by keeping both sides: - LibrariesViewModel uses main's queued re-check loop, which already keeps an older library list from landing after a newer refresh, so the PR's separate job cancel is dropped. refreshAfterAccessChange() still clears the loaded subtabs and facets first. - The profile pickers keep both the stale-profile reload and main's manage-mode exit. - TvMainShell keys the library load on the hidden-libraries revision, the retry counter, and the access key. - libraryListChangedSinceCached() now goes through recheckUserLibraries(). Main caches only the visible libraries and confirms a short list before trusting it; comparing that cache with the raw server list would report an access change on every foreground return for a profile that hides a library, and would write hidden libraries back into the cache. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
A profile can hide libraries from navigation in the web app (Settings → Libraries → "Visible in navigation"). The choice is stored in the profile-scoped setting
ui.disabled_library_ids. The phone and TV apps never read it. For a profile without a library limit,GET /api/v2/user/librariesstill lists hidden libraries, so a hidden library stayed in the phone's library picker and the TV top bar. Opening it showed "Library not found", because the server's catalog reads already leave it out for that profile.Closes #515
Solution
HiddenLibrariesStore(shared) readsui.disabled_library_idsfrom the effective-settings endpoint. It parses the value the way the web'sparseLibraryIDListdoes: an array, the legacy JSON-string form, or null, keeping only positive whole numbers. Each value is tied to the identity generation it was read under, so a profile or server switch never filters one profile's list with another's choice. Reads run one at a time, and a read waits out an identity change that is still in progress.PersonalDataRepository.listUserLibrariesandrecheckUserLibrariesleave hidden libraries out of every list they return and of the offline cache. The setting is read alongside the first list load for each profile. The re-check still compares the libraries on screen with the full server list, so a library the profile just hid counts as a removal, not as a short response.ServerDrivenConfigRefresher(foreground and reconnect) re-reads the setting. Android has nouser_settings.changedconsumer, so this is the app's existing cross-device path. When the set changes, the store bumps a revision. The TV shell, the TV Audio and Libraries routes, and the phone Libraries screen re-load their lists when it changes. If that re-load fails, each one still drops the newly hidden libraries from the list it shows. If the open TV tab's library gets hidden, the TV returns to Home.include_hidden(fix(access): let Settings → Libraries show a restricted profile's hidden libraries silo-server#2058).ui.library_orderand a screen for showing hidden libraries again are out of scope.Validation
Validated on an isolated Silo dev deployment built from silo-server
main(07dd4decd), using Android phone and Android TV emulators (API 36). The test account had no library limit and two libraries, Movies and TV Shows. I hid TV Shows through the settings call the web page makes. After that, the effective value read[2]and/user/librariesstill listed both libraries.main: the phone picker listed TV Shows and opening it showed "Library not found". The TV showed a Series tab that opened to "Library not found"../gradlew testDebugUnitTestacross shared, android-shared, androidApp and androidTvApp: 0 failures. The newHiddenLibrariesStoreTestcovers parsing, filtering and caching, the re-check, revision bumps, and reads that race a profile switch.MembershipActivationTestnow bindsSettingsApiin its Koin module, which the productionPersonalDataRepositorywiring needs.lintDebug(all three modules) andlintVitalRelease(both apps) report no new issues. I could not runscripts/check-build-supply-chain.shand its self-test locally, because the host has noruby. This diff does not touch build or dependency files.Validation tasks: unavailable (the board lookup needs a
read:projecttoken scope I don't have).Evidence: https://evidence.siloserver.org/r/silo-android/issue-515/
Risks
Follow-ups
AI disclosure
claude-opus-5-5investigated, implemented, tested and verified this change.claude-opus-5-5, plusclaude-sonnet-5-5for cleanup) reviewed the diff for correctness, callers, contract and failure handling, and conventions. They found out-of-order concurrent reads, a settings request on every list load, and dropped whole-number decimals; all three are fixed. Codex (gpt-6.1-sol, xhigh) ran an adversarial round on the result. It found that a read could straddle an identity change, that recovery after a failed read never re-loaded screens, and that a failed phone re-check could re-show a hidden library. All three are fixed and covered by tests. A suggestion to also refresh search and person-page filter chips while they stay open was declined as out of scope: those screens reload when reopened, and the server already leaves hidden libraries out of search. A second Codex round on the fixes found nothing. A final run of the Claude subagents found that the TV Audio and Libraries routes never re-loaded (fixed); its other notes are under Risks. On the PR, Kody found overlapping TV list loads, a failed TV re-load keeping a hidden library, and a list returned across a profile switch, and Codex found the same failed re-load gap in the TV shell; all are fixed, and a list request that crosses a switch now answersidentity_changed.🤖 Generated with Claude Code
Note
Filter hidden libraries out of phone and TV library navigation
HiddenLibrariesStorein HiddenLibrariesStore.kt. It loads the active profile's hidden library IDs from settings, parses both the canonical JSON array and the legacy JSON-string array, and exposes a revision flow when the hidden set changes.PersonalDataRepositoryfilters hidden libraries from server results, cached lists, and cache fallbacks. It also rejects results that straddle a profile or server switch.LibrariesScreen) and TV (TvLibrariesScreen,TvMainShell) view models reload or update the visible list when the hidden-library revision changes. TV reloads recheck the server instead of falling back to stale cache and retry after a reachable-server probe.ServerDrivenConfigRefresherrefreshes the hidden-library store as part of server-driven config refreshes.Macroscope summarized 964c03a.