Repository navigation
Tester reads long attempts: attempt inspect reads traces over 75 MiB by byte range - #1740
Closed
Matt Kleinsmith (MattKleinsmith) wants to merge 6 commits into
Closed
Matt Kleinsmith (MattKleinsmith) wants to merge 6 commits into
Matt Kleinsmith (MattKleinsmith) wants to merge 6 commits into
Conversation
Reads the end of central directory, zip64 records, and the central directory with a few range reads, then reads one entry at a time with CRC-32 checks, a bounded inflate, and a total fetch budget.
The trace projections now read entries through a small archive type with two backings: JSZip for a downloaded trace, unchanged, and the byte-range zip reader for a trace too large to download.
A trace over the download limit used to come back too-large. After the whole-file download stops at the limit, a one-byte range probe learns the size and proves storage honors Range, and the parser then fetches only the directory and the entries the command reads.
Under Bun, cancelling a response body keeps the connection draining the whole object. Each request now aborts its own controller once its body is read or refused. The range reads' shared two-minute deadline starts at the first read, not at the size probe, so the summary's log downloads and the parser import no longer spend it. A partial response longer than the range asked for is unavailable, not too-large.
A timed-out, expired, or missing range read used to look like a corrupt entry, so the trace read as malformed and a screenshot as missing. A failed read now carries its storage status: the trace takes it when an event or stacks file cannot be read, a screenshot or response body reports it, and network files read so far are marked incomplete.
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.
Overview of Problem
qawolf attempt inspectrefuses any trace over 75 MiB, so Tester loses the timeline, actions, snapshots, and screenshots of long attempts, including the "what the test expects" picture from a flow's last pass.Overview of Changes
Traces over 75 MiB are now read by HTTP byte range: the zip's central directory, then only the entries the command needs. On a real 391 MB trace,
--timelinereads 16 MB and one--screenshotreads 16 MB, wheremainreads nothing and answerstoo-large.Traces at or under 75 MiB keep the current single GET and JSZip path, unchanged. Moving small traces to range reads too would save bytes on
--timeline, but it adds round trips where the summary reads most files anyway, and keeping one path untouched keeps every existing test on it. That can be a follow-up once this path has run for a while.How it works
downloadTracestill makes one GET. Over the limit, it cancels the body, sends a 1-byteRangeprobe to learn the size and prove range support, and returns arangedartifact holding a range-reader function. The parser never sees the URL.TraceArchive(names, has, read with a byte limit). JSZip backs it for whole files; a new range-read zip reader inparser/zip/backs it for large ones (zip64, stored and deflate, CRC-32 checked, bounded inflate). Projection code changed only where it touches the archive.too-large.Rangefails the read astoo-large, as today. 401/403, 404, 416, short reads, and timeouts map to the existing statuses, and a failed entry read reports that status rather than calling the trace malformed.Testing
Real check, against a 391,325,377-byte trace from a 3-hour test run in our own workspace, counting bytes from storage:
--timeline: 15,962,949 bytes in 10 range requests (4% of the file),traceStatus: ready.--screenshot ... --output-file: 16,001,521 bytes in 12 range requests; wrote a valid 800x450 JPEG of the run page. The rest is the trace's 14 MB event file and the directory; the image itself is 38 KB.--network(5,038 requests): 32.7 MB; reportsincomplete, because its.networkfile exceeds the existing per-entry limit, as the whole-file path would.main:traceStatus: too-large.Unit tests use generated zips, nothing large committed: ranged and whole-file paths give identical summary, timeline, action, network, request, console, and screenshot output (including on the Playwright 1.64 fixture); a zip64 screenshot round trip; an end-to-end 76 MiB archive through
downloadTraceand the parser with a fake fetch that honorsRange; and each bound (directory too big, too many entries, fetch budget, bad CRC, decompression bomb, impossible sizes, a server ignoringRange, every failure status).bun run typecheck bun run lint bun run format:check bun run knip bun run test bun run buildNot proven yet: how long a large trace takes from Tester's pods. Locally, storage served about 0.5 MB/s, so
--timelinetook 30 seconds; all range reads for one command share one 2-minute deadline that starts at the first range read, so a command that reads more than about 60 MB at that speed would time out.Post-Release Tasks
ai-taskimage installs@qawolf/cli@latestwhen it is built, so Tester gets this from the nextai-taskimage build after the release.Checklist