Skip to content

Screenshots from long attempts for Tester: attempt getScreenshot writes a JPEG file - #1741

Draft
Matt Kleinsmith (MattKleinsmith) wants to merge 1 commit into
mainfrom
mattk/attempt-screenshot-output-file
Draft

Matt Kleinsmith (MattKleinsmith) wants to merge 1 commit into
mainfrom
mattk/attempt-screenshot-output-file

Conversation

@MattKleinsmith

Copy link
Copy Markdown
Contributor

Overview of Problem

Tester can't get a screenshot from a long test: qawolf attempt inspect refuses traces over 75 MiB.

Overview of Changes

Important

CI fails at install until @qawolf/api-contracts 0.160.0 is on npm. This PR pins it ahead of time, and 0.160.0 is a prediction: it is the version qawolf/platform#39736 sets today. If the published version differs, the pin changes to match.

To unblock: qawolf/platform#39736 merges and ships, the contracts package publishes, then bun.lock here is refreshed (left at 0.154.0 for now) and the checks rerun.

qawolf attempt getScreenshot --output-file <path> writes one recorded frame of any attempt as a JPEG file.

qawolf --json attempt getScreenshot --attempt-id <id> --index -1 --output-file last.jpeg
{"capturedAt":"…","index":41,"pageId":"page@1","total":42,"outputFile":"last.jpeg"}
  • Where the command comes from: it is generated from the new attempt.getScreenshot call in qawolf/platform#39736, which reads one frame from the trace by byte range on the server. The CLI downloads no trace.
  • Generic, not specific: any generated command whose answer has a top-level imageJpegBase64 gets --output-file, so the next call that returns an image needs no CLI change. Today that is only attempt getScreenshot. A hand-written command would have repeated the generated flags and validation.
  • Like attempt inspect --screenshot --output-file: it refuses an existing file before calling the API and writes with mode 600. It also refuses an image that does not start like a JPEG, reusing the runner screenshot check. Without --output-file, the answer prints whole.
  • The skill's Output section tells agents to pass --output-file rather than read or decode the base64.
Also in the 0.154.0 to 0.160.0 bump
  • New deployment findLastDeployedCommit and build create --app-id; build requestUpload lists Windows .msi and Mac .zip builds; promotion askQuestion and promotion reportDecision are marked deprecated.
  • build upload's local file check comes from the contract, so it now names .msi and Mac .zip too; upload.test.ts matches the longer list.
  • The flag loop moved unchanged from publicApi/index.ts to publicApi/specOptions.ts, to keep index.ts under the 150-line limit.

Testing

bun run typecheck
bun run lint
bun run format:check
bun run knip
bun run test

All pass locally (3,023 tests) against 0.160.0 built from the head of qawolf/platform#39736 and placed in node_modules; nothing local is committed.

  • handle.imageOutputFile.test.ts, with faked API answers: writes the decoded bytes and prints the answer without the base64; refuses an existing file before any API call; writes nothing for an image that is not a JPEG; prints the whole answer when no file is asked for.
  • index.imageOutputFile.test.ts: only commands whose answer carries an image get the flag.
  • Real process, against a local stand-in API: the CLI sent {"attemptId": …, "index": -1}, wrote a 68,136-byte, 1280x1280 JPEG byte-identical to the served one with mode 600, and on a second run refused the existing file without calling the API.

Not proven yet: a call to a real deployment of the new endpoint. The next check is to run the command on a long attempt once qawolf/platform#39736 is in production.

Checklist

  • Changes follow the code style of this project
  • Self-review completed
  • Tests added/updated (or not applicable)
  • No breaking changes (or described below)

Bump @qawolf/api-contracts to 0.160.0, the version qawolf/platform#39736
is predicted to publish, which generates `qawolf attempt getScreenshot`.
That call reads one recorded frame from an attempt's trace by byte range,
so it works on traces too large for `qawolf attempt inspect`.

Any generated command whose answer carries `imageJpegBase64` now takes
`--output-file <path>`: it writes the JPEG there, refusing to overwrite,
and prints the rest of the answer without the base64.

bun.lock is left at 0.154.0 until 0.160.0 is on the registry.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant