Skip to content

Persist artwork in a bounded global disk cache - #260

Merged
GLinnik21 merged 2 commits into
mainfrom
feat/global-image-cache
Sep 26, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
feat/global-image-cache

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Revisiting artwork after RAM eviction or restarting the app currently downloads it again. Add a shared disk tier for posters, backdrops, logos, episode stills, avatars and headshots, bounded to 128 MiB / 8,192 files, with atomic writes, stable server/transform keys, stale-while-revalidate refresh and sign-out generation fencing.

Keep main’s scrolling deferral, transient retries and bounded GPU-residency recovery. Bound decoded-upload backlog and share immutable Library key snapshots instead of copying a large catalog on every frame. Add frame-interval/drop counters and a reproducible 1,200-image fixture.

Validation:

  • The original feature build was stress-tested on the TV with 1,200 distinct images: 2,538 warm disk hits and zero image downloads after process restart. The dated evidence explicitly identifies that build, rather than attributing its FPS results to this integration.
  • Regression coverage includes persistence, capacity eviction, corrupt files, refresh/account lifetimes, pending-byte accounting, server repoints and immutable catalog snapshots.
  • On the integrated branch: local make check and the shipping-feature Cargo check passed; CI passed host checks, ARM cross-build/artifact assertions, Linux/macOS simulator builds and launch, Windows syntax, and isolated source-bundle reconstruction.

See docs/image-cache.md and docs/measurements/global-image-cache-2026-09-26.md for policy and measured frame-drop results. Some renderer stalls remain; this does not claim locked 60 FPS.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T17:49:55.863219Z 31685a4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 31685a4dba

ℹ️ 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".

px = img::img_decode_rgba(b.as_ptr(), b.len() as c_int, &mut w, &mut h);
// Only a successfully decoded response may replace an existing image.
if !px.is_null() {
if let Some(k) = &disk { crate::imgcache::write_at(cache_gen, k, &b); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Revalidate the profile grant after fetching artwork

If a profile switch occurs while fetch_built_outcome is in flight, this writes bytes authorized by the old profile because only the account cache generation is checked after the request; token_gen was checked only before network I/O. Since disk keys intentionally omit the token and the cache survives profile switches, the newly active profile can later read artwork it may not be authorized to access. Recheck that the client pointer and token_gen are still current after the fetch and before caching or publishing; the refresh worker has the same check-before-fetch race in refresh.rs.

Useful? React with 👍 / 👎.

@GLinnik21
GLinnik21 merged commit 4effc15 into main Sep 26, 2026
10 checks passed
@GLinnik21
GLinnik21 deleted the feat/global-image-cache branch September 26, 2026 18:10
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