The PHP test filter deletes the `-expected` side of an assertion diff while keeping the `--- Expected` header, and `npm run-script <s>` is rewritten to `npm run run-script <s>`
Two independent defects, both reproduced against the shipped binary. The first is the more serious: a failing test's diff is shown with the wrong value attributed to the wrong side.
*Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). Both reproduced by running rtk 0.44.2 with a stand-in on PATH; outputs verbatim.*
1. The Expected value is deleted from assertion diffs
What the test tool printed:
FAILED Tests\ExampleTest
Failed asserting that two values are equal.
--- Expected
+++ Actual
@@ @@
-1.5
+2.5
Tests: 1 failed
What rtk pest passes to the caller:
FAILED Tests\ExampleTest
Failed asserting that two values are equal.
--- Expected
+++ Actual
@@ @@
+2.5
Tests: 1 failed
-1.5 is gone. The --- Expected / +++ Actual headers are still there, so the surviving +2.5 reads as though it were the expected value. The reader — usually an AI agent — is not told a line was removed.
Cause: src/cmds/php/test_output.rs:12, is_progress_line, classifies a line as PHPUnit progress output if every character is in . F E S I R W - 0-9 space / % ( ). A numeric diff line like -1.5 is entirely inside that set, so it is discarded as progress noise. + is not in the set, so the +actual line survives — which is why the loss is one-sided and silent rather than symmetric and obvious.
Reached from pest_cmd.rs:28, paratest_cmd.rs:28 and artisan_cmd.rs:26.
Any numeric-only expected value is affected: -1.5, -42, -0, -3.14. Non-numeric expected values (strings, arrays) contain characters outside the set and survive.
2. npm run-script is rewritten to npm run run-script
$ rtk rewrite npm run-script build
rtk npm run-script build
$ rtk -v npm run-script build
Running: npm run run-script build
run-script is npm's own long-form alias for run, but it is absent from the 66-entry NPM_SUBCOMMANDS list (src/cmds/js/npm_cmd.rs:82), so rtk classes it as a script name and prepends run at :90. npm then reports Missing script: "run-script".
Suggested fixes (untested — no programmer has reviewed these)
- Diff lines: require a progress line to be only the status characters (
.FESIRW) plus whitespace and the trailingN / N (NN%)counter, rather than accepting-,/,(,)and digits in any combination. Anchoring on the counter format would be tighter still. Alternatively, stop applyingis_progress_lineonce a--- Expectedheader has been seen, since everything after it is diff content. - npm alias: add
run-scripttoNPM_SUBCOMMANDS. Worth checking the same list for npm's other aliases (i/install,un/uninstall,ln/link,t/test,rb/rebuild,ls/list) — I only verifiedrun-script.
Note on the first one
The general "a filter deletes output without a marker" class is already tracked in #2317. I am filing this separately because the failure here is not just omission: the retained header makes the surviving line look like the value that was removed, so the reader is actively misled about which side of the comparison failed.
Source: rtk-ai/rtk