Repository navigation
fix(screenshot-diff): reject string values for captureBaseline/captureCurrent - #1385
Merged
Merged
Conversation
…eCurrent z.coerce.boolean() is JS truthiness, so the string "false" parsed to true and a caller that declined a live capture got one. Use z.boolean() like every other boolean param in the catalogue. Closes #811
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
latekvo
pushed a commit
that referenced
this pull request
Oct 22, 2026
> [!NOTE] > **AI-generated, not reviewed by a human.** This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it. ## Summary Fixes #1538. `view-network-request-details` declared `includeBody` with `z.coerce.boolean()`, which uses JS truthiness, so an MCP or HTTP caller sending `"includeBody": "false"` (or `"0"`) got the response body anyway, with no sign the value was ignored. Declare it as a plain `z.boolean()`, the same change #1385 makes for `captureBaseline`/`captureCurrent` in `screenshot-diff`. A string value is now rejected as `invalid_type` on `includeBody` instead of being silently turned into `true`. Booleans and the `true` default are unchanged. The CLI already maps `--includeBody false` to a real boolean, so it is not affected. Add regressions in `chromium-network.test.ts`: string values (`"false"`, `"0"`, `"true"`) are rejected, booleans are accepted as given. No docs update is needed: the tools reference does not describe this parameter. ## Testing - New tests: **3 failed / 2 passed before** the fix, **all passed after**. - `npx vitest run test/chromium-network.test.ts test/network` (in `packages/tool-server`): 4 files, **295 passed** - `npm run build` - `npm run typecheck:tests --workspaces --if-present` - `npx eslint` (with `NODE_OPTIONS=--max-old-space-size=2600`, the default heap ran out in the container) and `npx prettier --check` on the two changed files: clean Container note: dependencies were installed with `npm ci --ignore-scripts`, because the `tree-sitter` native build fails under Node 24 in the test container. No live-device testing was performed.
Member
Author
|
Makes sense, the test added is minimal and really shows the issue |
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.
Closes #811
captureBaseline/captureCurrentusedz.coerce.boolean(), which is JS truthiness: the string"false"parsed totrue, so a caller that declined a live capture got one. They now use plainz.boolean(), like the other plain boolean params, so a string value fails validation with a clearexpected boolean, received stringerror.No docs update needed.
Verification
Probe drives
screenshot-diffthrough the realRegistry.invokeToolpath (safeParse ->services()-> resolve -> execute) on builtdist/, with two real PNGs and no device (udidemulator-5554, no SimulatorServer blueprint registered).Before (fix reverted, rebuilt):
After:
Schema-level (
zodSchema.safeParse+services()): before,"false"/"0"->trueandservices=["simulatorServer"]; after,invalid_type. Real booleans unchanged both ways.Checks:
npx tsc --buildexit 0; vitesttool-server(screenshot-diff-tool, tool-input-schema-contract, flows/flow-composition) 237/237,argent-cliflag-parser 67/67,argent-tools-clientfile-inputs 24/24; prettier --check and eslint clean on the touched file. The CLI path is unaffected (flag-parser already mapsfalse/0to a boolean).Not included: the lower-impact twin
includeBodyinnetwork/network-request.tsstill coerces.