Skip to content

Person-detail metadata auto-refresh + tvOS cascade freeze fix - #35

Merged
Quick104 merged 2 commits into
mainfrom
feature/tvos-person-metadata-refresh
Jul 1, 2026
Merged

Quick104 merged 2 commits into
mainfrom
feature/tvos-person-metadata-refresh

Conversation

@Quick104

@Quick104 Quick104 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Person-detail metadata auto-refresh (iOS + tvOS). When a person page opens with incomplete metadata (missing bio / photo / birth date), queue a server-side refresh (POST /api/v1/people/{id}/refresh) and poll GET /api/v1/people/{id} every 3s for up to 120s, swapping in the enriched record when it lands. A "Loading metadata" indicator shows while in flight; the poll task is cancelled on disappear so it can't outlive the route.
  • tvOS episode rail highlights + scrolls to the next-up episode via currentContentId on series/season detail.
  • tvOS cascade-selector freeze fix. The Skyline top-menu cascade animated the flyout alignment padding on a live GeometryReader→preference value (flyoutTopPadding), which re-armed a SwiftUI animation every layout pass — AnimatorState.combine accumulated without bound, the CoreAnimation transaction never committed, and the app hard-froze on the way back to Home (repro: item detail → cast member → back → back; Home never paints). Now animates on the discrete flyoutAnchorId. Root-caused by sampling the hung simulator process (main thread pegged in AnimatorState.combine).
  • Adds TVFocus debug logging across a few detail/navigation components.

Server dependency

The metadata refresh assumes the server exposes POST /api/v1/people/{id}/refresh returning PersonRefreshQueuedResponse. Confirm it's implemented/deployed before relying on the feature.

Testing

  • ✅ Builds: SiloTV (tvOS sim) and Silo (iOS sim) both succeed.
  • ✅ Cascade freeze fix verified on the tvOS simulator — item detail → actor → back → back now returns to Home instead of locking up.
  • ⚠️ Person metadata refresh not yet validated end-to-end against a live server returning incomplete metadata.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added automatic metadata refresh for person details when key info is missing, with an on-screen refresh indicator.
    • Improved tvOS focus behavior so the currently relevant episode is highlighted and centered more consistently.
  • Bug Fixes
    • Reduced accidental tvOS flyout re-animation caused by layout jitter.
    • Added additional tvOS focus logging to help diagnose navigation issues without changing user-facing behavior.

Quick104 and others added 2 commits June 30, 2026 21:26
TVCascadeSelector's two-level panel animated the flyout alignment
padding on `flyoutTopPadding`, a value derived from live
GeometryReader -> preference measurements. Animating on a measured value
let sub-pixel re-measure jitter re-arm the animation every layout pass,
so AnimatorState.combine accumulated animations without bound, the
CoreAnimation transaction never committed, and the app hard-froze (the
next screen never painted, so it looked stuck on the previous page).

Repro: item detail -> cast member -> back -> back; Home never appears.
Only bites a library type with >=2 libraries (the two-level panel).
Diagnosed by sampling the hung simulator process: the main thread was
pegged in AnimatableFrameAttribute.updateValue -> AnimatorState.combine.

Animate the flyout follow on the discrete `flyoutAnchorId` instead, so
the padding eases only when focus moves to a new library row, never on
geometry re-measure.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
When a person page opens with incomplete metadata (missing bio, photo, or
birth date), queue a server-side refresh (POST /api/v1/people/{id}/refresh)
and poll GET /api/v1/people/{id} every 3s for up to 120s, swapping in the
enriched record when it lands. A "Loading metadata" indicator shows while
the refresh is in flight; the poll task is cancelled on disappear so it
never outlives the route.

Also included:
- tvOS episode rail highlights/scrolls to the next-up episode via
  currentContentId on series/season detail.
- TVFocus debug logging across a few detail/navigation components.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 723058f5-a870-489f-86c7-0ee9e4d97193

📥 Commits

Reviewing files that changed from the base of the PR and between 1a24098 and c72d77c.

📒 Files selected for processing (10)
  • iosApp/iosApp/Components/MediaRow.swift
  • iosApp/iosApp/Networking/ContinuumAPI.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Screens/People/PersonDetailView.swift
  • iosApp/iosApp/tvOS/Navigation/TVCascadeSelector.swift
  • iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeriesDetailView.swift

📝 Walkthrough

Walkthrough

