test(preview): restore cached image tests under jsdom - #1652
Merged
Conversation
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.
Codex ReviewVerdict: mergeable No actionable findings. Summary: Static inspection found no concrete merge-blocking defect in the pull-request changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:Blobcannot be passed to Node'sResponse, so image tests never reached a ready<img>, and the architecture test still expected a linearconversationItems.map.Proposed change
fetchwith the{ ok, status, blob() }shape the cache actually reads, instead ofnew Response(new Blob(...)).blob:URLs for in-budget images.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
installAuthorizedvalues and ignores them in the UI; this PR does not touch that.Acceptance criteria and validation
All checks below ran after the last material edit:
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_viewmodule tests ->npm run test:module -- project_files_view-> 6 files passed.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.npx eslinton the 7 touched files -> no issues.git diff --check-> passed.Full portable
npm testwas 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 expectingblob:URLs for images under the 64 MiB cache budget.