āœ… test(scripts): every mutant in own-provenance, merge-queue, released-pins and hooks-path dies

Merged
AT
2d ago
+422-55

Slice: #633

Part of #580's one-time sweep, slice 27 of 27. In each of the four scripts, every Survived and NoCoverage mutant now dies.

Re-measured on main

None of the eight files has changed since 0a9c8be. A direct Stryker run on main (b4a44ab) gave the slice's own counts, 108 blocking:

FileBlocking
scripts/own-provenance.mjs40 (19 Survived, 21 NoCoverage)
scripts/merge-queue.mjs37 (36 Survived, 1 NoCoverage)
scripts/released-pins.mjs19 (17 Survived, 2 NoCoverage)
scripts/hooks-path.mjs12 (10 Survived, 2 NoCoverage)

How they die

  • own-provenance
    • Lockfile keys: unquoted, of any width, indented past a key, a link key whole, and a resolution holding more than its integrity.
    • The verifier's thresholds.
    • Attestations, envelopes, statements and subjects of every shape.
    • The pass line.
    • fetchJson and the machine's io.
    • main, passing and failing.
    • entry, both run and imported.
  • merge-queue
    • Drafts by another Bot, or with no head ref.
    • Numbers of any width, and every spacing of a stack.
    • The list of pull requests ahead, from its own heading to the next heading or <details> block that starts a line.
    • A draft that tests only itself.
    • Merges with no message, no author, or more text around the number.
  • released-pins
    • Exact pins of any width, and a prerelease.
    • Lockfile documents ahead of the project's with none, or with no project importer.
    • A lock holding other packages but not the pin.
    • A peer suffix naming a link.
    • A package outside pnpm's store, and a folder with no package.json.
    • Packages named on either side of --root.
    • entry, both run and imported.
  • hooks-path
    • Git's three questions, to the letter.
    • entry, both run and imported.

Source rewrites, for mutants no test can see or that hang

  • CLI entry. Each CLI runs through an exported entry(argv, url, …, setExitCode), after veda's scripts (veda/scripts/own-provenance.mjs).
    • Run as the file, it sets main's code as the exit code.
    • Imported, it does nothing. A test checks this by the exit code it leaves unset.
    • The top level awaits entry, so no mutant can drop the call.
    • A first version re-imported each module under a query string. Coverage counted that second, uncalled copy, which failed CI's test:scripts. It is gone.
  • own-provenance.
    • main takes its io, so the check runs in-process under test, where the node:coverage disable block had left it NoCoverage.
    • Its thresholds are a frozen constant that a test pins, since @sigstore/verify 4.1.3 defaults to the same 1s (dist/verifier.js).
    • The tarball check needs no empty list.
  • merge-queue.
    • A missing title, body, stack or message is read as String(undefined), which names nothing.
    • Checks that the line before them already implies are dropped.
  • released-pins.
    • It reads its arguments by recursion.
    • It reads its JSON as text, with no encoding to mutate.
    • It drops ?. where the lock is always an object.
  • hooks-path. realGit uses spawnSync, which drops git's stderr with no stdio option to mutate. It gives undefined unless git exits 0.
  • Behaviour. Exit codes and output are unchanged. pnpm provenance, run locally, still passes all six own packages.

Only the eight files this slice names under Guards: change. No // Stryker disable and no new dependency.

Evidence

agnipariksha --lane scripts --files scripts/own-provenance.mjs,scripts/merge-queue.mjs,scripts/released-pins.mjs,scripts/hooks-path.mjs --no-reuse
scripts: 587 killed of 587 in 4 file(s) (579 Killed, 6 RuntimeError, 2 Timeout; 2 timeout(s) retried) - pass
agnipariksha total: 587 killed of 587 in 1 lane(s), 0 blocking, 0 refused - exit 0

This is the gate on the head, which carries the entry fix.

  • pnpm test:scripts passes 179 of 179, with all four files at 100% line, branch and function coverage.
  • pnpm provenance and pnpm pins run as before.
  • The pre-push hook passed on the push.

šŸ¤– Generated with Claude Code