fix(ui): open S3-hosted files via redirect instead of the JSON envelope - #277
Merged
Conversation
In S3 + API mode the /files endpoint returns a {"url": <presigned>} JSON
envelope by default (for programmatic fetch), and only 302-redirects to the
presigned URL when ?redirect=true is set. Several direct-navigation links built
their href/src straight from getDataUrl, so in S3 mode they opened a page
showing the JSON envelope instead of the file:
- EEST Build Metadata (suite Source tab): "Open fill report", "View fixture
index (JSON)" and the embedded fill-report iframe.
- State-actor config files: the "Open raw" link.
FilesPanel already worked around this by inlining `?redirect=true` in S3 mode.
Extract that into a shared getNavigableDataUrl() helper and route all
direct-navigation URLs through it, so the browser follows the 302 to the
presigned URL and loads the actual file. Local mode serves bytes directly and
is unaffected (no redirect appended).
skylenet
added a commit
that referenced
this pull request
Jul 9, 2026
…278) ## Problem Follow-up to #277. With the report links now redirecting to the presigned S3 URL, the EEST fill report opened/embedded **unstyled**. The pytest-html report links its stylesheet **relatively**: ```html <link href="assets/style.css" rel="stylesheet" type="text/css"/> ``` When the report loads from a presigned S3 URL (`…/report_fill.html?X-Amz-Signature=…`), the browser resolves `assets/style.css` to an **unsigned** S3 URL → **403** on the private bucket → no styling. (Verified against a real report: it's pytest-html, one inline `<script>`, and a single external asset `assets/style.css`.) ## Fix Add `--self-contained-html` to `PYTEST_ADDOPTS` for the fill run. pytest-html then **inlines the CSS** into `report_fill.html`, so the report is a single self-contained file with **no `assets/` references** and renders fully styled from any URL — including the presigned S3 URL and the iframe embed. EEST's filler plugin only sets `htmlpath` (`.meta/report_fill.html`) and does **not** set `self_contained_html`, so the flag is honored (confirmed in `execution-specs` `filler.py`). The JS is already inline, so nothing else needs bundling. ## Why this over a server-side proxy The alternative — streaming the report + its assets through the API so relative URLs resolve on the API origin — would serve our HTML **same-origin as the API**, giving up the origin isolation the presigned S3 URL provides (the report can't touch API cookies from the S3 origin). Fixing it at generation time keeps that isolation, needs no new route, and removes the sub-resource entirely instead of proxying it. ## Scope - Applies to **newly filled** fixtures. Existing reports already on S3 keep their relative `assets/` link until their next build re-generates the report. - No behavior change for the JSON sidecars or fixtures — only the pytest-html report output format. `go build` + golangci-lint (`--new-from-rev=origin/master`) clean.
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
On the suite details Source tab, the EEST Build Metadata "Fill report" buttons (and the embedded report iframe) opened a page showing a raw JSON payload instead of the report, when the API is enabled with files on S3:
{"url":"https://benchmarkoor-results.….r2.cloudflarestorage.com/…/report_fill.html?X-Amz-Algorithm=…&X-Amz-Signature=…"}Root cause
In S3 + API mode the
/api/v1/files/...endpoint returns a{"url": <presigned>}JSON envelope by default — intended for programmaticfetch(the client parses.urland fetches it). It only 302-redirects to the presigned URL when?redirect=trueis set (added precisely so<a href>/curl -Lwork).Several components built direct-navigation targets straight from
getDataUrl(...), so in S3 mode the browser navigated to the envelope endpoint and rendered the JSON:<iframe>.FilesPanelalready worked around this by inlining?redirect=truein S3 mode — so the fix pattern was already established, just not applied consistently.Fix
Extract the pattern into a shared
getNavigableDataUrl()helper and route all direct-navigation URLs (anchorhref, iframesrc, download links) through it. In S3 + API mode it appends?redirect=trueso the browser follows the 302 to the presigned URL and loads the actual file; local mode serves bytes directly and is untouched (no redirect appended).FilesPanel's two inline copies are de-duplicated onto the helper.Verification
tsc -btypecheck,eslint, and fullvite buildall clean.redirect=truewhenisS3Mode && api.baseUrl).Note: presigned relative assets inside the report HTML are a separate, pre-existing limitation and out of scope — this restores the report itself loading instead of showing JSON.