Skip to content

[feat] doccov: README<->builtin doc-consistency gate#5

Merged
vt128 merged 1 commit into
masterfrom
feat/doccov-gate
Jun 14, 2026
Merged

[feat] doccov: README<->builtin doc-consistency gate#5
vt128 merged 1 commit into
masterfrom
feat/doccov-gate

Conversation

@vt128

@vt128 vt128 commented Jun 14, 2026

Copy link
Copy Markdown
Member

What

Adds doccov, the documentation-consistency gate for the Star* ecosystem, living here in meta so all repos share it.

A Star* module exposes its script-facing API as Starlark builtins, each built with starlark.NewBuiltin("<name>", fn). doccov statically scans a module's Go source for those builtins and fails if any is not documented in the module's README — so docs can never silently drift behind the code.

Pieces

  • doccov/main.go — AST-scans non-test *.go for every starlark.NewBuiltin(...) first argument (handles "module.fn" and the ModuleName + ".fn" form), reduces to the short name, and checks it appears as a backtick word in README.md. Exit non-zero on omission or a missing README; exit zero when no builtins are found (repo doesn't opt in). Stdlib only.
  • doccov/main_test.go + testdata/ — surface extraction, backtick coverage, and pass / fail / no-builtins / ignore / missing-readme end-to-end cases.
  • go.modmeta becomes module github.com/1set/meta (go 1.19), so the tool runs as go run github.com/1set/meta/doccov@master ..
  • go-ci.yml — opt-in doc-coverage input + a gating step on the checks leg (fetched with go run, like govulncheck). Off by default; core libs unaffected.
  • selftest.yml — a doccov job running go test -race ./doccov/.

Validation

Run against real ecosystem modules:

module result
starpkg/sqlite 29/29 documented → pass
starpkg/markdown surfaces undocumented custom_converterfail (real gap)
starpkg/qrcode surfaces undocumented pure_asciifail (real gap)

Tool passes go test -race -count=2 locally and go test on the go1.19 floor in Docker.

Rollout

Consuming starpkg domain modules opt in per-repo (re-pin + doc-coverage: true) alongside their doc fixes. GoDoc completeness stays covered by revive's exported rule in the Analyze step.

🤖 Generated with Claude Code

Adds doccov, a static gate that fails when a module exposes a Starlark
builtin (starlark.NewBuiltin) that is not documented in its README — so
docs cannot silently drift behind the code.

- doccov/main.go: AST-scan non-test *.go for NewBuiltin first-arg names
  (handles "module.fn" and ModuleName+".fn"), check each appears as a
  backtick word in README.md; exit non-zero on omission. Stdlib only.
- doccov/main_test.go + testdata: surface extraction, backtick coverage,
  pass/fail/no-builtins/ignore/missing-readme cases.
- go.mod: meta becomes module github.com/1set/meta (go 1.19), so the tool
  is runnable as `go run github.com/1set/meta/doccov@master .`.
- go-ci.yml: opt-in `doc-coverage` input + a gating step on the checks leg
  (fetched with `go run`, like govulncheck). Off by default; core libs
  unaffected.
- selftest.yml: a job that runs `go test -race ./doccov/`.

Validated against real modules: sqlite passes (29/29); markdown and qrcode
each surface a genuine undocumented builtin (custom_converter, pure_ascii).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vt128 vt128 merged commit 904564b into master Jun 14, 2026
10 checks passed
@vt128 vt128 deleted the feat/doccov-gate branch June 14, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant