Skip to content

fix(tv): restore Shield focus navigation - #164

Closed
RXWatcher wants to merge 22 commits into
Silo-Server:mainfrom
RXWatcher:fix/shield-focus-restoration
Closed

fix(tv): restore Shield focus navigation#164
RXWatcher wants to merge 22 commits into
Silo-Server:mainfrom
RXWatcher:fix/shield-focus-restoration

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve and restore the exact For You recommendation card after returning from detail, including reordered and horizontally offscreen targets
  • retain PR fix(tv): recover late For You focus relocation #162 late first-row anchor recovery and make only the For You recommendations view use the solid top treatment already shown by Watchlist/Favorites
  • route Calendar focus from shelves to weekdays to filters to the Calendar tab, including empty/error states
  • make Diagnostics crash-report controls reliably focusable and prevent held D-pad repeats from skipping layers

Watchlist remains inside For You. Its behavior, navigation, layout, rendering, and generic detail callback are unchanged.

This PR includes and supersedes #162.

Verification

  • shared recommendation identity test: passed
  • focused For You resolver, lifecycle, offscreen-row, and top-anchor tests: passed
  • focused Diagnostics tests: passed
  • full Android TV unit suite: 794 tests, 0 failures
  • androidTvApp debug APK assembly: passed
  • final whole-branch review and scoped fix re-review: ready to merge
  • TvPersonalScreens.kt protected-file diff: empty

Device follow-up

The APK was built but was not installed or launched during this branch pass. Shield Pro focus and visual smoke checks remain the post-PR release gate.

Summary by CodeRabbit

  • Improvements

    • Restores focus to previously selected recommendations after returning from details, including reordered or temporarily unavailable content.
    • Improves D-pad navigation across Calendar filters, week controls, menus, and content.
    • Enhances Diagnostics settings focus order, retries, and directional navigation.
    • Preserves the For You list’s top position after delayed focus changes.
    • Displays a solid top-bar background when needed for For You navigation.
  • Tests

    • Added coverage for focus restoration, navigation boundaries, delayed scrolling, and diagnostics controls.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RXWatcher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cecf5370-22b5-47f1-97d2-24e89a222171

📥 Commits

Reviewing files that changed from the base of the PR and between 901a92c and 9ee61db.

📒 Files selected for processing (2)
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt
  • docs/superpowers/plans/2026-08-04-pr-164-review-remediation.md
📝 Walkthrough

Walkthrough

The Android TV focus system now restores recommendation cards after detail returns, preserves the For You top anchor, routes Calendar control focus explicitly, and manages Diagnostics directional navigation with bounded retries. Recommendation sections now use stable metadata-based identities.

Changes

Android TV focus restoration

