✨ feat(pariksha): a commit checks identifiers and the names it removes
pariksha doc-references --staged now catches at commit what --base catches at push for the staged change: DOC-DRIFT-04 identifiers, and docs naming an identifier, script or --flag the index removes against HEAD. It is the pariksha part of Decision: 1C and 2A on https://github.com/athya-hq/athya_mono/issues/4007#issuecomment-7201240025.
What a commit reads now
- Every check by default, DOC-DRIFT-04 included (
cli.ts).--checks 01,02gives today's run. - Beside the deleted or renamed paths and removed scripts it read before: docs naming an identifier or
--flagthe commit removes that no code in the index still holds. A name still defined elsewhere pulls in no doc, so a commit stays seconds. The push still re-checks those, andname:linecitations. - In a doc pulled in only for a removal, a finding
HEADalready had is not the commit's, as a push excuses what its merge base had. A staged doc, or a doc whose baseline entry the commit edits, is still held to its count. (Excusing those too would let a commit drop a baseline entry whose finding remains; the existing test caught it.) - Mid-merge, what the merge took unchanged removes nothing (
withoutFiles). codeWordsreads the index's code once for both questions (what the commit removed, then what its docs name).- Push too: a legacy look-up at the base runs only the checks that failed. A DOC-DRIFT-04 failure no longer materialises the base tree for lychee. Same result, since a legacy finding matches by check.
The W-37.2 commit is refused at commit now. Replayed on athya_mono: HEAD 932685be5, index ed96f2f95 (51 files, 7,217 lines removed). Before, --staged passed (19 docs checked). Now it refuses with the line the push refused with, after 2 minutes, on 2026-11-26:
pariksha doc-references: docs/standards/best-practices/code-hygiene/shell-scripting.md:44: [DOC-DRIFT-04] scrub_git_env(): `scrub_git_env` occurs nowhere in the code — renamed, removed, or never written
Cost at commit, on athya_mono (5,475 files), on an 18-core Mac. Variants ran interleaved, each round in turn. Wall and CPU (user+sys, children included) are medians. The load is the 1-minute load average while it ran.
| Staged change | Load | Old wall / CPU | New wall / CPU | Docs checked, old → new |
|---|---|---|---|---|
W-37.2 ed96f2f95, 7,217 lines removed, refused | 64–75 | 2.40 / 0.83 s | 8.06 / 2.34 s | 19 → 22 |
W-59.2 3191adf6b, 18,508 lines removed | 14–15 | 1.30 / 1.38 s | 2.65 / 2.81 s | 37 → 38 |
W-67 b766c95b2, 12,563 lines removed | 14 | 0.81 / 0.87 s | 2.14 / 2.23 s | 14 → 26 |
W-69 d4b5bd682, 123 files | 14 | 0.81 / 0.85 s | 1.62 / 1.71 s | 38 → 38 |
K-05 06d9e0ab9, 3 code files | 13–14 | 0.35 / 0.37 s | 1.16 / 1.18 s | 1 → 1 |
d4879ca49, 1 test file | 13 | 0.28 / 0.32 s | 1.11 / 1.10 s | 0 → 0 |
K-06 216edcee5, 2 code files | 14 | 0.29 / 0.32 s | 0.32 / 0.35 s | 1 → 1 |
9b6ecd267, 1 script's comment | 13 | 0.32 / 0.34 s | 0.33 / 0.37 s | 1 → 1 |
125e24009, 2 docs | 41–42 | 0.41 / 0.41 s | 0.93 / 0.67 s | 2 → 2 |
W-37.2 ran 5 rounds and the others 3, through .tmp/ scripts that replay each commit into a scratch worktree. The replay read main's athya-rules doc-references.json through a node_modules symlink. A commit that removes a camelCase word or a flag from code now reads and tokenises all the index's code once, about 0.8 s here. A commit that removes none costs what it did. The W-37.2 row ran at load 64–75 from other sessions' mutation runs, so its wall is inflated; the CPU column is the steadier figure.
Push on the same change (--base 932685be5 --head ed96f2f95, 3 rounds, load 56–88): old 31.1 s wall / 12.1 s CPU, new 33.1 s / 9.3 s, with the same refusal. The push checks 128 docs there, because its removed flags (--staged, --help …) are not narrowed. That is unchanged here.
DOC-DRIFT-04 on athya_mono main: --all --checks 04 passes over all 1,589 reference files. Pinning this version refuses no commit to a doc that is already at its count.
Checks run here
pnpm testinpackages/pariksha: 4,663 tests, 0 failed. Coverage: all files 99.97% lines, 99.44% branches, 99.95% functions;doc-identifiers.ts100%;doc-references-gate.ts100% lines and branches, 98.51% functions.eslinton the changed files: clean.- The mutation lane has not run to the end here. I stopped
agnipariksha --lane parikshaondoc-identifiers.tsanddoc-references-gate.ts(1,257 mutants) after 43 minutes, at the coordinating session's request: the machine's load was 63–87, and another push's Android gate needs it under 18. The requiredMutationcheck judges the lane here. Three guards that looked like equivalent mutants were restructured before the push:wordsGoneFromCode,withoutFiles, and onelegacyvalue. - veda's git hooks did not run, because this branch was built in a clone where kavach refuses setting
core.hooksPath. I ran their stages by hand instead.dvara records --base origin/mainpassed (8 files, 2 legacy held),dvara frozenpassed,pnpm guardspassed, and parikshasmokepassed. niyam's pre-push is left to the Guard check.
The version stays at 0.8.12. The release comes in its own PR after this merges, after dvara's v0.8.14.
Approved: Alok's 👍 on https://github.com/veda-hq/veda/issues/640#issuecomment-7201526152.
Slice: #640
🤖 Generated with Claude Code