Skip to content

test(preview): restore cached image tests under jsdom - #1652

Merged
ewen-poch merged 1 commit into
mainfrom
test/cached-preview-image-jsdom
Aug 24, 2026
Merged

test(preview): restore cached image tests under jsdom#1652
ewen-poch merged 1 commit into
mainfrom
test/cached-preview-image-jsdom

Conversation

@ewen-poch

Copy link
Copy Markdown
Member

Problem

#1643 (fix(host-sdk)!: camel-case public result fields) and #1648 (fix(settings): align package install controls with runtime ownership) merged with red PR Gate module shards. The failures were not from those diffs:

Proposed change

  • Stub fetch with the { ok, status, blob() } shape the cache actually reads, instead of new Response(new Blob(...)).
  • Wait for thumbnails to settle and assert cached blob: URLs for in-budget images.
  • Pin transcriptWindow.entries.map(({ item, itemIndex }) as the scroller render loop.

No production code changes.

Scope and non-goals

Does not change Host SDK camelCase, package-install authorization UI, image cache eviction, or transcript windowing.

Compatibility notes

Acceptance criteria and validation

All checks below ran after the last material edit:

  • Cached image and transcript architecture regressions -> npm test -- src/renderer/src/pages/workspace/preview-image-content.test.tsx src/renderer/src/pages/workspace/artifact-preview.interaction.test.tsx src/renderer/src/pages/workspace/previews/PreviewFileContent.test.tsx src/renderer/src/pages/workspace/workspace-components.test.tsx src/renderer/src/components/global-search/GlobalSearchDialog.test.tsx src/renderer/src/pages/workspace/ProjectFilesView.test.tsx src/renderer/src/stores/settings-store.architecture.test.ts -> 7 files, 206 tests passed.
  • project_files_view module tests -> npm run test:module -- project_files_view -> 6 files passed.
  • External PR owner tests (unchanged by this branch) -> npm test -- src/main/host-sdk/delegate-contract.test.ts src/main/host-sdk/help.test.ts src/renderer/src/pages/settings/RuntimesPanel.render.test.tsx -> 3 files, 51 tests passed.
  • Lint of changed files -> npx eslint on the 7 touched files -> no issues.
  • Diff hygiene -> git diff --check -> passed.

Full portable npm test was not run locally; PR Gate remains authoritative.

Review focus

Please focus on the fetch stub matching useCachedPreviewImage (ok / blob() only) and the thumbnail assertions now expecting blob: URLs for images under the 64 MiB cache budget.

The renderer image cache fetches managed preview URLs and copies bytes
into blob URLs. Tests were constructing `new Response(new Blob(...))`,
which throws in Node because jsdom's Blob has no stream(). That made
#1643/#1648 module shards fail after the cache landed, even though
those PRs did not change preview loading.

Stub the fetch contract the cache actually reads, wait for thumbnails
to settle, and pin the windowed transcript map in the architecture
guard.
@ewen-poch
ewen-poch merged commit 5d5e357 into main Aug 24, 2026
22 checks passed
@ewen-poch
ewen-poch deleted the test/cached-preview-image-jsdom branch August 24, 2026 08:28
@github-actions

Copy link
Copy Markdown

Codex Review

Verdict: mergeable

No actionable findings.

Summary: Static inspection found no concrete merge-blocking defect in the pull-request changes.

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