You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Brian Westphal
authored and
Brian Westphal
committed
Serve demo SVG bytes so the live-rendered view stops 404ing the E2E suite (GB-947)
GB-932 renders SVGs as live `<img src="/api/image/:fileId/:side">`, but the synthetic demo file `src/assets/icons.min.svg` exists nowhere on disk or in git, so both sides returned 404. `svg_view_mode` is a server-persisted preference and the E2E suite shares one demo server, so once a spec toggled an SVG to the Rendered view, every later load of the giant SVG (navigation, stability, themes, large-file-perf) emitted a console 404 — which the new failOnPageError fixture then correctly failed on. The fixture didn't cause the breakage; it exposed a real 404.
The difftool blob store already solves the same shape of problem — image bytes for a DB-seeded review with no git refs or working tree to re-read. Generalize it from difftool-only to that whole class:
- Rename `src/difftool/blob-store.ts` to `src/git/image-blobs.ts` with neutral names (`writeImageBlob` / `readImageBlob` / `clearImageBlobs`), since it now backs demo reviews too, not just difftool sessions.
- Add `resolveImageSide()` in the image route: read git / disk first, then fall back to the blob store (used outright for difftool, as a fallback for demo). Both the `:side` and `metadata` routes go through it.
- Seed each demo SVG's old/new bytes into the blob store at setup time, reconstructed from the diff hunks (old drops adds, new drops removes).
Then fix a second failure the 404 had been masking: the large-file-perf specs assert the SVG *code* view (giant-line truncation), but relied on the 'code' default that no longer holds once an earlier spec persists 'rendered' on the shared server. Add `ensureCodeView()` to pin the text view regardless of prior state.
Verified with the CI-parity Docker E2E suite: 149 passed, 0 failed (was 16 failed). Unit tests and the difftool integration suite still pass after the rename.
|`api/image.ts`| Image diff: `/image/:fileId/metadata` and `/image/:fileId/:side` with SVG rasterization. For a difftool review (doc 19) the bytes come from the persisted blob store (`src/difftool/blob-store.ts`) instead of git refs / disk — a difftool session has neither (GB-863). |
102
+
|`api/image.ts`| Image diff: `/image/:fileId/metadata` and `/image/:fileId/:side`; SVGs served as raw `image/svg+xml` for live `<img>` render. `resolveImageSide()` reads from git refs / disk, then falls back to the persisted blob store (`src/git/image-blobs.ts`) — used outright for a difftool review (doc 19, no git/working tree, GB-863) and as a fallback for demo SVGs seeded into the DB with no on-disk file (GB-947). |
0 commit comments