Repository navigation
feat(self-audit): check documentation in the other direction too - #491
Merged
Merged
Conversation
The docs-claims rules prove no doc names something kit lacks. They cannot prove the
reverse, and not by oversight — an undocumented command has no doc reference for a
forward gate to check. So the gate that exists could never have caught an undocumented
enforcement off-switch, which is exactly what was sitting there.
`undocumented commands` requires every human-facing command to appear in at least one
non-exempt doc, in invocable form. It found 13: `kit broker` plus its two subcommands,
all seven `kit profile` subcommands, `kit insight`, `kit memory context`, and
`kit hooks uninstall` — whose installers were documented while the off-switch for the
git-hook enforcement floor was not. All 13 are now in docs/COMMANDS.md, with text taken
from each command's own help string rather than written from the outside.
THE ORACLE IS A UNION, and that is the design decision worth reviewing. Each source
alone hides a real gap: the committed contract lists top-level verbs and no subcommands,
so it cannot see `kit hooks uninstall`; `COMMAND_HELP` lists subcommands but omits some
top-level verbs, so it cannot see `kit insight`. Measured on this tree: contract-only
reported 1 gap, help-only reported 9, and neither was a superset of the other.
Harness-audience verbs are excluded — `gate-bash`, `gate-env`, `gate-fs`, `gate-egress`
are invoked by hook wiring and never typed, so requiring them in human docs would
manufacture busywork. That exclusion reads `x-kit-audience` from the contract rather than
a hardcoded list, so a new gate verb inherits it. This also corrects my own first pass,
which called those three a documentation gap before I checked how the contract
classifies them.
Brace form counts (`kit hooks {install,add,sync}` documents each member); without it the
repo's own house style would read as 40+ false gaps.
Mutation-proved: deleting the `kit hooks uninstall` row from COMMANDS.md turns the rule
red naming that exact command; restoring it returns to green. 7 new tests cover the pass
case, the fail case, brace form, the harness exclusion, the subcommand the contract
cannot express, and didNotRun when no oracle can be read.
Two unrelated things fixed rather than worked around, both found by this work:
- `skips node_modules` asserted `res[0].status`, so adding a row first displaced it. The
row is now appended, and that assertion looks rows up by name — a positional assertion
in a test about something else is a trap for the next person.
- The `writeCheckDetail` failed-write test forced its precondition with `chmod 0o500` and
never checked whether the mode denied this process; root mkdirs through it, so the test
reported a working write path as broken. Same guard as the WAL-sidecar test in 6.6.3.
Proven pre-existing on a clean tree first.
KNOWN LIMIT, recorded rather than papered over: the same check is impossible for flags.
Nothing inventories the flags kit ACCEPTS — the contract says `x-kit-args-modeled: false`
on all 71 commands, and the forward rule's flag oracle is a source scrape that also
contains flags kit passes to subprocesses (`--severity` for trivy, `--name-only` for
git). My first attempt at the flag inverse produced "53 of 101 undocumented" from that
contaminated set; the number was meaningless and is reported nowhere. Argument modeling
has to come first.
self-audit: 16 rules, 0 fail, 0 warn.
|
✅ Docker image built successfully
|
This was referenced Aug 20, 2026
Merged
sandstream
added a commit
that referenced
this pull request
Aug 20, 2026
Minor, not patch: `kit` now REJECTS a flag it does not accept, on every command. Nothing documented stops working — the flag surface is generated from the source and its drift test keeps it that way — but an invocation that silently did nothing now exits 1, and a script that passed a flag kit ignored will notice. That deserves a minor. The section: unknown flags rejected from a declared surface (#488), the union view over every sealed audit log (#470), documentation checked in both directions (#491), the git-hook floor reporting where it is and whether it can fail (#496, #497), triage's pip path no longer scoring higher for running fewer probes (#489), and `kit add --list` listing adapters instead of trying to provision one called "--list". Dated the day it ships, not in advance: 6.6.3 was dated five days early and went stale twice before it went out. The date claims when a version SHIPPED. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The docs-claims rules prove no doc names something kit lacks. They cannot prove the reverse, and not by oversight — an undocumented command has no doc reference for a forward gate to check. So the gate that exists could never have caught an undocumented enforcement off-switch, which is exactly what was sitting there.
The new
undocumented commandsrule requires every human-facing command to appear in at least one non-exempt doc, in invocable form. It found 13:kit hooks uninstallkit broker,broker enforce,broker enforce-readinessROADMAP.mdandCHANGELOG.md, both exempt — a shipped command whose only trace is the roadmapkit profile× 7 (show,freeze,check,sign,verify,export,import)kit memory context,kit insightAll 13 are now in
docs/COMMANDS.md, with text taken from each command's own help string rather than written from the outside.Type of Change
Related Issues
None — found by auditing the docs against the 6.6.5 surface. Same family as #470 and #489: a verdict that reads stronger than its evidence.
Changes Made
undocumentedCommands()insrc/self-audit-docs.ts. The oracle is a union of two sources, which is the design decision worth reviewing. Each alone hides a real gap: the committed contract lists top-level verbs and no subcommands, so it cannot seekit hooks uninstall;COMMAND_HELPlists subcommands but omits some top-level verbs, so it cannot seekit insight. Measured on this tree — contract-only reported 1 gap, help-only reported 9, neither a superset of the other.x-kit-audiencein the contract rather than a hardcoded list, so a newly added gate verb inherits the exclusion.gate-bash,gate-env,gate-fs,gate-egressare invoked by hook wiring and never typed by a human; requiring them in human docs would manufacture busywork. This also corrects my own first pass, which called those three a documentation gap before I checked how the contract classifies them.kit hooks {install,add,sync}documents each member. Without it the repo's own house style reads as 40+ false gaps.docs/COMMANDS.md: two new sections (exec-broker runtime posture, traveling profile) plus rows forhooks uninstall,memory contextandinsight.Testing
Test Coverage
npm test)Full suite: 4265 tests, 4262 pass, 0 fail, 3 skipped.
self-audit: 16 rules, 0 fail, 0 warn. Every commit went through the repo's own pre-commit gate (security scan-staged→build→npm test); no--no-verify.Mutation-proved: deleting the
kit hooks uninstallrow fromCOMMANDS.mdturns the rule red naming that exact command; restoring it returns to green.7 new tests cover the pass case, the fail case, brace form, the harness exclusion, the subcommand the contract cannot express, and
didNotRunwhen no oracle can be read.Manual Testing
kit self-audit→PASS undocumented commands: all 136 human-facing command(s) appear in the docs (6 harness-audience excluded).docs/COMMANDS.md→ the rule fails and names it.documented commandswent 730 → 742 refs, all still resolving — the new docs add claims and none of them is drift.Breaking Changes
None / N/A
Checklist
npm test)Two unrelated fixes, both found by this work
Neither was worked around:
skips node_modulesassertedres[0].status. Adding a row first displaced it, failing a test about something else entirely. The row is now appended, and that assertion looks rows up by name — a positional assertion in a test about an unrelated property is a trap for the next person.writeCheckDetailfailed-write test forced its precondition withchmod 0o500without checking whether the mode denies this process. root mkdirs straight through it, so the failure path was never exercised and the test reported a working write path as broken. Same guard, same reasoning, as the WAL-sidecar test in 6.6.3: probe with a real write, skip loudly when the mode does not deny. Proven pre-existing on a clean tree before touching it.Known limit, recorded rather than papered over
The same inverse check is impossible for flags. Nothing in the repo inventories the flags kit accepts:
contracts/kit.opencli.jsoncarriesx-kit-args-modeled: falseon all 71 commands, and the forward rule's flag oracle is a scrape of source literals that also contains flags kit passes to subprocesses (--severityfor trivy,--name-onlyfor git,--no-same-ownerfor tar).My first attempt at the flag inverse produced "53 of 101 undocumented" from that contaminated set. The number was meaningless and is reported nowhere. Argument modeling in the contract has to come first — that is its own PR, not something to half-do here.
Reviewer Notes
The judgement worth a second opinion is requiring the invocable form (
kit profile import) rather than accepting a prose mention. It is deliberate and symmetric with the sibling rule, which extractskit <command>refs — a command a reader cannot see how to type is not documented. The cost is that a doc discussing a command in prose only still counts as a gap;docs/ENV_FUELING.mdmentions "profile import" that way and did not satisfy the rule.Second: exempt docs (
ROADMAP.md= planned surface,CHANGELOG.md= historical record) deliberately do not count as documentation for this rule. That is what surfacedkit broker— shipped, but described only where future and past work live.🤖 Generated with Claude Code