Layer / File(s) Summary
Recommendation identity and target resolution
shared/src/commonMain/kotlin/org/siloserver/silo/model/recommendation/RecommendationModels.kt, shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/RecommendationsViewModel.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridge.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/viewmodel/RecommendationsSectionIdentityTest.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridgeTest.kt
Recommendation sections use stable metadata-based identities. Focus restoration resolves stable targets, applies row/card fallbacks, tracks request IDs, waits for attachment, and handles rejected, disposed, focused, and exhausted outcomes.
For You detail-return restoration
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/components/TvMediaRow.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsScreen.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/components/TvMediaRowFocusRestoreTest.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridgeTest.kt
For You records clicked cards and restores row and card focus after detail return. Rows report target placement and disposal. The shell manages return state and opaque top-bar state.
For You top-anchor correction
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsScreen.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsTopAnchorTest.kt, docs/superpowers/plans/2026-08-03-for-you-late-focus-relocation.md, docs/superpowers/specs/2026-08-03-for-you-late-focus-relocation-design.md
Top anchoring uses snapshotFlow position events and a suspend correction helper. Tests cover delayed displacement, anchored positions, and focus loss.
Calendar control-zone routing
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarScreen.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarFocusRoutingTest.kt, docs/superpowers/plans/2026-08-03-shield-focus-restoration.md, docs/superpowers/specs/2026-08-03-shield-focus-restoration-design.md
Calendar tracks Filter and WeekStrip focus. Up navigation moves from WeekStrip to Filter, then to the menu. Repeat handling and control-state clearing are explicit.
Diagnostics focus navigation
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt, docs/superpowers/plans/2026-08-03-shield-focus-restoration.md, docs/superpowers/specs/2026-08-03-shield-focus-restoration-design.md
Diagnostics uses consent-aware initial focus, bounded retries, directional traversal, disabled-control skipping, boundary handling, and repeat-key consumption.
Shell return-state coordination
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusState.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt
The shell tracks Home and For You return requests, applies route-specific fallback requesters, resets explicit selections, and propagates recommendation return callbacks.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TvMainShell
  participant TvRecommendationsScreen
  participant TvRecommendationsFocusBridge
  participant TvMediaRow
  TvMainShell->>TvRecommendationsScreen: start detail-return request
  TvRecommendationsScreen->>TvRecommendationsFocusBridge: resolve stable recommendation target
  TvRecommendationsFocusBridge->>TvMediaRow: prepare row and card restoration
  TvMediaRow-->>TvRecommendationsScreen: report placement or disposal
  TvRecommendationsScreen->>TvRecommendationsFocusBridge: retry focus within frame bound
  TvRecommendationsFocusBridge-->>TvMainShell: consume completed return request
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: restoring Shield TV focus navigation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt`:
- Around line 238-246: Update tvDiagnosticsCrashFocusRequestResult so
Result.failure is classified as RETRY rather than DISPOSED, allowing transient
FocusRequester attachment failures to continue the bounded retry. Preserve
FOCUSED for successful true results, and update
failedFocusRequestIsTerminalBecauseTheScreenWasDisposed to expect RETRY for
transient detach failures; handle actual disposal through the existing
structured-concurrency path.

In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt`:
- Around line 356-362: Update the Home detail-return state around
detailReturnFallback and the LifecycleResumeEffect retry flow so the Home focus
requester remains selected until the retry consumes it. Defer clearing
restoreHomeContentAfterDetail, or introduce and maintain a Home-specific pending
flag matching forYouDetailReturnFocusPending, ensuring a failed synchronous
resume request still targets homeDetailReturnCardFocusRequester.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/RecommendationsViewModel.kt`:
- Around line 119-122: Update DiscoverRow.stableSectionId() to use the kind/key
identity only when both sectionKind and sectionKey are nonblank; otherwise
retain the existing type/label fallback. Add a regression test covering two rows
with the same sectionKind and absent sectionKey, verifying they use the fallback
identity rather than the shared kind/key form.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cdafafbd-b1e9-47b2-904f-94aa0949ba2f

📥 Commits

Reviewing files that changed from the base of the PR and between 46f60ee and 4d30fac.

📒 Files selected for processing (18)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/components/TvMediaRow.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridge.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/components/TvMediaRowFocusRestoreTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarFocusRoutingTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridgeTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsTopAnchorTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt
  • docs/superpowers/plans/2026-08-03-for-you-late-focus-relocation.md
  • docs/superpowers/plans/2026-08-03-shield-focus-restoration.md
  • docs/superpowers/specs/2026-08-03-for-you-late-focus-relocation-design.md
  • docs/superpowers/specs/2026-08-03-shield-focus-restoration-design.md
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/recommendation/RecommendationModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/RecommendationsViewModel.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/RecommendationsSectionIdentityTest.kt

Comment on lines +119 to +122
private fun DiscoverRow.stableSectionId(): String =
sectionKind?.takeIf { it.isNotBlank() }?.let { kind ->
"discover:kind=$kind:key=${sectionKey.orEmpty()}"
} ?: "discover:type=$type:label=$label"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Prevent IDs from colliding when sectionKey is absent.

sectionKey is optional. Two rows with the same sectionKind and no key both receive discover:kind=<kind>:key=. This breaks the stable-section identity contract and can restore focus to the wrong row after a refresh.

Use the sectionKind and sectionKey form only when both values are nonblank. Otherwise, fall back to the existing type and label identity. Add a regression test with two same-kind rows that omit sectionKey.

Proposed fix
-private fun DiscoverRow.stableSectionId(): String =
-    sectionKind?.takeIf { it.isNotBlank() }?.let { kind ->
-        "discover:kind=$kind:key=${sectionKey.orEmpty()}"
-    } ?: "discover:type=$type:label=$label"
+private fun DiscoverRow.stableSectionId(): String {
+    val kind = sectionKind?.takeIf { it.isNotBlank() }
+    val key = sectionKey?.takeIf { it.isNotBlank() }
+    return if (kind != null && key != null) {
+        "discover:kind=$kind:key=$key"
+    } else {
+        "discover:type=$type:label=$label"
+    }
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private fun DiscoverRow.stableSectionId(): String =
sectionKind?.takeIf { it.isNotBlank() }?.let { kind ->
"discover:kind=$kind:key=${sectionKey.orEmpty()}"
} ?: "discover:type=$type:label=$label"
private fun DiscoverRow.stableSectionId(): String {
val kind = sectionKind?.takeIf { it.isNotBlank() }
val key = sectionKey?.takeIf { it.isNotBlank() }
return if (kind != null && key != null) {
"discover:kind=$kind:key=$key"
} else {
"discover:type=$type:label=$label"
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/RecommendationsViewModel.kt`
around lines 119 - 122, Update DiscoverRow.stableSectionId() to use the kind/key
identity only when both sectionKind and sectionKey are nonblank; otherwise
retain the existing type/label fallback. Add a regression test covering two rows
with the same sectionKind and absent sectionKey, verifying they use the fallback
identity rather than the shared kind/key form.

