Virtualize Library gallery for large catalogs

Merged
TE
2mo ago
+378-79

Summary

Implements issue #28, Track B: virtualize the Library gallery for large Source-backed catalogs.

  • Keep only visible/near-visible grid cards alive and requesting thumbnails.
  • Reuse cards as the scroll window moves; clear images and generation-guard thumbnail completions on reuse.
  • Delay thumbnail starts briefly so scroll churn can be cancelled before file/provider access begins.
  • Preserve grid selection, double-click apply, hover-peek hit testing, filters/fuzzy search/list-grid switching, and add arrow/Home/End/Return keyboard navigation.
  • Leave the existing 64 MB / 64-entry thumbnail cache budget in SceneLibraryController intact.
  • Preserve the current grid scroll offset across ordinary data refreshes where AppKit can keep the offset valid.
  • Add production-layout synthetic coverage at 1,000 and 4,000 items without opening or decoding media; verify top/middle/bottom viewport windows remain bounded below 64 candidates.

Scope

Gallery scaling only. Library 2 storage semantics are unchanged.

Verification

On macOS 15 / Xcode 16.4, the corrected head passes:

  • full Idlesse app + saver build
  • settings UI smoke test
  • existing decoder, scene, recovery, audio, comfort, and Library suites
  • new LibraryGridVirtualizationTests with 1k/4k bounded-window, deep-scroll, resize, and hover geometry coverage

The workflow still reports failure in its final bundle-verification step because current main has the same pre-existing app-seal failure. build.sh signs Idlesse.app, then writes Contents/Resources/build-stamp.txt; strict codesign --verify consequently reports a sealed resource is missing or invalid. The main run for base SHA 46ea41b9 fails the same step after its build/smoke/tests pass. Left outside Track B.

Adjacent observations

  • Hover-peek still opens backing items immediately as the pointer crosses entries; issue #28 already calls out dwell/debounce as a smaller follow-up.
  • Once a thumbnail decode has crossed the gallery’s delayed-start boundary, the current controller API has no producer cancellation token. Reuse drops stale completions and the virtual window bounds starts; deeper AVAsset/ImageIO cancellation can be a separate cleanup.
  • build.sh invalidates the app seal by writing build-stamp.txt after signing, as described above.

Refs #28

Signed-off-by: 🧶 Mochi