OpenProgram Docs

Docs governance

Agents run one command. It fails on what a program can judge, and names the pages a change may have outdated.

pre-commit Staged pages affected_tests Changed files refresh-dev-instance.sh Since last deploy, report only publish-github.sh Every page docs_site.check One command Errors file, line, fix Warnings content band Affected pages ask, or acknowledge
  1. pre-commitStaged pages
  2. affected_testsChanged files
  3. refresh-dev-instance.shSince last deploy, report only
  4. publish-github.shEvery page
  5. docs_site.check
  6. Errorsfile, line, fixWarnings: content bandAffected pages: ask, or acknowledge

Entry point

CommandDoes
python -m scripts.docs_site.check a.py docs/x.htmlNamed paths. Blocks.
… checkChanges against HEAD. Blocks in a worktree. Only reports in the shared checkout on dev.
… check --base REVA revision range. Blocks.
… check --stagedThe index, for the hook. Blocks.
… check --allEvery page, plus site-wide rules. Blocks.
--report-onlyExit 0 unless the tool itself failed
--jsonFindings and impact, for scripts
--unfilteredTurns the diff filter off: every page citing a changed file
--ack PAGE … --reason TEXTRecord that a page was checked for this change

Budget: 5 s changed, 15 s everything. Standard library and the CLI parser only: no node, no site build, no network. Exit 0: no error in scope, or --report-only. Exit 1: an error in scope. Exit 2: the tool itself failed, or a usage error such as a bad --ack.

Format

RuleFix
format.style-element format.script-elementMove to site.css, or delete
format.event-handler format.javascript-url format.embedDelete it: a page runs and embeds no code
format.style-attribute format.stylesheet-linkUse a site class
format.missing-title format.missing-description format.missing-h1 format.multiple-h1Each page has exactly one of each
format.missing-pair format.orphan-zhAdd the other language
format.structure-mismatchSame sequence of headings, tables, rows, list items, code, folds and figures in both languages
format.unregisteredAdd to a section of TAB_SECTIONS; a design page's section title must be listed in DESIGN_AREAS. Editing nav.py rechecks every page.
format.cjk-in-englishMove the text to the .zh.html
format.markdown-sourceConvert to HTML. Only generated reference pages stay Markdown.
format.prototype-staleA listed prototype has no script: remove it from the list
format.zh-staleWarning: the English text changed and the Chinese page did not
links.broken links.fragmentFix the source link. Checked in the sources, so no build is needed.
CaseBehaviour
Failing page outside the listbuild.py raises DocsFormatError, with file, line and fix. There is no iframe fallback.
OPENPROGRAM_DOCS_FORMAT=quarantineMarkup unsafe to show publishes as a visible error page, in that language only; other faults are logged and the page renders. Set only by deploys and self-update.
PROTOTYPE_PAGESThe list is in governance/policy.py. A new page there needs a reason in LOOSENED_BECAUSE.

Content

MeasureMeasured on 363 English pagesErrorWarning
Words in a paragraphp50 19, p95 48, p99 64, max 78> 80> 60
Prose words on a pagep50 188, p95 1139, p99 1957, max 10199> 2000> 1500
Prose share, at 150 or more prose words27 pages above 0.60, 8 above 0.70> 0.70> 0.60
Same sentence twice on a page0any–
Same sentence across pages: 6 or more content words, Jaccard 0.87 pairsany–
Sentence covered by one table row, a table of up to 4 rows, or a figure: 6 or more content words; a row counts its column headers0 at 0.8, 17 at 0.7, of 7077≥ 0.8≥ 0.7
Words in a table cellp50 6, p95 27, p99 42, max 138> 140> 80
Section of bullets only, notes aside115 sections, 21 with 6 or more, max 15≥ 8 items≥ 6 items
One block sequence across a tab of 10 or more pages (--all only)Highest: reference 8%, capabilities 3%, design 1%> 25%> 15%

The repository holds 726 HTML sources, 363 pairs. Content rules read English; Chinese follows through structure. Prose means p, li, dd, blockquote, figcaption and any text sitting directly in a container, outside tables, figures, code and flow twins.

Baselinegovernance/baseline.json
What can enterContent rules only, never format or claims
Entryrule, path, subject hash and a reason of at least 20 characters; page-level rules also store max, the measured size
GrowsAn entry absent from the fixed reference (refs/publish/last, else the merge base with stable) is an error on every run, and never hides a finding
ShrinksAn entry that no longer matches is an error: delete it
Editing the textA sentence or paragraph rule: the hash changes, so the finding returns. A page-level rule: the page may not exceed max, which only comes down.

Claims