@RXWatcher

Copy link
Copy Markdown
Contributor Author

Code review

Found 5 issues (1 blocking, 4 lower confidence):

1. Calendar held-Up freezes mid-list — the isRepeat branch lost its guard (blocking)

isRepeat -> StayInContent is now an unconditional catch-all. On main it was scoped as focusedShelfIndex == null && isRepeat by d6f2c15c ("fix(tv): keep repeated up in content"), specifically so a held Up deeper in the shelf list still fell through to MoveWithinContent.

The branch above it already handles the boundary case inline (if (isRepeat) StayInContent else ReturnToControls), so the new branch contributes nothing to the case it was written for — its only effect is to swallow repeats when focusedShelfIndex is non-null. Holding Up on a mid-list day shelf moves once, then freezes until the button is released.

This also breaks the PR's own stated Global Constraint in docs/superpowers/plans/2026-08-03-shield-focus-restoration.md: "Preserve the existing one-layer-per-press behavior for repeated D-pad events."

TvCalendarFocusRoutingTest.kt has no case combining isRepeat = true with a non-null focusedShelfIndex, which is why this passed.

): CalendarUpFallbackAction = when {
shouldReturnCalendarFocusToControls(
focusedShelfIndex = focusedShelfIndex,
firstFocusableShelfIndex = firstFocusableShelfIndex,
isReturningToControls = isReturningToControls,
) -> if (isRepeat) CalendarUpFallbackAction.StayInContent else CalendarUpFallbackAction.ReturnToControls
isRepeat -> CalendarUpFallbackAction.StayInContent
focusedControlZone == CalendarControlFocusZone.WeekStrip -> CalendarUpFallbackAction.FocusFilter
focusedControlZone == CalendarControlFocusZone.Filter -> CalendarUpFallbackAction.EnterMenu
else -> CalendarUpFallbackAction.MoveWithinContent
}

2. Diagnostics Up is a one-way door

Up clamps (order[(index - 1).coerceAtLeast(0)]) while Down falls through (order.getOrNull(index + 1)). Since consume = target != null, clamping always consumes, so every Up press on the first crash-report option is swallowed. There is a STATUS section above it in the LazyColumn, so there is a legitimate focus target being blocked. The test name firstChoiceHoldsAtUpperBoundary suggests this may be deliberate — flagging because it is asymmetric with Down.

