āœ… test(dvara): watchdog.ts's parsing, classification and verdict keep only equivalent mutants

Merged
AT
2d ago
+855-0

New cases in watchdog.test.ts kill the surviving and uncovered mutants in watchdog.ts's pure functions, the code above createWatchdog (slice #626). The PR is test-only: agnipariksha.json ignores *.test.ts, so the gate judges nothing on it, and Cubic skips test files.

Measure (pnpm exec agnipariksha --lane dvara --files packages/dvara/src/watchdog.ts --no-reuse, on main):

  • Before: 313 blocking (249 Survived, 64 NoCoverage), 177 of them above createWatchdog.
  • After: 156 blocking (121 Survived, 35 NoCoverage). The final run killed 872 of 1028.
    • 136 of those 156 are in createWatchdog, execAsync and pruneOldHangs, which #627 owns.
    • The other 20 are above createWatchdog.

The 20 left above createWatchdog: no test can tell them apart from the code. #625 changes the source there so these mutants disappear, keeping today's behaviour, and lists each change.

  • ?? "Stryker was here!" / ?? ["Stryker was here"] fallbacks: lines 124, 389, 404, 408, 420, 431, 453, 462, 498, 525, 533, 566 and 617. The placeholder never matches the regex or field each one feeds.
  • ?? 1 → && 1: lines 524 and 532. Both reach the same !== 0 / === 0 result.
  • Conditions that decide nothing: line 349 !line, line 528 ipc.length === 0, line 570 if (peer) and line 576 fd.device !== null.
  • Regex anchor: line 440, /^0x0+$/. A peer address is always 0x plus hex digits, so the match can only start at 0.

Checks:

  • pnpm --filter ./packages/dvara test passes: 704 tests, coverage thresholds met, watchdog.ts at 98.69% lines.
  • pnpm lint and typecheck are clean.
  • Timeouts went from 2 to 4. The new pair is at line 244 (buildTree), from the self-parented-root test. Stryker's hit limit ends each in about a second.

Some fixtures use inputs real ps/lsof would rarely print: the state SR, an aST= line, names with U+2028, and an empty device string. Each one exists to kill a specific mutant.

Alok approved the slice with šŸ‘ on https://github.com/veda-hq/veda/issues/626#issuecomment-7193606936.

Slice: #626

šŸ¤– Generated with Claude Code


Summary by cubic

Adds 855 lines of test cases to watchdog.test.ts covering the pure functions above createWatchdog: the ps and lsof parsers, buildTree, advanceWindow's thresholds, classifyFds, hang-core detection, and verdict decisions.

These cases cut the surviving and uncovered mutants in those functions from 177 to 20; the 20 that remain are equivalent mutants that only source changes in the #625 slice can remove. This PR is test-only: agnipariksha.json ignores *.test.ts, so the gate judges nothing on it, and the remaining 136 mutants below createWatchdog are handled by the sibling slice #627.