Skip to content

fix(audit): harvest pnpm/yarn and vitest/jest claims - #190

Merged
surlymochan merged 1 commit into
surlymochan:mainfrom
MAOLVLHL:fix/claim-command-families
Nov 12, 2026
Merged

surlymochan merged 1 commit into
surlymochan:mainfrom
MAOLVLHL:fix/claim-command-families

Conversation

@MAOLVLHL

Copy link
Copy Markdown
Contributor

Fixes #189.

What this changes

xflow audit no longer keeps two hand-written lists of test commands. The
recogniser (TEST_COMMAND_PATTERNS, which isTestCommand consults) and the
harvester (the alternation that cuts the command out of a sentence) are now
derived from one command-family table, where each row carries the shape a claim
may take in prose and the runnable slice to harvest. Because there is one
source, a family cannot be recognised by one list and truncated by the other.

The harvest is anchored on a token edge, so a match can only start where the
command starts: pnpm run test is no longer cut to npm run test.

vitest and jest joined the table as families that count only inside backticks,
and their summary lines (Tests 18 passed (18), Tests: 2 failed, 16 passed, 20 total) are parsed so a claimed count is still compared against the replay.
The audit help text now lists the commands it recognises.

Why

The two lists had already drifted. pnpm run test was replayed as npm run test — a different package manager, in a workspace whose lockfile npm cannot
read — while yarn run test, vitest run and yarn jest were dropped on the
floor, so a change that quoted its run audited as no_claims. The audit then
tells the reader the change named no test run at all, which is the opposite of
what the change says.

I did not fix this by adding four more patterns to each list. That is how the
last two regressions of this kind were fixed (the unittest case, run
20261109-231900-3c6b2a; the bun case in M6 slice 1, #132), and each fix left
the two lists one edit away from disagreeing again. I also did not reach for a
separate registry module: the table stays in src/core/audit.js, next to the
harvest that reads it, and the exported TEST_COMMAND_PATTERNS keeps its name
and shape so nothing downstream has to change.

Out of scope on purpose: pnpm -r test and other recursive invocations (a
workspace-wide run is not the same command per package), dotnet and rspec, and
the TS test-file detection in isJavaScriptTestFile, which is a separate issue
about which files count rather than which commands do.

Tests

  • npm test equivalent run locally, with the pre-existing failures noted
  • New tests cover this change
  • npm run drift:scan — not run: no workflow or atom changed

The four audit suites (xflow-audit, xflow-audit-go-rust, xflow-audit-batch,
xflow-sarif): 126 tests, 92 passed, 19 failed, 15 skipped. The same four files
against the unmodified tree give 123 tests, 89 passed, 19 failed, 15 skipped —
the same failure set, test for test. All 19 are environment failures on this
Windows machine (EPERM while rmSync clears a read-only .git object under
%TEMP%, plus gh- and seal-related cases that need a POSIX checkout); they
reproduce on main with the change stashed.

Three new cases, in test/xflow-audit.test.js:

  • keeps pnpm/yarn script runs whole instead of trimming them to npm — asserts
    the harvested commands are pnpm run test and yarn run test, with the
    counts read from the same sentence.
  • reads vitest and jest claims from backticks, never from prose — prose about
    tooling harvests nothing; `vitest run` and `yarn jest --coverage`
    do, prefix included.
  • reads vitest and jest summary lines, and leaves a multi-project run unparsed
    — both count orders, both total forms, a two-block monorepo output and a
    marker without counts.

Behaviour before and after, from the same module:

body before after
`pnpm run test` npm run test pnpm run test
`yarn run test` — yarn run test
`vitest run` — vitest run
`yarn jest` — yarn jest
We use vitest and jest for unit tests. — —

And end to end on a two-commit fixture whose claims.md names
`yarn run test`: no_claims, exit 3, before; a harvested claim that is
replayed, after.

AI assistance

Yes — written with DeepSeek Harness. I read the full diff before submitting it.

Claim harvesting and claim trimming were two hand-written lists that had
drifted apart. The npm family matched inside "pnpm run test" and won as the
leftmost match, so the replay ran "npm run test" instead of the command the
PR quoted. "yarn run test", "vitest run" and "jest" were not recognised at
all, which turned a PR that named its run into a no_claims audit.

Both lists now derive from one command-family table, and each tail is
anchored on a token edge so a match can only start at the command. vitest and
jest count only inside backticks, and their summary lines are parsed so an
overstated count is still a mismatch.
@MAOLVLHL
MAOLVLHL force-pushed the fix/claim-command-families branch from 326b4df to 6b89452 Compare November 12, 2026 10:25
@MAOLVLHL

Copy link
Copy Markdown
Contributor Author

CI caught one thing worth calling out: the first push went up through the Git
Data API, which wrote bin/xflow.js with mode 100644 and dropped its
executable bit. test/cli-usability.test.js asserts that bit stays set, so
verify failed on that commit.

I re-created the commit with mode 100755 restored and moved the branch to it
(6b89452). The diff is unchanged: same three files, +209/−26. Both checks are
green now.

@surlymochan
surlymochan merged commit acef97b into surlymochan:main Nov 12, 2026
2 checks passed
@surlymochan

Copy link
Copy Markdown
Owner

Merged — thank you. Verified independently before merging: checked out the PR head, module-level repro of all six cases from #189 passes (plus --coverage args and the prose negative), the four audit suites run 126 tests / 123 pass with the same 3 pre-existing I6d environment failures as clean main (zero regressions), and bin/xflow.js keeps its executable bit. #189 is closed by this merge.

@surlymochan surlymochan mentioned this pull request Nov 12, 2026
surlymochan added a commit that referenced this pull request Nov 12, 2026
Two merged PRs since 0.5.33, no milestone acceptance: M14 slice 2 codex half (#188) + audit claim harvesting for pnpm/yarn and vitest/jest (#190, fixes #189).

Co-authored-by: Nick <209239467+surlymochan@users.noreply.github.com>
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.

xflow audit harvests pnpm runs as npm runs and misses yarn/vitest/jest claims

2 participants