val order = tvDiagnosticsCrashFocusOrder(debugLoggingEnabled)
val index = order.indexOf(current).coerceAtLeast(0)
return when (direction) {
TvDiagnosticsFocusDirection.Up -> order[(index - 1).coerceAtLeast(0)]
TvDiagnosticsFocusDirection.Down -> order.getOrNull(index + 1)
}
}
internal fun tvDiagnosticsCrashFocusKeyResult(
current: TvDiagnosticsCrashFocus,
direction: TvDiagnosticsFocusDirection,
debugLoggingEnabled: Boolean,
isRepeat: Boolean,
): TvDiagnosticsCrashFocusKeyResult {
if (isRepeat) return TvDiagnosticsCrashFocusKeyResult(target = null, consume = true)
val target = nextTvDiagnosticsCrashFocus(current, direction, debugLoggingEnabled)
return TvDiagnosticsCrashFocusKeyResult(target = target, consume = target != null)
}

3. stableSectionId() fallback drops the uniqueness guarantee

The old discover_${index}_${type} was unique by construction. The fallback used when the server does not send sectionKind is discover:type=$type:label=$label, which is not. There is no distinctBy in toResolvedSections(), and section.id is the LazyColumn key on both TV (TvRecommendationsScreen.kt) and phone (RecommendationsScreen.kt) — duplicate keys throw in Compose.

Requires an older server emitting two rows sharing both type and label. RecommendationsSectionIdentityTest only covers the sectionKind-present path. Neither design doc mentions the coordinated server field or the degrade path. (No upgrade risk — nothing persisted is keyed on the old format.)

private fun DiscoverRow.stableSectionId(): String =
sectionKind?.takeIf { it.isNotBlank() }?.let { kind ->
"discover:kind=$kind:key=${sectionKey.orEmpty()}"
} ?: "discover:type=$type:label=$label"

4. For You copies Home's detail-return state but not Home's reset

The comment on L609-613 states why Home clears its token on explicit reselect (added by 04fb276e): a stale nonzero token "keeps suppressing Home's normal first-card focus request for the rest of the shell session." The new forYouDetailReturnFocusRequest / forYouDetailReturnFocusPending are used identically by detailReturnFallback, but the ForYou branch at L605-607 never resets them. consumeForYouDetailReturn() only clears on a matching requestId, so a restore interrupted before consumption leaves the token stuck.

