24. Documentation gate in scripts/check.sh --fast (2026-11-21)
- 24.1 Fast docs verification runs on every commit.
site/check_docs.pyruns insidescripts/check.sh --fastright aftersite/bundle.py. It checks everycpfence insite/content/*.mdanddocs/one-page-cheat-sheet.mdwith one batchedcpl check, executes everysite/examples/*.cpfixture and write-code course reference throughcpl run, enforces the 250-line cheat-sheet budget, and validates every local HTML link and heading fragment insite/_build/. Reason:site/test_site.pycompiles every snippet withg++, taking ~55 s, so it sat outside the fast gate and docs drifted (the cheat sheet exceeded 250 lines). Runningcpl check+cpl runkeeps the fast gate under a few seconds while catching broken examples immediately;site/test_site.pyremains the full C++17 verification suite. Reversible: remove thesite/check_docs.pystep fromscripts/check.shor replace with a faster Rust subcommand if the docs corpus grows past a few seconds.
- 24.2 Generated Error & Lint Index (
site/errors.py) with 100% compiler-code coverage.site/build.pygenerateserrors.htmlplus one flaterror-<CODE>.htmlpage per diagnostic, warning, runtime trap, and lint code (currently 61 codes: 52 fromcpl-diag+ 9 fromcpl-lint), indexed insearch.jsonand packed intodist/cp-lang.html.site/check_docs.pyparsescrates/cpl-diag/src/lib.rsandcrates/cpl-lint/src/lib.rsdirectly, failing the fast gate if any Rust code is missing or any trigger/fix pair stops reproducing its code or compiling cleanly. Reason: flat filenames integrate automatically withsite/bundle.py(*.htmlglob) and relative asset paths, adding ~40 KiB gzipped; diffing against the Rust sources prevents the error index from ever drifting behind new diagnostics or lints. Reversible: movesite/errors.pyentries into Rust docstrings or acpl explain --dumpsubcommand oncecpl explainexists, keeping the sameerror-<CODE>.htmlURLs.
- 24.3 Cookbook generated directly from validated ports (
site/cookbook.py).site/build.pyrenderscookbook.htmlby reading live.cpsources fromproto/ports/ecnerwala/across 6 competitive programming categories (22 recipes covering trees/graphs, segment/Fenwick trees, DP, math/combinatorics, binary search/greedy/interactive, strings/geometry).site/check_docs.pyverifies every referenced port exists, passescpl check, and matches its sample cases viacpl run. Reason: reading directly fromproto/ports/ecnerwala/guarantees zero code duplication and keeps cookbook recipes automatically tested under the corpus gate and fast docs gate. Reversible: deletesite/cookbook.pyand its hook insite/build.py/site/check_docs.py, or expand into per-category pages if the recipe count outgrows one page.
- 24.4 Stdlib module coverage enforced in
site/check_docs.py.site/check_docs.pyscansstdlib/*.cp(excludingprelude) and requires every module to be documented asstd.<module>insite/content/stdlib.md(currently 24/24 modules). Reason: previously 12 of 24 non-prelude stdlib modules were absent fromstdlib.md; checking againststdlib/*.cpprevents new modules from landing undocumented. Reversible: removecheck_stdlib_module_coverage()fromsite/check_docs.pyor replace with generatedcpl doc stdlibHTML once docstrings cover every stdlib item.
- 24.5 Writable-from-docs audit harness (
scripts/writable-from-docs.py). Addedscripts/writable-from-docs.py(with offline unit tests inscripts/test_writable_from_docs.py) to evaluate theAGENTS.md"Writable from the docs" rule: sends a fresh model ONLY the 8-file docs bundle plus an unseen statement fromcorpus/statements/(filtering out already-ported IDs), then checkscpl check,cpl build, andcpl runon every sample case. Initial 10-problem audit (abc380b–abc387c, recorded inresearch/writable-from-docs.md) improved compile pass from 7/10 to 8/10 after fixing 5 docs gaps ("{n}"vs.to_str(),let k: Int = read()vsread(Int), freeabs(x), 1-based array bounds, single-forcomprehensions,Deque.push). Reason: turns the writable-from-docs principle into a repeatable, quantitative measurement that surfaces concrete docs gaps on unseen contest problems. Reversible: deletescripts/writable-from-docs.py,scripts/test_writable_from_docs.py, andresearch/writable-from-docs.md.
- 24.6 Ports gallery page generated from
research/PORTS.mdanddream/*.cp(site/ports_gallery.py).site/build.pyrendersports.htmldirectly fromresearch/PORTS.mdplus live.cp,proto/ports/<group>/dream/<name>.cp, and accepted C++ originals, showing up to 16 featured side-by-side cards (prioritizing all dream-bearing ports, with client-side All / With dream / search filtering) plus a 60-row index table.site/check_docs.pyverifiesresearch/PORTS.mdparsing, file existence, and rendered CP / dream / C++ panes. Reason: lets cold readers compare real validated CP Lang solutions, their unconstrained dream form, and accepted C++ side by side while keepingdist/cp-lang.htmlunder the 2.6 MB cap (1,988 KiB). Reversible: deletesite/ports_gallery.pyand its hooks insite/build.py,site/check_docs.py, andsite/assets/style.css.
- 24.7 Playground shareable links, sample runner, and verbatim CLI error parity.
Added URL-hash shareable links (
#share=<base64url>encoding{source, stdin, samples}with no server dependency, working online and offline), a multi-case sample runner pre-populated with verified sample cases for all 23 playground presets, and verbatim CLIresult.stderrrendering in[data-cli-stderr]alongside clickable jump-to-line diagnostics. FixedPlayground::checkincrates/cpl-wasm/src/lib.rsto returnexitCode = 0on warning-only diagnostics (matchingcpl checkon the CLI). Added Rust parity testerror_and_trap_stderr_matches_cli_verbatimincrates/cpl-wasm/tests/parity.rsand end-to-end Node/WASM + share-link + preset-sample parity tests insite/test_playground_parity.py, wired intosite/check_docs.py. Reason: keeps browser playground errors byte-for-byte identical to the CLI and lets readers share and sample-test solutions directly in the browser without any backend. Reversible: revert the UI controls insite/compiler.py/site/assets/playground.jsand removesite/test_playground_parity.py.
- 24.8 Diagnostics registry (
crates/cpl-diag/src/registry.rs) +cpl explainas single source of truth for error-index pages. Moved every diagnostic code's title, summary, explanation, trigger, and fix intocrates/cpl-diag/src/registry.rs(REGISTRY: &[CodeInfo]) andcrates/cpl-lint/src/lib.rs(LINTS), addedcpl explain <CODE>andcpl explain --jsonincrates/cpl-cli, and refactoredsite/errors.pyto generate all 69 error/lint pages directly fromcpl explain --json. Reason: eliminates the 700-line Python catalog duplication so site error pages and CLIcpl explainalways share one verified registry (and immediately picked up the 6 new taste lintsL0501–L0506). Reversible: restore the staticERROR_CATALOGlist insite/errors.pyand removecrates/cpl-diag/src/registry.rsandexplain_codeincrates/cpl-cli/src/lib.rs.
- 24.9 55-problem mixed-difficulty writable-from-docs benchmark, ratchet, and weekly workflow.
Pinned 55 unseen mixed-difficulty statements (
research/writable-from-docs-set.json: 35 CF Div2 B–E, 12 ABC D–E, 8 ARC A–B, verified unported), upgradedscripts/writable-from-docs.pyto default togpt-5.4with parallel workers and ratchet JSON (research/writable-from-docs.json), wired offline ratchet enforcement intoscripts/scoreboard.py --fast --check, and added weekly CI workflow.github/workflows/writable-from-docs.yml. Set the ratchet noise margin to 5% (max(prev, observed - 0.05)) becausegpt-5.4does not accepttemperature=0(~±2 problems variance onn = 55). Reason: turns writable-from-docs from a one-off small-set audit into an ongoing regression gate over realistic contest difficulty. Reversible: delete.github/workflows/writable-from-docs.yml,research/writable-from-docs.json,research/writable-from-docs-set.json, and thewritable_from_docsblock inscripts/scoreboard.py. Update: the workflow isworkflow_dispatchonly, like every workflow until Ryan turns automatic runs on (Actions minutes); restoreschedule: cron "0 6 * * 1"to run it weekly.
- 24.10 Gold-standard
From C++guide andIdiomspage (site/content/cpp-guide.md,site/content/idioms.md). Upgradedsite/content/cpp-guide.mdwith an editorial-first side-by-side C++17 vs CP Lang comparison (cf2069c), named-invariant structs, and zero-sentinel optionals, and addedsite/content/idioms.mdcovering domains, reductions, optionals, grids, sorting/heaps/maps, binary search, and stdlib structures — everycpfence verified bysite/check_docs.py. Reason: gives C++ contestants and cold readers exemplar-grade patterns matchingdesign/EXEMPLARS-PORTS.mdwhile keeping every example mechanically checked against the compiler. Reversible: remove theidiomsentry insite/build.py, deletesite/content/idioms.md, and revertsite/content/cpp-guide.md.
- 24.11 Deterministic 55-problem writable-from-docs v2 set + float tolerance (
1e-6). Audited the v1 55-problem manifest and replaced 15 un-evaluable problems (2 interactive, 5 CF redirect duplicates, 8 multi-answer constructive problems where valid answers failed exact string match) with 15 clean unique deterministic-output unseen problems, and added token-wise1e-6relative/absolute float tolerance toscripts/writable-from-docs.py::outputs_match. Reason: pass rate must reflect real correctness, not judge-harness false negatives on valid constructive outputs, redirected duplicates, or3e-16float rounding. Reversible: revertresearch/writable-from-docs-set.jsonandoutputs_matchinscripts/writable-from-docs.py.
- 24.12 Generated
Reading exemplarsgallery (site/exemplars.py) andTry itbuttons on every docscpfence. Addedsite/exemplars.pygeneratingexemplars.htmldirectly fromproto/ports/**/dream/*.cppaired with validated ports plusdesign/sketches/ioi2025/*.cp, and wiredTry itlinks (playground.html#share=<base64url>) intosite/build.py::code_block_htmlfor every renderedcpcode block, both gated insite/check_docs.py. Reason: lets cold readers compare dream vs port without hand-maintained drift and run, trace, or share any docs snippet in one click (online or in the offlinedist/cp-lang.htmlbundle). Reversible: removeexemplarsfromsite/build.py, deletesite/exemplars.py, and removetry_itfromcode_block_html.
- 24.13 Generated Stdlib API reference (
site/stdlib_api.py) + zero-undocumented-pub fngate. Wiredsite/stdlib_api.pyonto the existingcpl doc --format json stdliboutput (avoiding duplicating the dev-tools doc extractor) to generatestdlib-api.html, documented all 55 remaining undocumentedpub fn/pub @get fndeclarations acrossstdlib/*.cpwith O(...) costs, and addedcheck_stdlib_api_docs()insite/check_docs.pyfailing on any undocumented public function. Reason: keeps the stdlib API reference generated from one source of truth (///comments) and prevents undocumented public stdlib functions from landing. Reversible: removestdlib-apifromsite/build.py, deletesite/stdlib_api.py, and removecheck_stdlib_api_docs()fromsite/check_docs.py.