Repository navigation
fix: parse-failure tracking, Windows tee path, passthrough output loss (#3339) - #3344
Conversation
|
Carried in a local fork build since 2026-08-08 (Windows 11, Git Bash / The tee-hint half fixes a real day-to-day annoyance on Windows: the Still merges cleanly with |
|
Re-verified the passthrough-loss half (#3339 part 3) today:
Two things now stand between this PR and a clean merge:
With the runner commits alone on develop: clippy clean, full suite 3942 passed / 2 failed. Both failures are pre-existing Windows-only baselines. |
|
Rebased this onto current What changed in the rebase:
Verified on Windows 11 / Git Bash (x86_64-pc-windows-gnu):
To adopt it (this replaces the PR head with the rebased commits): git fetch https://github.com/bharvey42/rtk rebase/3344-onto-develop
git checkout fix/passthrough-tracking-and-tee-path
git reset --hard FETCH_HEAD
git push --force-with-leaseMaintainers can push it too, since edits from maintainers are enabled on this PR. |
…loss When PlaywrightParser::parse falls back to Passthrough (all parsing tiers failed), the run was tracked through the same savings timer used for successful parses -- so the truncation-driven size difference was recorded as token savings even though nothing was parsed. Route genuine Tier-3 failures through the existing record_parse_failure_silent + track_passthrough plumbing instead. Also build the passthrough fallback content from the combined stdout+stderr rather than the parser's stdout-only truncation, so a failure reported only on stderr (empty stdout) isn't silently dropped. Part of rtk-ai#3339.
Same fix as playwright applied to pnpm list and pnpm outdated: genuine Tier-3 parse failures now route through record_parse_failure_silent + track_passthrough instead of being counted as token savings, and the passthrough fallback content is built from the combined stdout+stderr so a stderr-only failure isn't dropped. pnpm list's Tier-1/Degraded guard and tracking stay anchored to stdout alone (unchanged from before this fix) -- only the Tier-3 arm uses the combined stream, so a stderr notice alongside a successful parse doesn't inflate the reported savings ratio. pnpm outdated's existing "All packages up-to-date" empty-display fallback is untouched. Part of rtk-ai#3339.
Same fix as playwright/pnpm applied to vitest/jest run. Adds an is_parse_failure field to FormattedTestOutput, set only in the genuine ParseResult::Passthrough arm inside format_test_output -- distinct from the explicit user-requested passthrough path (an explicit --reporter override), which is not a failure and keeps its existing behavior. run_test branches its tracking call on that field: genuine failures route through record_parse_failure_silent + track_passthrough; everything else keeps the existing timer.track call. The passthrough fallback content is now built from the combined stdout+stderr instead of stdout alone. Part of rtk-ai#3339.
…rators The tee recovery hint (e.g. [full output: ~/path/to/log]) strips the home prefix against the OS home-directory API, but the shell that reads the hint expands ~ and $HOME against its own HOME. On Windows those differ: Git Bash/MSYS set HOME themselves (commonly /c/Users/name), and on redirected or roaming profiles it need not be the profile folder at all, so the hint can point at the wrong file. - Prefer the HOME environment variable (read through user_dirs::env_path, so test builds see only what the test sets) when stripping the home prefix, falling back to user_dirs::home. Convert an MSYS-style HOME to a native path before comparing, since passed through unconverted it would never match a native path via strip_prefix. Reject an empty HOME value, since an empty PathBuf's strip_prefix trivially matches any path. - Normalize the home-relative portion to forward slashes in display_path, so a home-relative Windows path no longer needs the quoted "$HOME/..." form just because of its separators. Rebased onto the tee.rs -> tee_file.rs split; the change now lives in tee_file.rs's display_path. Part of rtk-ai#3339.
Based on bharvey42's rebase of this branch (rebase/3344-onto-develop, authorship kept). The only conflict was two test blocks added side by side in vitest_cmd.rs; both are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
4b958d9 to
92b8a4b
Compare
|
Hi @SomSamantray, thanks for this, and sorry it sat for so long. Your branch conflicted with I tested it against
fmt, clippy and the vitest/pnpm/playwright/tee tests pass on Linux. The tee tests for the Git Bash |
… and booked Replay what each tool really printed through a stand-in on PATH and read back the rows rtk wrote: a stderr-only startup error reaches the user, the run is booked as a parse failure with no tokens, and a parsed pnpm outdated run is still booked as savings. The passthrough rows now use passthrough_label, so the stored command is the one that ran, without a "(passthrough)" suffix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
KuSh
left a comment
There was a problem hiding this comment.
Round 1 of 3 — APPROVED, follow-ups filed
Claim: when the playwright, pnpm list/outdated and vitest/jest parsers all fail, rtk shows the tool's stdout and stderr together and books the run as a parse failure instead of savings; the tee hint's ~/ resolves against the invoking shell's HOME, with forward slashes.
Scope: accept (round 1, frozen); maintainer PRs: none overlap.
Ran: real vitest 3.2.4, jest 29.7, playwright 1.56.1 and pnpm 12.15 in Docker, 22 cases × develop c43b5c4 / head 92b8a4b, each through rtk rewrite first: startup errors reported on stderr only, a broken package.json, passing and failing runs, --reporter=verbose, non-test subcommands, an over-cap tier-3 run, plus tee mode on Linux with 5 HOME/XDG_DATA_HOME layouts; invariants: under the hook, split streams, every decision, over-cap + accounting, non-default targets; savings on parsed runs unchanged on both sides (41–91%) vs 20% floor (CONTRIBUTING.md)
Pins: 17 decisions, 17 mutated, 12 survived the PR's suite (tier routing and stdout→combined content in playwright, pnpm list and pnpm outdated, vitest's booking branch, the four fallback_succeeded flags); the fixup kills the 6 reachable ones, the rest make no difference on any real output found. The 2 Windows-only decisions (MSYS conversion, separator normalization) were read, not mutated; their tests run on both Windows jobs.
Matrix: executed this round; pin check: executed this round
CI @f5f63163: all green
Blocks merge (0, frozen at round 1)
None.
Optional — will not hold merge
- Non-test invocations now write a parse-failure row too:
rtk playwright install --dry-run,rtk playwright show-report <dir>andrtk jest --listTestseach add one, with output unchanged. They already print the[RTK:PASSTHROUGH]warning on develop; evidence added to #1585. fallback_succeededis!shown.trim().is_empty()here, while the fallbacks inlib.rspasstruewhenever the raw output reached the user. No real run I found produced an emptyshown, so it never differs today.- playwright joins the streams as
stdout + "\n" + stderr, so an empty stderr adds one trailing newline (show-report: 30 → 31 B).
Filed as follow-ups
- #2658
rtk pnpm outdatedexits 0 when pnpm fails — pre-existing; absorbed, comment added (with this PR the broken-manifest error is now shown, the exit status is still 0). - #1585 non-test playwright subcommands go through the result parser — pre-existing; absorbed, comment added.
- #5283
rtk pnpm listpasses a nameless project through and counts the project itself as a package — outside this PR's hunks; filed. - #5284 tier-3 output over
passthrough_max_charsis cut with no recovery hint when the command exits 0 — pre-existing; filed.
Checked and correct — no need to re-verify
- A startup error on stderr: develop prints only the recall hint (43 B); the head prints the tool's error (vitest 1314 B, jest 1014 B, playwright 650 B), exit code 1 kept, and books
rtk:passthrough … 0/0plus oneparse_failuresrow. rtk pnpm outdatedon an invalidpackage.json: develop prints "All packages up-to-date"; the head printsERR_PNPM_PACKAGE_MANIFEST_SERIALIZATION_ERROR.- Parsed runs (vitest pass/fail, jest, playwright test, pnpm list, pnpm outdated) and
--reporter=verbose: byte-identical output and identical savings rows on both sides. - Tee hints on Linux are identical on both sides for
HOME,HOMEwith a trailing slash,XDG_DATA_HOMEoutsideHOME, and a data path with a space ("$HOME/My Data/…"); every hint resolves in bash. - Merge with develop 9a94ec1: fmt, clippy and the full suite pass.
Your questions
None asked.
Next
fixup f5f6316 pushed, code-reviewed: adds tests/js_parse_failure_tracking_test.rs (8 cases replaying captured vitest, playwright and pnpm streams through a stand-in on PATH and reading back the rows rtk wrote) and books the new passthrough rows with tracking::passthrough_label, so the stored command reads rtk:passthrough pnpm outdated instead of rtk:passthrough pnpm outdated (passthrough) — approving.
Rounds: 1/3. Threads: 0 open, 0 resolved this round.
The PR body has no closing keyword, so #3339 stays open after the merge and needs closing by hand.
Fixes the three related bugs reported in #3339, all rooted in how rtk's Tier-3 "parsing failed" fallback (
ParseResult::Passthrough) is tracked and displayed.1.
rtk gaincounted parse failures as savingstimer.track(...)was called unconditionally, even for Passthrough-tier runs. Since the passthrough content is a truncated view of the raw output, the size difference between "raw" and "shown" was counted as savings — even though nothing was parsed or summarized, and truncation only happened because parsing failed.Fix: route genuine Tier-3 failures through the existing
record_parse_failure_silent+TimedExecution::track_passthroughplumbing (already used byrtk gain --failures) instead of the generic savings timer. Applied toplaywright test,pnpm list,pnpm outdated, andvitest/jest run— the four call sites sharing this pattern. Explicit user-requested passthrough (e.g. vitest's--reporteroverride) is untouched — it isn't a failure.2. Tee hint path broken on Windows
[full output: ~/path/to/log]mixed a forward-slash~with native backslash separators, and could resolve~against a different home directory than the invoking Git Bash/MSYS shell's own~expansion uses.Fix, in
display_path:$HOMEover the OS home-directory API when stripping the home prefix, converting Git Bash/MSYS's POSIX-styleHOME(/c/Users/name) to a native path first — otherwise it would never match viastrip_prefixand would silently defeat the~shorthand.HOMEvalue (an emptyPathBuf'sstrip_prefixtrivially matches everything).This keeps the existing
~/shorthand (per #2325's direction) rather than reverting to always-absolute paths, an approach previously tried in #2187/#2701.3. Passthrough could silently emit nothing
When parsing failed and a command's real output was empty on stdout (diagnostic on stderr instead), the passthrough fallback was itself empty.
never_worsethen preferred that empty result over the real combined output, discarding it.Fix: build the passthrough fallback content from the combined stdout+stderr instead of stdout alone, for all four call sites above.
Notes
developclone before implementing.cargo fmt --all,cargo clippy --all-targets -- -D warnings, andcargo test --allall pass (2523 tests; the only 2 failures in this environment —hooks::rewrite_cmd::tests::unattestable_passthrough::*— are pre-existing and unrelated, reproduced identically on unmodifieddevelop).pnpm list's Tier-1/Degraded guard and tracking stay anchored to stdout alone (unchanged) — only the Tier-3 arm uses the combined stream, so a stderr notice alongside a successful parse doesn't inflate the reported savings ratio.