fix(ui): apply result-path truncation when building per-test artifact URLs - #280
Merged
Conversation
… 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.
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
In the run-detail test modal,
test.responseandtest.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].txt404s, while…EXISTING_CONTRACT…benchmark_240M].txtloads.Root cause
At upload time,
sanitizeResultPath(pkg/executor/results.go) truncates+hashes any result-path component longer thanmaxResultPathComponent(200) so per-test directory names stay under the filesystem / S3 key-length limit: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: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
ui/src/config/resultPath.ts—sanitizeResultPath(), a faithful mirror of the Go implementation (per-/component, byte-based).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.@noble/hashesfor a byte-identical SHA-256 (no hashing lib existed).Tests
Bootstraps vitest (
npm test) withui/src/config/resultPath.test.ts, mirroringpkg/executor/sanitize_path_test.goplus 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 -band eslint are clean.Keep in sync
MAX_RESULT_PATH_COMPONENT(TS) must equalmaxResultPathComponent(Go). Both are commented to that effect.