ā test(sarathi): cli.ts passes its mutation lane, and the version moves to version.ts
Brings sarathi's src/cli.ts to zero blocking mutants and moves the version out of it, so sarathi can release again.
Why
veda's mutation gate judges a changed file whole, and every sarathi release changed VERSION in src/cli.ts. The 0.8.6 release for https://github.com/veda-hq/veda/issues/428 is the first since the gate came in, and its push was refused: 403 mutants, 96 blocking (65 survived, 31 with no coverage), none on a line it changed.
What changes
src/version.tsholdsVERSION, with its own suite (version.test.ts) holding it equal topackage.json. A release edits that file andpackage.json, nevercli.ts.cli.tsstill re-exportsVERSION, because the package has noexportsmap anddist/cli.jscan be imported.cli.test.tsdrivesmainthrough a fakeIofor:- every routed command:
worktree hook,pick(--shell, a bad word, the stdin fallback and a givenask),cleanup, the lifecycle,servicesandautofix add/list(with the row's time); - a
--configother than the project's list, and$CLAUDE_PROJECT_DIRset, empty and unset; - each forbidEnv answer in full, and the exact usage errors;
- settings matchers that are empty,
*, leave out more than one tool, or end in|.
- every routed command:
settingsHooksis exported and tested on its own.
Behaviour changes, so a reviewer can check them
hookalways callsio.outandio.err, with an empty string when there is nothing to say. The bin writes that empty string to stdout and stderr, which prints nothing. The dropped early return (entries.length === 0 && forbidden === undefined) merged to the same answer:merge(event, [])is{ code: 0, stdout: '', stderr: '' }.check's catch prints the error's.message. Everything in thattrythrows onlyConfigError(loadConfig,parseConfig) orSettingsError(parseSettings). The oldString(error)branch could not be reached.parseOptionsreads an option's value off one iterator, and returnsconfigandsettingsas they are,undefinedincluded.projectRootis$CLAUDE_PROJECT_DIR || cwd, the same asundefinedor''falling back tocwdbefore.settingsHooksskips an event or group whose value is not a list before looping, where it used to loop over an empty array. The result is the same, and the new test pins it.- The
hookcommand's JSON catch has a plain comment, not// fail-open:. It is one of the five swallowed catcheseslint-suppressions.jsonalready allows incli.ts. Marking itfail-open:would leave the suppression count stale, and pruning it means editing that code-owned file. Alok can prune it to 4 in a later change if he wants.
The lane
Before, on main's cli.ts (pre-push): sarathi: 307 killed of 403 in 1 file(s) (31 NoCoverage, 304 Killed, 3 Timeout, 65 Survived; 3 timeout(s) retried) - 96 blocking.
After, run by hand as pnpm exec agnipariksha --lane sarathi --files packages/sarathi/src/cli.ts,packages/sarathi/src/version.ts --no-reuse:
sarathi: 357 killed of 357 in 2 file(s) (357 Killed; 0 timeout(s) retried) - pass
agnipariksha total: 357 killed of 357 in 1 lane(s), 0 blocking, 0 refused - exit 0
pnpm --dir packages/sarathi check (1052 tests) and pnpm lint are green. No gate setting, hook or code-owned file changes.
Next
The fix branch for #428 is rebased on this one, moves version.ts to 0.8.6 and releases it. That push passing the gate is the rest of this slice's done-when, so this PR does not close it.
Slice: #431
š¤ Generated with Claude Code
Summary by cubic
Fixes sarathi releases being refused by veda's mutation gate, which judges every changed file whole: a release edited VERSION in cli.ts, where 96 mutants blocked. This moves VERSION to src/version.ts and fully tests cli.ts, so its lane passes with 357 killed of 357.
- Releases now edit
version.tsandpackage.json;cli.tsre-exportsVERSIONfor code importingdist/cli.js. cli.test.tsdrivesmainthrough a fakeIocovering every routed command,--configoverrides,$CLAUDE_PROJECT_DIRset/empty/unset, all forbidEnv answers, and settings matcher edge cases.settingsHooksis exported and tested on its own.
Behavior changes
hooknow always writes stdout and stderr, even empty strings; callers print nothing.check's catch reportserror.message; onlyConfigErrororSettingsErrorcan reach it, so the oldString(error)branch was unreachable.