Adds a person metadata background auto-refresh feature: a new refreshPerson API endpoint, response model, ViewModel polling logic, and a loading indicator UI. Separately, adds os.Logger-based debug logging for tvOS focus events in several views, changes a flyout animation trigger, and passes a current-episode identifier into the episode rail.

Changes

Person Metadata Auto-Refresh

Layer / File(s) Summary
Refresh-person endpoint and model
iosApp/iosApp/Networking/Models.swift, iosApp/iosApp/Networking/ContinuumAPI.swift
Adds PersonRefreshQueuedResponse and a refreshPerson(id:) typed endpoint, with legacy path dispatching to it.
Auto-refresh state and polling loop
iosApp/iosApp/Screens/People/PersonDetailView.swift
PersonDetailViewModel tracks isRefreshingMetadata, schedules/stops a background task that calls refreshPerson and polls person until metadata is complete or a deadline elapses; adds Person.isMetadataIncomplete.
View wiring and refresh indicator
iosApp/iosApp/Screens/People/PersonDetailView.swift
.onAppear/.onDisappear resume/stop the refresh task; adds PersonMetadataRefreshIndicator shown in tvOS and iOS metadata sections while refreshing.

tvOS Focus Tracing and Navigation Tweaks

Layer / File(s) Summary
MediaRow focus logging
iosApp/iosApp/Components/MediaRow.swift
Adds tvOS-only Logger and debug logs for focus changes and applied focus requests.
TVTopMenuBar focus logging
iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift
Adds a shared logger and debug logs across focusRequest/focusedItem changes, requestMenuFocus(), and handleExitPress().
TVItemDetailView lifecycle logging
iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift
Adds a focusLogger and onAppear/onDisappear debug logs with contentId and navigation path depth.
Episode rail current-episode highlighting
iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift, TVSeasonDetailView.swift, TVSeriesDetailView.swift
Documents and passes currentContentId (from nextUpEpisode?.contentId) so the rail highlights and focuses the current episode.
Cascade flyout animation fix
iosApp/iosApp/tvOS/Navigation/TVCascadeSelector.swift
Changes the animation trigger from flyoutTopPadding to flyoutAnchorId to avoid re-arming from layout re-measurement.

Sequence Diagram(s)

sequenceDiagram
  participant PersonDetailView
  participant PersonDetailViewModel
  participant ContinuumAPI
  participant PersonMetadataRefreshIndicator

  PersonDetailView->>PersonDetailViewModel: onAppear resumeMetadataRefreshIfNeeded()
  PersonDetailViewModel->>PersonDetailViewModel: scheduleMetadataRefreshIfNeeded(for: person)
  alt metadata incomplete and not already scheduled
    PersonDetailViewModel->>ContinuumAPI: refreshPerson(id:)
    ContinuumAPI-->>PersonDetailViewModel: PersonRefreshQueuedResponse
    PersonDetailViewModel->>PersonMetadataRefreshIndicator: isRefreshingMetadata = true
    loop poll until complete or deadline
      PersonDetailViewModel->>PersonDetailViewModel: check person.isMetadataIncomplete
    end
    PersonDetailViewModel->>PersonMetadataRefreshIndicator: isRefreshingMetadata = false
  end
  PersonDetailView->>PersonDetailViewModel: onDisappear stopMetadataRefresh()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Silo-Server/silo-apple#6: Both PRs modify the flyout animation logic in TVCascadeSelector.swift, with this PR changing the animation trigger from flyoutTopPadding to flyoutAnchorId.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/tvos-person-metadata-refresh

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

@Quick104
Quick104 merged commit 1f4cbdb into main Jul 1, 2026
1 check was pending
@Quick104
Quick104 deleted the feature/tvos-person-metadata-refresh branch July 1, 2026 01:40

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c72d77ca7b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +160 to +163
defer {
let wasCancelled = Task.isCancelled
metadataRefreshTask = nil
isRefreshingMetadata = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard against stale refresh tasks clearing new state

When a person page disappears and quickly appears again, stopMetadataRefresh() cancels the old poll and clears the handle, allowing scheduleMetadataRefreshIfNeeded to start a replacement before the canceled task's defer runs. This defer then unconditionally sets metadataRefreshTask = nil and isRefreshingMetadata = false, orphaning the replacement poll so later onDisappear won't cancel it and the UI hides the in-flight refresh while it can still mutate the view model. Use a generation/task identity check before clearing shared refresh state.

Useful? React with 👍 / 👎.

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