Repository navigation
feat(catalog): show profile-controlled advisory ages - #587
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (20)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe iOS and tvOS apps now carry advisory-age metadata into detail overlays. A shared profile-scoped preference controls whether detail views show advisory-age badges. Settings expose the preference when the server reports support. ChangesAdvisory Age
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant SettingsView
participant AdvisoryAgePreferenceStore
participant SiloAPI
participant DetailHero
SettingsView->>AdvisoryAgePreferenceStore: hydrate preference
AdvisoryAgePreferenceStore->>SiloAPI: fetch capabilities
SiloAPI-->>AdvisoryAgePreferenceStore: capability response
AdvisoryAgePreferenceStore->>SiloAPI: fetch effective profile value
SiloAPI-->>AdvisoryAgePreferenceStore: effective-value response
SettingsView->>AdvisoryAgePreferenceStore: save preference
AdvisoryAgePreferenceStore->>SiloAPI: write profile setting
DetailHero->>AdvisoryAgePreferenceStore: read enabled preference
DetailHero->>DetailHero: include badge in rating chips
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The advisory-age preference and badges are ready to merge after normal checks; no actionable merge-blocking issue remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The inspected changes affect advisory labels and a profile display preference, not viewing permissions. Identity checks and state invalidation limit cross-profile exposure. No introduced security issue was established, but server-side authorization and metadata provenance were not independently verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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:
|
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:
|
|
@kody start-review |
Quick104
left a comment
There was a problem hiding this comment.
I reviewed this against the server contract and the web client, then ran the unfixed head on iOS and tvOS simulators against a fresh dev sandbox with advisory ages seeded on six titles. The contract matches: detail, browse, sections and search all carry advisory_age and advisory_source, the setting is profile-scoped and off by default, the labels match the web client's MetadataBadges, and the poster overlay uses the same id, position, default and icon. The badge and the settings rows render correctly on both platforms.
Three things need changes before this is ready, plus one small one. I'm fixing all four in commits on this branch, so there's no need to change anything yourself. I'll reply in each thread with the commit.
The Android app needs the same badge, setting and poster overlay; silo-android#375 and #416 track it. My summary comment follows once the fixes are pushed and verified.
Reviewed with Claude Code (claude-opus-5-5), with a cross-provider pass by Codex (gpt-6.1-sol).
The advisory age preference was read once per sign-in, so a change made on the web or another device never reached the badge or the toggle. It now re-reads when General settings opens and on the first detail page after the app returns to the foreground, and a passing "unavailable" settings answer no longer hides the setting for the whole session. The toggle shows the new value while it saves, rolls back to the last confirmed value if the save fails, and says why under the row on iOS, macOS and tvOS. It stays hidden until the profile's value has loaded. Detail pages without a rating chip no longer gain an empty chip stack that pushed the metadata line 4pt off centre. 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:
|
Review summaryReviewed head: Fit: 8/10 · Readiness: 8/10 — conditional What I checked
Addressed in
|
| /// Lets the next ``hydrateIfNeeded()`` read again while keeping the last | ||
| /// answer on screen. Called when the app returns to the foreground. | ||
| func markStale() { | ||
| hasHydrated = false |
There was a problem hiding this comment.
Stale-value race: a refresh started before markStale() can complete afterward and republish data that should have been invalidated. Invalidate the refresh generation and cancel any in-flight hydration before marking the value stale.
Kody rule violation: Fence asynchronous results by scope and invalidation generation
generation &+= 1
hydrationTask?.cancel()
hydrationTask = nil
hasHydrated = falsePrompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 82:
Stale-value race: a refresh started before markStale() can complete afterward and republish data that should have been invalidated. Invalidate the refresh generation and cancel any in-flight hydration before marking the value stale.
Suggested Code:
generation &+= 1
hydrationTask?.cancel()
hydrationTask = nil
hasHydrated = false
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.
Fixed in 7e22a44, with a different repair. markStale() now bumps a counter, and a read that started before it still shows its answer (the newest one the app has) but no longer marks the value fresh, so the next detail page reads again. Cancelling the in-flight read would discard that answer and leave the old one on screen. Covered by testReadInFlightWhenMarkedStaleDoesNotCountAsFresh.
There was a problem hiding this comment.
That’s a solid fix. Keeping the in-flight read’s result avoids showing stale data, while the counter prevents that result from being treated as fresh after markStale(). The regression test also clearly captures the intended behavior.
| showsAdvisoryAge = enabled | ||
| isSaving = true | ||
| defer { | ||
| if generation == currentGeneration { |
There was a problem hiding this comment.
Saving-hold corruption: releasing the hold for every failed PUT allows uncertain transport outcomes to escape suppression while reconciliation is pending. Distinguish confirmed failures from uncertain outcomes, and clear the hold only after the matching reconciliation completes or an operation-specific expiry fires.
Kody rule violation: Handle uncertain mutations with operation-specific holds
Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 152:
Saving-hold corruption: releasing the hold for every failed PUT allows uncertain transport outcomes to escape suppression while reconciliation is pending. Distinguish confirmed failures from uncertain outcomes, and clear the hold only after the matching reconciliation completes or an operation-specific expiry fires.
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.
Partly addressed in 7e22a44. You're right that a PUT which fails on transport may still have landed. A failed save now leaves the next read due, so the toggle reconciles with the server on the next detail page, Settings visit or foreground (testFailedWriteIsReconciledByTheNextRead). I haven't added held-change machinery: this is a display-only boolean that the user can re-press, it already rolls back to the last confirmed value with an explanation, and the seek-interval settings on the same screens handle failures the same way.
There was a problem hiding this comment.
Understood. No changes were made this turn, and I won’t claim that anything was saved, created, recorded, or updated.
| self.localMutationRevision == mutationRevision else { return } | ||
| let value = response.value(for: .catalogShowAdvisoryAge)?.value.boolValue == true | ||
| self.confirmedValue = value | ||
| self.isSupported = true |
There was a problem hiding this comment.
Capability-scope race: publishing support from the Boolean isSupported flag alone can allow putValue to transmit against an unknown or stale capability manifest revision. Persist the capability manifest revision with the server, profile, and device identity before publishing support, then gate putValue at transmission time on that scope-bound revision and defer the write when it is unknown or stale.
Kody rule violation: Scope capability revisions and gate settings at transmission time
Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 128:
Capability-scope race: publishing support from the Boolean isSupported flag alone can allow putValue to transmit against an unknown or stale capability manifest revision. Persist the capability manifest revision with the server, profile, and device identity before publishing support, then gate putValue at transmission time on that scope-bound revision and defer the write when it is unknown or stale.
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. Every capability and value result is already fenced by the request identity (server id, server URL, profile) and the store generation, so a result from another server or profile is dropped. If the connected server stops supporting the key, the PUT fails as unknownSetting, the toggle rolls back, and the row says "This server can't save Show Advisory Age." Tracking a manifest revision per scope would add state without changing what the user sees.
There was a problem hiding this comment.
Understood. No action was taken this turn.
…failed saves A read already in flight when the app returned to the foreground could mark the value fresh and skip the re-read the foreground asked for. It still shows its answer, but the next detail page now reads again. A save that fails may still have landed on the server, so it also leaves the next read due, which reconciles the toggle with the server. 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:
|
| /// Lets the next ``hydrateIfNeeded()`` read again while keeping the last | ||
| /// answer on screen. Called when the app returns to the foreground. | ||
| func markStale() { | ||
| staleMarks &+= 1 |
There was a problem hiding this comment.
Hydration task invalidation is incomplete because incrementing staleMarks alone does not invalidate the hydration task already in flight, allowing its captured generation to pass canApply and publish after markStale(). Advance the refresh generation, cancel and clear the current task, then mark the value stale.
Kody rule violation: Fence asynchronous results by scope and invalidation generation
generation &+= 1
hydrationTask?.cancel()
hydrationTask = nil
staleMarks &+= 1Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 85:
Hydration task invalidation is incomplete because incrementing staleMarks alone does not invalidate the hydration task already in flight, allowing its captured generation to pass canApply and publish after markStale(). Advance the refresh generation, cancel and clear the current task, then mark the value stale.
Suggested Code:
generation &+= 1
hydrationTask?.cancel()
hydrationTask = nil
staleMarks &+= 1
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; it's the trade-off settled in the earlier thread on this line. Bumping generation in markStale() would discard a valid in-flight answer and, if a save were running, leave isSaving stuck, because the save's defer only clears it for the same generation. The in-flight read may publish its value (the newest the app has) but no longer counts as fresh, and with the commit above a caller that joins it reads again.
There was a problem hiding this comment.
Understood. No changes or other actions were performed.
| writeError = Self.writeFailureMessage(for: error) | ||
| // A save that timed out may still have landed; the next read | ||
| // reconciles it. | ||
| markStale() |
There was a problem hiding this comment.
Uncertain PUT failures are indistinguishable from confirmed failures, and the surrounding defer still clears isSaving so a timed-out request can be resent immediately. Track an operation-specific hold for uncertain saves, release it only after matching reconciliation or a bounded expiry, and keep confirmed failures separate.
Kody rule violation: Handle uncertain mutations with operation-specific holds
Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 173:
Uncertain PUT failures are indistinguishable from confirmed failures, and the surrounding defer still clears isSaving so a timed-out request can be resent immediately. Track an operation-specific hold for uncertain saves, release it only after matching reconciliation or a bounded expiry, and keep confirmed failures separate.
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.
Same as the earlier thread on the failure path: no held-change machinery for this display-only boolean. A failed save rolls back to the last confirmed value, explains why, and leaves the next read due, which reconciles a save that actually landed. Resending is a PUT of the same value, which is idempotent.
There was a problem hiding this comment.
Agreed—no held-change machinery for this display-only boolean. On save failure, we restore the last confirmed value, explain the failure, and leave the next read due. That read reconciles the state if the save actually landed despite the error. A retry sends the same value via PUT, so it’s idempotent.
| staleMarks &+= 1 | ||
| hasHydrated = false | ||
| } | ||
|
|
There was a problem hiding this comment.
Stale hydration state leaves an in-flight hydrationTask coalesced as the completed refresh even though staleMarks causes that task to finish with hasHydrated=false; a hydrateIfNeeded() call that overlaps the stale-marked read awaits the old task and returns at lines 90-93, so no replacement read occurs and the profile setting remains stale until another caller retries. Re-check hasHydrated and staleMarks after awaiting the existing hydration task and start a new refresh when the awaited task was invalidated, or cancel and invalidate the task in markStale() so the next hydration call cannot return through it.
Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 85 to 88:
Stale hydration state leaves an in-flight hydrationTask coalesced as the completed refresh even though staleMarks causes that task to finish with hasHydrated=false; a hydrateIfNeeded() call that overlaps the stale-marked read awaits the old task and returns at lines 90-93, so no replacement read occurs and the profile setting remains stale until another caller retries. Re-check hasHydrated and staleMarks after awaiting the existing hydration task and start a new refresh when the awaited task was invalidated, or cancel and invalidate the task in markStale() so the next hydration call cannot return through it.
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.
Fixed in f3a146d. refresh() records the stale mark each in-flight read started under; a caller that joins a read started before markStale() waits for it and then starts a fresh read. Covered by testHydrateJoiningAStaleReadStartsAFreshOne.
There was a problem hiding this comment.
Understood. No action was taken this turn, and nothing was saved, created, recorded, or updated.
…h one A detail page that asked for the advisory age setting while a read started before the app returned to the foreground was still running joined that read and returned, so the re-read never happened. It now waits for that read and then starts a fresh one. 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:
|
| while let hydrationTask { | ||
| let isCurrent = hydrationStaleMark == staleMarks | ||
| await hydrationTask.value | ||
| if isCurrent { return } |
There was a problem hiding this comment.
Race condition in iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:95-95: returning based on the pre-suspension isCurrent snapshot can ignore invalidation during hydration, allowing a stale result to suppress the required replacement read. Compare the task's captured generation, taskStaleMark, with staleMarks after the await before returning.
Kody rule violation: Fence asynchronous results by scope and invalidation generation
if taskStaleMark == staleMarks { return }Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 97:
Race condition in `iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:95-95`: returning based on the pre-suspension `isCurrent` snapshot can ignore invalidation during hydration, allowing a stale result to suppress the required replacement read. Compare the task's captured generation, `taskStaleMark`, with `staleMarks` after the await before returning.
Suggested Code:
if taskStaleMark == staleMarks { return }
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.
Fixed in 3f29671, the same change as the neighbouring thread: the comparison now happens after the await, against the mark captured for the joined read.
There was a problem hiding this comment.
Thanks—comparing the joined read’s captured mark with staleMarks after the await addresses the reported race. An invalidation during suspension will no longer cause an early return that skips the replacement read.
Based on your description, this suggestion is addressed in 3f296716.
| while let hydrationTask { | ||
| let isCurrent = hydrationStaleMark == staleMarks | ||
| await hydrationTask.value | ||
| if isCurrent { return } | ||
| } |
There was a problem hiding this comment.
Race condition in refresh(): capturing isCurrent before await hydrationTask.value misses any markStale() during suspension, allowing refresh() to return with the preference marked stale without starting the required replacement read. Compare hydrationStaleMark with staleMarks after the await, or otherwise re-check invalidation after suspension, before returning.
while let hydrationTask {
await hydrationTask.value
if hydrationStaleMark == staleMarks { return }
}Prompt for LLM
File iosApp/iosApp/Networking/AdvisoryAgePreferenceStore.swift:
Line 94 to 98:
Race condition in `refresh()`: capturing `isCurrent` before `await hydrationTask.value` misses any `markStale()` during suspension, allowing `refresh()` to return with the preference marked stale without starting the required replacement read. Compare `hydrationStaleMark` with `staleMarks` after the await, or otherwise re-check invalidation after suspension, before returning.
Suggested Code:
while let hydrationTask {
await hydrationTask.value
if hydrationStaleMark == staleMarks { return }
}
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.
Fixed in 3f29671. refresh() captures the joined read's stale mark before waiting and compares it with staleMarks afterwards, so a markStale() during the wait starts a replacement read. Covered by testMarkedStaleWhileJoinedReadRunsStartsAFreshOne.
There was a problem hiding this comment.
Thanks—capturing the joined read’s stale mark before the await and comparing it with staleMarks afterward addresses the reported race, including invalidation during suspension. testMarkedStaleWhileJoinedReadRunsStartsAFreshOne covers that scenario. Based on your description of 3f296716, this resolves the suggestion.
…read A caller that joined a read in flight decided whether that read was current before waiting on it, so a foreground arriving during the wait left the setting stale with no replacement read. It now compares the read's stale mark after the wait. 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:
|





Apple clients receive advisory-age metadata but did not consistently expose the profile preference or display the resulting badge across detail and poster surfaces.
This adds the profile display toggle and shows advisory age on iOS, tvOS, and macOS item details and poster overlays. The preference store pins reads and writes to the active server/profile identity and rejects stale responses after profile changes.
This addresses the display portions of #416 and #548. Profile access limits and enforcement remain separate work.
Validation
AdvisoryAgePreferenceStoreTests: 6 passedSiloTVand authenticated UI verification: passedSiloMac: passedgit diff --check: passedThe macOS build used an explicit ARM64 destination because the current media dependencies do not provide local x86_64 macOS modules under Xcode 27.
Evidence
iOS film detail — before and after
With Show Advisory Age disabled, only the content rating appears. When enabled, the advisory-age badge appears beside it.
Poster overlays
Advisory ages appear alongside the existing quality and IMDb overlays on iOS and tvOS.
tvOS profile setting
The profile-scoped toggle appears under General → Cards & Posters.
Coordination
Risks and follow-up
catalog.show_advisory_agekeep the preference and badges hidden.Review fixes
A maintainer review added four commits (
103aabbc,7e22a445,f3a146df,3f296716):Verified on iOS 27 and tvOS 27 simulators against a dev sandbox, before and after;
AdvisoryAgePreferenceStoreTestsnow has 15 cases (iOS 28 and tvOS 30 focused tests pass), andSiloMacbuilds.Validation tasks: none
Android parity: Silo-Server/silo-android#375 (detail badge and toggle) and Silo-Server/silo-android#416 (poster badge).
Evidence: https://evidence.siloserver.org/r/silo-apple/pr-587/
AI Disclosure
103aabbc,7e22a445,f3a146dfand3f296716.Note
Add profile-controlled advisory-age badges and settings toggle
advisory_ageoverlay (disabled by default, users icon, bottom-right) that shows a source-attributed age badge such as "Common Sense 14" on browse cards, section cards, and detail screens on iOS and tvOSAdvisoryAgePreferenceStore, a shared main-actor store that checks server settings capabilities, reads the profile's effective value via SiloAPI, and writes the profile-scoped boolean optimistically with rollback and error messages on failureCatalogItemDetail,BrowseItem,SectionItem, andItemDetail; an advisory age that cannot be converted to the legacy integer representation causes the catalog projection to throwMacroscope summarized 103aabb.