ReferenceVerified againstMeasured
Commands and flagsLines starting openprogram, split with shlex, walked through build_parser()505 commands, 113 flags
Removed verbs and flagsA verb or flag the range removed, written as a whole code span. A flag other commands keep counts only on a page that names its command. A top-level verb counts where the page writes openprogram with it or lists it among two or more other top-level verbs, because such a word often names an application or a target too.Only in a range that changes the parser
Repository pathsTracked file or directory; git-ignored build output counts; patterns skipped1004
Partial paths and bare file namesOn product pages, a source suffix and a known top segment must resolve somewhere. On any page, one that resolved before this change and no longer does.1310 and 1080; 7 product and 229 record hits unresolved before the rule
ModulesDotted openprogram.* that resolves to a file, or an attribute of one; domains excluded134
Routes/api/* and /healthz found in interfaces/server; a literal route wins, a parameter fits only if this change did not remove that literal, and only a reference ending * fits what is beneath235
Environment variablesOPENPROGRAM_* present in tracked files74 distinct
Settings keysArgument of openprogram config, or a key that vanished from SETTINGS in the range and a page still names139 exact; 74 lookalikes are not settings
MarkerMeaning
<code data-claim="example">An illustrative path or command, or a name a design rejected. Not checked.
data-claim="invalid"A command shown as deliberately wrong. A real command cannot be marked as an example.
references/Git-ignored peer clones: path syntax only

Code to docs

PartRule
ReferenceFile path, or directory 3 or more levels deep, from the claims above. Bare file names count only if unique.
Command, key, routeMapped to their source: cli/parser.py, state/settings.py, interfaces/server/routes/. A code span equal to a key is a setting reference.
<meta name="covers" content="openprogram/x/ scripts/y.py">Explicit, English page only, always counts. Required where a page has no reference. content="none" declares an index or study that describes no code.
FilterWith more than 3 pages on a file, a page counts only when a code word on it is an identifier on the changed lines, not a string, comment or call keyword. For cli/parser.py the parser diff decides: only pages with a command under a changed command path. For state/settings.py, the keys of the changed blocks count as changed. The output says how many pages were left out; --unfiltered turns the filter off.
ReportedThe English text of the page did not change and no acknowledgement; a page edited without visible change is shown as edited, please confirm; all of them, ranked
Replay of 252 commitsPages p50Pages p90Commits with noneDoc commits predicted, of 123
Any directory reference1734242
Exact file, deep directory7232140
Plus diff filter on every file5173738
Plus diff filter above 3 pages (chosen)6172440

With the covers declarations in place: p50 6, p90 26, 12 commits with no page; 36 of the 41 commits that changed both code and docs were predicted.

AcknowledgementRule
KeyPage, changed file, and the blobs the decision went from and to. A range counts only when acknowledged steps chain from its base to its tip.
Store<git-common-dir>/openprogram-docs/acknowledgements.jsonl, shared by worktrees, appended
Editing the file againA new blob, so the page is asked again
LimitsEach page is named and must be in this change's impact report; only files pointing at it are recorded; the shared checkout needs explicit paths. A script looping over --json can still do it blindly.
Lost storeWarnings return. Nothing breaks, so it need not be versioned.

Where it runs

PointRunsBlocksWhy
Commit in the main checkoutpre-commit, --staged, when docs, the baseline or the policy are stagedErrors on staged pagesThe author is known; with git commit -- <paths> the index excludes other sessions' files
Commit in a worktreecommit_gate.py, a PreToolUse hook in the tracked .claude/settings.json, blocks git commit and git merge.Errors in the branch~/.git-hooks cuts the .git path at its first space, so no Git hook runs here
Merge or fast-forward in the main checkoutpost-merge: --base ORIG_HEAD --report-onlyNothingRuns no pre-commit; a cherry-pick runs nothing at all, so it is caught by the next deploy report or at publish
affected_tests --runEvery changeErrors on named paths or a worktree's own changesAgents already run it
affected_tests --run, shared checkout, no pathsEvery changeNothing: reportsThe dirty tree holds other sessions' pages
refresh-dev-instance.sh--base <last deployed> --report-only, then quarantine buildNothingCommits there come from all sessions
publish-github.sh--all, before pushingEvery errorThe whole product leaves the machine; rare and deliberate

Affected pages and warnings only inform: whether a page needs rewriting takes judgement. Hooks are unversioned, so scripts/git-hooks/install.sh copies them on every deploy and publish, recording the commit beside them so an older checkout cannot downgrade them; the main checkout warns when one is stale. A hook without a venv, or exit 2, never blocks.

Test selection

CaseBehaviour
A change only under apps/webAny non-empty change builds the graph and runs all 27 contract files, 579 tests in 21 s
A docs changeSelection.docs_check runs the entry point. checklinks fails when docs/_site is missing.
A code changeThe entry point runs on every change for impact
A worktree with no node_modules--run clones both node_modules from the main checkout with cp -c, like stage-release-assets.sh: 10 s, 160 MB. Never links.
A selected Python test that runs nodeMarked by its source; the clone runs for it too. If it cannot, it is left out and counted, exit 2
No source to clone, or no nodeExit 2, naming how many tests could not run and why
A Web run reporting tests 0, or nothing selected for a real changeFailure, never success

Implementation status

Everything above is implemented. The three pages in baseline.json still need an editorial split. Staged and range checks read nav.py and parser.py from the snapshot, but the provider verbs come from disk, so claims against a dirty copy of them only warn.

Last updated · 2026-11-25