Skip to content

fix(playwright): fix JSON parser and binary resolution - #215

Merged
pszymkowiak merged 1 commit into
rtk-ai:masterfrom
edsai:fix/playwright-parser
Feb 20, 2026
Merged

pszymkowiak merged 1 commit into
rtk-ai:masterfrom
edsai:fix/playwright-parser

Conversation

@edsai

@edsai edsai commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Fixes three bugs that cause rtk playwright test to fall through to passthrough mode (Tier 3) instead of parsing JSON output (Tier 1):

1. JSON struct mismatch

The parser expected suites[].tests[] but Playwright's JSON reporter outputs suites[].specs[].tests[].results[]. Added the missing PlaywrightSpec intermediate struct, use spec.ok for failure detection, and changed error from Option<String> to errors: Vec<PlaywrightError> to match the array format Playwright emits.

2. Float duration

Playwright emits stats.duration as a float (e.g. 3519.7039999999997). The struct had u64, causing deserialization to fail. Changed to f64.

3. pyenv shim collision

which playwright can resolve to a pyenv shim (Python's playwright package), which doesn't have a test subcommand. This causes the spawned process to error out before producing any JSON. Fixed by always resolving through the detected package manager (npx/pnpm exec/yarn exec) instead of which.

Also strips any user-supplied --reporter flags so they don't conflict with the forced --reporter=json.

Tested against real Playwright test suites — parser now reliably hits Tier 1 (full JSON parse).

Three bugs fixed:

1. JSON struct mismatch: The parser expected `suites[].tests[]` but
   Playwright's JSON reporter outputs `suites[].specs[].tests[]`.
   Added PlaywrightSpec layer, use `spec.ok` for failure detection,
   and `errors: Vec<PlaywrightError>` (array, not Option).

2. Float duration: Playwright emits `duration` as f64, not u64.
   Changed struct field type to avoid deserialization failures.

3. pyenv shim collision: `which playwright` can resolve to a pyenv
   shim (Python's playwright) which lacks a `test` subcommand.
   Bypass `which` entirely and resolve through the detected package
   manager (npx/pnpm/yarn).

Also strips user-supplied `--reporter` flags to avoid conflicts with
the forced `--reporter=json`.
@pszymkowiak

Copy link
Copy Markdown
Collaborator

LGTM — tested locally on the branch, all good.

  • 398 tests pass, no conflicts with master
  • 82/83 smoke tests pass (1 false positive: test script hardcodes expected test count)
  • 23 commands tested manually: git status/log/diff/branch, ls, read, find, grep, gh pr/issue list, deps, env, summary, err, test, gain, cargo build, tsc/lint/vitest/docker/playwright help
    — zero regressions
  • rtk playwright test without a Playwright project: falls back cleanly to passthrough (no crash)
  • All 3 fixes are solid: JSON struct matches real Playwright output (suites→specs→tests→results), float duration handled, pyenv shim collision avoided
  • Good test coverage added: float duration, failure with error messages, nested suites

@pszymkowiak
pszymkowiak merged commit 461856c into rtk-ai:master Feb 20, 2026
heAdz0r added a commit to heAdz0r/rtk that referenced this pull request Feb 28, 2026
Upstream 0.22.2 sync (all previously missing fixes verified applied):
- fix(lint): propagate linter exit code (rtk-ai#207) — CI false-green fix
- feat: add rtk wc command for compact word/line/byte counts (rtk-ai#175)
- fix(playwright): JSON parser (specs layer) + binary resolution (rtk-ai#215)
- fix(grep): propagate rg exit codes 1/2 (rtk-ai#227)
- fix(git): branch creation not swallowed by list mode (rtk-ai#194)
- fix(git): support multiple -m flags in git commit (rtk-ai#202)
- fix(grep): BRE \| translation + strip -r flag (rtk-ai#206)
- fix(gh): smart markdown body filter for issue/pr view (rtk-ai#214)
- fix(gh): gh run view --log-failed flag passthrough (rtk-ai#159)
- feat(docker): docker compose support (rtk-ai#110)
- feat: hook audit mode (rtk-ai#151)
- feat: tee raw output to file (rtk-ai#134)

Version bump: 0.21.1-fork.19 → 0.22.2-fork.1

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
Three bugs fixed:

1. JSON struct mismatch: The parser expected `suites[].tests[]` but
   Playwright's JSON reporter outputs `suites[].specs[].tests[]`.
   Added PlaywrightSpec layer, use `spec.ok` for failure detection,
   and `errors: Vec<PlaywrightError>` (array, not Option).

2. Float duration: Playwright emits `duration` as f64, not u64.
   Changed struct field type to avoid deserialization failures.

3. pyenv shim collision: `which playwright` can resolve to a pyenv
   shim (Python's playwright) which lacks a `test` subcommand.
   Bypass `which` entirely and resolve through the detected package
   manager (npx/pnpm/yarn).

Also strips user-supplied `--reporter` flags to avoid conflicts with
the forced `--reporter=json`.
thehoff added a commit to thehoff/contextcrawler that referenced this pull request Jul 14, 2026
…es (rtk-ai#212-rtk-ai#218, rtk-ai#230)

Shell-parsing / permission-gate hardening cluster, authored by the codex
(gpt-5.6) worker in an isolated lane:

- rtk-ai#212 deny/allow now match the RESOLVED command word (after env
  assignments, redirections, shell prefixes), not the textual segment.
- rtk-ai#213 command-substitution attestation: a substitution supplying the
  command word / unquoted option tokens, opaque interpreter payloads,
  background-in-substitution and quoted safe-flag evasions now Ask.
- rtk-ai#214/rtk-ai#230 reader->network->interpreter and param-expansion /
  input-redirect compositions downgrade to Ask (taint).
- rtk-ai#215 wildcard-free allow rules require token equality (no prefix).
- rtk-ai#216 unreadable/shadowed policy files fail closed.
- rtk-ai#217 lexer grammar: ANSI-C $'...', backslash-newline, |&, grouped
  pipelines, arithmetic-exec, env-assignment redirects, persistent exec
  redirection.
- rtk-ai#218 lexer DoS: iterative substitution parse with depth/size/byte caps.

Refs: rtk-ai#212 rtk-ai#213 rtk-ai#214 rtk-ai#215 rtk-ai#216 rtk-ai#217 rtk-ai#218 rtk-ai#230

Co-Authored-By: Codex (gpt-5.6-sol) <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K3SAimSBwPUp4MkRXaYXSU
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.

2 participants