⨠feat(dvara): a built-in watchdog and dvara slot (#376)
Slice: #376
Under work item #43.
W-63 moves athya_mono's hook watchdog and its per-machine test slot into dvara, so
athya_mono can drop its own copies once this is released. This replaces #382: one of
that branch's commits held two key-shaped test tokens that gitleaks flags. This branch
is one commit on main, with those tokens replaced by plain words and Cubic's findings
on #382 addressed.
"watchdog": "dvara"attaches the built-in watchdog (src/watchdog.ts,
src/liveness.ts). It stops only a hook that is provably deadlocked: exit 124,
statustimed_out. A hook that is just slow keeps running. A kill needs the same
deadlocked core found twice, one idle window apart, and found once more from a fresh
psandlsofreading just before the kill. Every process the leaf's channels
reach, through any chain of internal channels, must be idle and hold nothing that
leads outside the tree. Once such a core is found, anlsofof every process the
user can read (about 0.1 to 1.2 s here) must show no outside process sharing any of
its channels. It is opt-in; any other string is still read as a module
path.DVARA_WATCHDOG*variables set it.dvara slot(src/slot.ts) runs a command, with its--setvariables, only
while it holds a machine-wide slot, and it never waits for one. Its lock file and
record match the old wrapper byte for byte, so runs from before and after the move
share one slot. A failed release warns and keeps the command's exit status.- The tests are ported to
node:testcase for case. The capturedlsof/psfixtures
underfixtures/watchdog/name a neutral working directory.
Guard: watchdog.integration.test.ts is skipped off macOS. Elsewhere the watchdog
is unsupported and inspects nothing, so the suite has nothing to run there. Slice
#376's Guards: section names it, and Alok approved it with a š on its Proposal
(https://github.com/veda-hq/veda/issues/376#issuecomment-7068450411). On Linux CI,
the fixture-driven watchdog.test.ts still runs every rule.
No version bump and no tag. The release is cut separately after this merges.
Evidence: pnpm check on macOS at ef40233
CI runs on Linux, where the integration suite is skipped, so this local macOS run is
the evidence for it. There it passed all its real-process cases in 9.4 s.
pnpm check (provenance, then pnpm -r check, test:scripts, eslint . and
scripts/guards.sh) exited 0:
| Package | Tests | Pass | Fail | Skipped | Lines / branches / funcs |
|---|---|---|---|---|---|
| dvara | 587 | 587 | 0 | 0 | 99.74 / 96.89 / 99.75 |
| agnipariksha | 117 | 117 | 0 | 0 | 99.43 / 98.99 / 98.77 |
| eslint-plugin-shuddhi | 2915 | 2915 | 0 | 0 | 99.98 / 97.56 / 100.00 |
| pariksha | 4006 | 4006 | 0 | 0 | 99.97 / 99.14 / 99.94 |
| kavach (node) | 767 | 767 | 0 | 0 | 99.89 / 97.44 / 99.68 |
| kavach (python) | 917 | OK | ā | ā | ā |
| sarathi | 585 | 582 | 0 | 3 (live-service cases, opt-in via SARATHI_LIVE_SERVICES) | 99.58 / 97.77 / 99.79 |
| scripts | 184 | 184 | 0 | 0 | 100.00 / 98.26 / 100.00 |
Coverage of dvara's new files: liveness.ts 100 / 100 / 100, slot.ts
100 / 98.69 / 100, watchdog.ts 98.69 / 92.90 / 98.86. The dvara build and smoke
run passed, and so did the guards: pariksha boundary found no denied word in 579 files,
the required settings are present, and .claude/sarathi.json is valid.
Secret scans over origin/main..HEAD: gitleaks (with .gitleaks.toml) found 0
findings, and TruffleHog (--results=verified,unknown) found 0. After #382's
branch left origin, gitleaks over every origin branch (--remotes=origin)
found 0, and the re-run Secret scans check passed.
š¤ Generated with Claude Code