Skip to content

[doc] standardize all lib/* READMEs + add a dogfooding doc-coverage gate#160

Merged
vt128 merged 1 commit into
masterfrom
docs-standard
Jun 13, 2026
Merged

[doc] standardize all lib/* READMEs + add a dogfooding doc-coverage gate#160
vt128 merged 1 commit into
masterfrom
docs-standard

Conversation

@vt128

@vt128 vt128 commented Jun 13, 2026

Copy link
Copy Markdown
Member

What

Two things, both about making the module docs trustworthy and keeping them that way:

  1. Rewrote all 18 lib/* module READMEs to one standard (now recorded in CLAUDE.mdDocumentation standard for lib/* READMEs). Each README now opens with title + purpose + capability profile, then a scannable functions table (every script-visible member as a backtick token), constants/types tables, runnable examples ending in # Output:, and an explicit notes/boundaries section. The old framework-generated boilerplate (empty per-function #### Parameters tables, inconsistent style) is gone — the docs read the same way and parse cleanly for both humans and AI agents.

  2. Added a programmatic coverage gate. tools/doccov/coverage.star matches every member name against its README (as a backtick-quoted identifier); doc_coverage_test.go enumerates the authoritative surface (each module's registered members across the Module/Struct/flat shapes) and runs the .star matcher through a Machinethe check dogfoods the regex module. It runs in make ci via ./... (a missing member fails CI) and standalone via make doc-check.

    Baseline 225/234 → 234/234 across 18 modules. (go.starlark.net-backed math/struct/time have no lib README and are skipped.)

Every example verified by execution

A throwaway harness extracted and ran every # Output: example through a Machine and diffed actual vs documented. That surfaced — and this PR fixes — real inaccuracies that manual review had missed:

module defect fix
re collection outputs used single quotes Starlark print renders strings inside collections with double quotes
file read_bytes/trim_bom showed the b"..." repr print of bytes shows raw content; examples rewritten to be unambiguous
random print(0 <= val < 1) chained comparison — Starlark rejects it at parse time; parenthesized
go_idiomatic claimed shared_dict supports iteration + builtin len() supports neither (only .len()); verified by execution
stats covariance_population shown as 1.0; a stddev digit off; sigmoid listed twice corrected to 0.666…; fixed; de-duplicated

The 9 members undocumented at baseline (http head + several try_*, go_idiomatic is_nil, json encode_indent) are now covered.

Verification

gofmt/vet clean; make doc-check → 234/234; full -race -count=2 ./... green; the go1.19 floor (Docker) green (incl. TestDocCoverage). Docs-and-one-test change; no library code touched.

Rewrites all 18 lib/* module READMEs to one standard (CLAUDE.md "Documentation
standard"): title + purpose + capability profile, a scannable functions table
up front (every script-visible member as a backtick token), constants/types
tables, runnable examples ending in `# Output:`, and an explicit
notes/boundaries section. The old framework-generated boilerplate (empty
per-function Parameters tables, inconsistent style) is gone; the docs now read
the same way and are easy for both humans and AI agents to parse.

Adds a programmatic coverage gate. tools/doccov/coverage.star matches every
member name against its README (as a backtick-quoted identifier); doc_coverage_
test.go enumerates the authoritative surface (each module's registered members
across the Module/Struct/flat shapes) and runs the .star matcher through a
Machine — so the check dogfoods the regex module. It runs in `make ci` via
./... (a missing member fails CI) and standalone via `make doc-check`. Baseline
was 225/234; now 234/234 across 18 modules. (go.starlark.net-backed math/struct/
time have no lib README and are skipped.)

Every runnable example was verified by execution. Fixes the inaccuracies that
surfaced: re's collection outputs used single quotes (Starlark print renders
strings inside collections with double quotes); file's read_bytes/trim_bom
examples showed the `b"..."` repr instead of print's raw content; random's
`print(0 <= val < 1)` used a chained comparison Starlark rejects at parse time;
go_idiomatic claimed shared_dict supports iteration and the builtin `len()`
(it supports neither — only the `.len()` method); stats documented
covariance_population as 1.0 (it is 0.666…) and a stddev value off by its last
digit, and listed sigmoid twice. The 9 members undocumented at baseline (http
head + several try_*, go_idiomatic is_nil, json encode_indent) are now covered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Jun 13, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 100 minor

Results:
100 new issues

Category Results
CodeStyle 100 minor

View in Codacy

🟢 Metrics 17 complexity · 0 duplication

Metric Results
Complexity 17
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (512d891) 7692 7277 94.60%
Head commit (1f14ebb) 7692 (+0) 7277 (+0) 94.60% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#160) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (512d891) to head (1f14ebb).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #160   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files          49       49           
  Lines        6177     6177           
=======================================
  Hits         5770     5770           
  Misses        258      258           
  Partials      149      149           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vt128 vt128 merged commit 7caaa35 into master Jun 13, 2026
12 checks passed
@vt128 vt128 deleted the docs-standard branch June 13, 2026 02:34
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