Skip to content

fix(ui): apply result-path truncation when building per-test artifact URLs - #280

Merged
skylenet merged 1 commit into
masterfrom
fix-ui-result-path-404
Jul 10, 2026
Merged

fix(ui): apply result-path truncation when building per-test artifact URLs#280
skylenet merged 1 commit into
masterfrom
fix-ui-result-path-404

Conversation

@skylenet

Copy link
Copy Markdown
Member

Problem

In the run-detail test modal, test.response and test.result-details.json (and other per-test files) 404 for some tests but not others — e.g. this reth run's …NON_EXISTING_ACCOUNT…benchmark_200M].txt 404s, while …EXISTING_CONTRACT…benchmark_240M].txt loads.

Root cause

At upload time, sanitizeResultPath (pkg/executor/results.go) truncates+hashes any result-path component longer than maxResultPathComponent (200) so per-test directory names stay under the filesystem / S3 key-length limit:

component > 200 bytes  →  component[:183] + "-" + hex(sha256(component)[:8])   // exactly 200 chars

So the stored key for a long-named test is not its raw name. The UI builds per-test artifact URLs (runs/{runId}/{testName}/{step}.response, etc.) from the full test name, so:

test name length stored dir UI request result
≤ 200 verbatim full name
> 200 truncated + hashed full name ❌ 404

It's fully deterministic: any test whose name exceeds 200 bytes 404s. Aggregate stats are unaffected (they come from the index DB, not these files).

Fix

  • New ui/src/config/resultPath.tssanitizeResultPath(), a faithful mirror of the Go implementation (per-/ component, byte-based).
  • Applied once in getDataUrl() — the single choke point all data fetches and the navigable/download URLs (getNavigableDataUrl) flow through — so every call site (useTestDetails, FilesPanel, ExecutionsList, TestHeatmap, TestFilesList) is covered without touching each one. Short components (runId, suite hash, step filename) pass through unchanged.
  • Adds @noble/hashes for a byte-identical SHA-256 (no hashing lib existed).

Tests

Bootstraps vitest (npm test) with ui/src/config/resultPath.test.ts, mirroring pkg/executor/sanitize_path_test.go plus the two real EEST names. The 204-char case asserts a golden value cross-checked against the Go output (…-ed95461550ccc1d7), so drift from the backend fails the test. All 7 pass; tsc -b and eslint are clean.

Keep in sync

MAX_RESULT_PATH_COMPONENT (TS) must equal maxResultPathComponent (Go). Both are commented to that effect.

… URLs

Long test names (>200 bytes) have their result directory truncated+hashed at
upload time (sanitizeResultPath, pkg/executor/results.go) to fit the
filesystem/S3 key-length limit — so the stored key is not the raw test name.
The UI builds per-test artifact URLs (test.response, result-details.json,
result-aggregated.json, request files, file lists) from the full test name, so
those long-named tests 404 in the run-detail modal while short-named ones load.

Mirror sanitizeResultPath on the frontend and apply it in getDataUrl — the
single choke point every data fetch (and the navigable/download URLs) flows
through. Short components (runId, suite hash, step filename) are unchanged, so
the run/suite key extraction still works.

Adds @noble/hashes for a byte-identical sha256, and bootstraps vitest with a
unit test whose golden value is cross-checked against the Go sanitizeResultPath.
@skylenet
skylenet merged commit d5101e6 into master Jul 10, 2026
7 checks passed
@skylenet
skylenet deleted the fix-ui-result-path-404 branch July 10, 2026 09:40
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