✨ feat(shuddhi, dvara): seven rules, a helper and two hook checks hold lessons

Merged
AT
11d ago
+3285-42

Slice: #131

For athya_mono work 0165, slice L-07 (athya-hq/athya_mono issue 3608): every check-tier lesson whose check lives in shuddhi or dvara, and that L-04 did not build, becomes a rule there. Lint rules refuse from the start; the one new hook refusal (dvara exec-bits) warns first, and a consumer passes --refuse after seven days with no wrong fire (0165 D2).

Release: the 0165 coordinator gave this PR the veda slot (one release at a time, D4). The last commit bumps dvara, eslint-plugin-shuddhi and sarathi (which ships the lessons' new held-by lines) to 0.6.18; v0.6.17 is the latest tag. v0.6.18 is tagged on main after the merge.

The rules

Lesson (veda doc)RuleWhere
expect.poll advances fake timers (testing)poll-under-fake-timers: expect.poll or vi.waitFor while the test's fake timers are onshuddhi test files, error
Freeze the clock; do not widen the assertion (testing)expect-on-wall-clock: an expected value read off Date.now() in a file that never fakes the clockshuddhi test files, warn
testTimeout cannot interrupt a sync spawn (testing)spawn-timeout-sigkill: a sync spawn whose timeout has no killSignal: 'SIGKILL'; --fix adds itshuddhi test files and fixtures, error
unstubEnvs drops beforeAll stubs (testing)no-stubenv-in-beforeallshuddhi test files, error
Assert the literal, not the imported constant (stryker)assert-imported-constant: a matcher's expected value imported from the module under testshuddhi test files, warn
Install signal handlers before spawn() (node-pnpm-typescript)signal-handler-before-spawnshuddhi scripts, warn
google-auth-library errors embed the token (node-pnpm-typescript)google-auth-error-message: a verification error's text reaching a log, a response or a new errorshuddhi error handling, error
Hermetic git in fixtures; fixture commits need an identity (testing)the helper git-spawn-env already asks for, shipped: @veda-hq/eslint-plugin-shuddhi/hermetic-git (hermeticGitEnv, maskProcessGitEnv; maintenance and gc off, a fixture identity)shuddhi
In-place hand runs drop the executable bit (stryker)dvara exec-bits --staged [--refuse]dvara, pre-commit, warn first
The 50,000-line cap (review-bots)dvara review-size --cap N [--ignore GLOB]…dvara, pre-push, warn

Each lesson gains a held by line saying what the rule does not check. no-fixed-sleep's message now names the fake-timer exception.

Evidence

Tests. Each check run alone, on this branch: dvara 346/346, shuddhi 2,915/2,915, plus sarathi, test:scripts, guards, provenance and lint, all passing. Run together, pnpm check once failed the supervisor test's 2,500 ms budget under load; this branch does not touch that code, and the test passes alone.

Dry run over athya_mono (its tests, scripts and server sources at main, with this branch's src; .tmp/l07-dryrun.mts there, 1,971 files, 0 parse errors):

RuleHitsWhat the pin bump does
spawn-timeout-sigkill126eslint --fix
assert-imported-constant411bulk suppressions (counts only fall)
expect-on-wall-clock13suppressions; all are range assertions on Date.now()
poll-under-fake-timers8suppressions; each flushes on purpose
signal-handler-before-spawn6real ordering bugs in three scripts; fix or suppress
no-stubenv-in-beforeall2fix
google-auth-error-message0auth.service.ts already keeps the error away from its logger

veda's own lint uses the released shuddhi 0.2.0's error-handling configs only, so none of these rules lint veda yet; the same dry run over veda finds spawn-timeout-sigkill 22 times and nothing else.

ESLint's bulk suppressions record errors only (suppressions-service.js keeps severity === 2), and athya_mono's lint:ci runs with --max-warnings=0. So the three warnings here stay warnings for other consumers, and athya_mono's pin bump sets them to error so its existing hits can be suppressed.

review-size globs. Node's path.matchesGlob, which review-size uses, and athya_mono's Cubic matcher (scripts/validations/cubic/glob-match.ts) agree on every tracked file (5,763) against all 191 cubic.yaml ignore patterns: 0 differ.

Lessons nothing holds (athya_mono scripts/lessons-nothing-holds.ts): veda's docs/lessons goes from 151 to 140 (11 lessons gain a held by line). athya-rules removed its one lesson in athya-hq/athya-rules#59.

🤖 Generated with Claude Code