val onSelectRoot: (TvRootDestination) -> Unit = { dest ->
val route = dest.toRoute()
if (dest == TvRootDestination.ForYou) {
forYouEntryRequest = forYouEntryRequest.nextForTopLevelForYou()
}
if (dest == TvRootDestination.Home) {
// Detail return deliberately preserves the card that opened the
// detail page, but that protection must end when the user
// explicitly selects Home from the bar. Otherwise its nonzero
// token keeps suppressing Home's normal first-card focus request
// for the rest of the shell session.
homeDetailReturnFocusRequest = 0
homeDetailReturnNeedsRetry = false
}
if (dest == TvRootDestination.Calendar) {
calendarFocusHandoffPending = true
}

5. shouldFallbackForYouReturnToFilter is never called

Introduced and unit-tested as the encoding of the empty-feed fallback rule, but TvRecommendationsScreen.kt reimplements the same target == null check inline. The test can keep passing while the shipped path drifts.

Exhausted,
Disposed,
}
internal fun shouldFallbackForYouReturnToFilter(
resolved: ResolvedForYouFocusTarget?,
): Boolean = resolved == null
internal enum class FocusRequestOutcome {


Checked and clear:

Minor: every checkbox in docs/superpowers/plans/2026-08-03-shield-focus-restoration.md is still - [ ], while the companion 2026-08-03-for-you-late-focus-relocation.md plan has all boxes checked.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt (1)

37-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the Home-return branch of beginHomeDetailReturnRetryIfHome.

TvMainShell.kt (Lines 378-426) calls this conditional helper, but the test only covers isHomeDetailReturn = false. Add a Home-return case that verifies the request ID increments and fallbackPending is true when needsRetry is true. Also cover needsRetry = false if immediate clearing is part of the contract.

Suggested regression test
+    `@Test`
+    fun homeRetryArmsHomeFallback() {
+        val state = beginHomeDetailReturnRetryIfHome(
+            previousState = HomeDetailReturnFocusState(requestId = 7),
+            isHomeDetailReturn = true,
+            needsRetry = true,
+        )
+
+        assertEquals(8, state.requestId)
+        assertTrue(state.needsRetry)
+        assertTrue(state.fallbackPending)
+    }

As per coding guidelines, add focused tests for shared logic only when behavior is critical or high risk.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt`
around lines 37 - 48, Extend TvDetailReturnFocusStateTest around
beginHomeDetailReturnRetryIfHome with a Home-return case using
isHomeDetailReturn = true and needsRetry = true, asserting the request ID
increments and fallbackPending becomes true while retry remains active. Also add
the needsRetry = false Home-return case if the helper’s contract clears state
immediately, preserving the existing non-home coverage.

Source: Coding guidelines

docs/superpowers/plans/2026-08-04-pr-164-review-remediation.md (1)

33-82: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Mark completed plan steps as complete.

The document says checkbox syntax tracks execution, but the implementation and validation steps remain - [ ]. The PR objectives report that the remediation commits and automated checks passed. Mark completed steps as - [x] and leave only pending work, such as the Shield D-pad smoke gate, unchecked. This prevents agents from treating completed work as unfinished.

Also applies to: 94-147, 162-269, 282-326, 337-391

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-08-04-pr-164-review-remediation.md` around lines
33 - 82, Update the remediation plan checkboxes for all completed
implementation, test, validation, and commit steps across the referenced
sections from “- [ ]” to “- [x]”. Leave only genuinely pending work, such as the
Shield D-pad smoke gate, unchecked so agents do not repeat completed tasks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt`:
- Around line 37-48: Extend TvDetailReturnFocusStateTest around
beginHomeDetailReturnRetryIfHome with a Home-return case using
isHomeDetailReturn = true and needsRetry = true, asserting the request ID
increments and fallbackPending becomes true while retry remains active. Also add
the needsRetry = false Home-return case if the helper’s contract clears state
immediately, preserving the existing non-home coverage.

In `@docs/superpowers/plans/2026-08-04-pr-164-review-remediation.md`:
- Around line 33-82: Update the remediation plan checkboxes for all completed
implementation, test, validation, and commit steps across the referenced
sections from “- [ ]” to “- [x]”. Leave only genuinely pending work, such as the
Shield D-pad smoke gate, unchecked so agents do not repeat completed tasks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c2b833e-c368-4c2a-8fee-6d99c9f9816f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d30fac and 901a92c.

📒 Files selected for processing (11)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridge.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusState.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarFocusRoutingTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridgeTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/shell/TvDetailReturnFocusStateTest.kt
  • docs/superpowers/plans/2026-08-04-pr-164-review-remediation.md
  • docs/superpowers/specs/2026-08-04-pr-164-review-remediation-design.md
🚧 Files skipped from review as they are similar to previous changes (7)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridgeTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsFocusBridge.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarFocusRoutingTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/calendar/TvCalendarScreen.kt

@RXWatcher

Copy link
Copy Markdown
Contributor Author

Fixed both follow-up nitpicks in 9ee61dbb:

  • added Home-return coverage for both retry-required and immediate-success branches
  • marked completed remediation-plan implementation and verification steps as complete

Validation: ./gradlew :androidTvApp:testDebugUnitTest :androidTvApp:assembleDebug (BUILD SUCCESSFUL). The same patch is propagated to stacked PR #167 as ca356792.

@RXWatcher

Copy link
Copy Markdown
Contributor Author

Closing as superseded — everything here is already on main.

Checked against main @ b52eb87:

  • the branch is 108 commits behind main and 1 ahead
  • that one commit (9ee61dbb test(tv): cover Home detail retry branches) cherry-picks to an empty diff — TvDetailReturnFocusStateTest.kt is byte-identical on main
  • TvDetailReturnFocusState.kt and TvMediaRow.kt are identical to main
  • TvRecommendationsFocusBridge.kt and TvMainShell.kt differ only because main has newer commits touching them; zero commits from this branch are missing upstream

So the focus-restoration work landed through other PRs, and rebasing 108 commits of already-merged history would gain nothing.

Reopen or re-cut from current main if any of the behaviour turns out to be missing in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant