You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(site): keep the API docs under the Pages size limit and fix broken internal links #624
Site size. The generated site is 973 MB uncompressed, 90.6% of the 1 GiB Pages limit: 807 MB on Oct 18, 962 MB on Oct 22. Mathlib pages are 570 MB; Complexity pages about 106 MB, Std 94 MB, Init 74 MB, the search index 48 MB, Lean 46 MB. ci(docs): publish the API documentation to GitHub Pages #583's size check fails before deploying above 1 GiB, and Pages then keeps serving the previous deployment, so overflow means stale docs rather than an outage. Measured quick wins: DISABLE_EQUATIONS=1 saves about 48 MB, and dropping Lean/Std/Lake modules the library never imports saves about 37 MB. Together that's roughly two more weeks. The lasting fix: link dependency declarations (Mathlib, Lean core, Std) to their official doc sites instead of hosting them, if doc-gen4 supports it; otherwise host elsewhere. Investigate and recommend.
Broken internal links. 404 links on 323 library pages point at pages that don't exist, e.g. Complexity/Tactic/PolyTime.html → Cslib/Tactic/PolyTime.html. That suggests a module-to-namespace mapping assumption (the Complexity. → Cslib. prefix convention), worth fixing at the source or in the doc config.
Done when the site has durable headroom (or alternative hosting), and the internal link check is clean. Available.
active: claimed by worker-antigravity-20261024, delegated by coordinator-claude-c4b0c164-20261023. Branch: fix/docs-size-and-links-624, worktree: /home/samuel/Code/complexitylib-wt/agy-624.
Starting investigation of:
Broken internal links across library pages (e.g. Complexity/Tactic/PolyTime.html → Cslib/Tactic/PolyTime.html).
Site size reduction and external dependency doc linking in doc-gen4, holding any .github/workflows/docs.yml edits until doc(guide): add a Verso guide project #599 merges.
1. Root cause & full classification of the 404 broken internal links (323 pages)
In doc-gen4 (DocGen4/Output/DocString.lean:41), nameToLink? unconditionally rewrites any inline code span <code>s</code> with s.endsWith ".lean" && s.contains '/' to <a href="<root>/<s without .lean>.html">s</a> without checking res.moduleNames.contains.
All 404 broken links come from this rule:
340 links (in Complexity/## References sections): external/historical provenance file paths (e.g. MassProduction/Sorting.lean, LowerBound/Fusion/..., lean/Proofs/..., or unmerged cslib branch paths).
59 links (in Complexity/ docstrings): shorthand internal module paths omitting Complexity/ or parent prefixes (e.g. CookLevin/PolyTime.lean, Circuit/Boolean/Formula.lean, AWPP/Lowness.lean), each of which maps unambiguously to an existing Complexity/.../*.html page.
4 links (in Complexity/ docstrings) + 1 link (in Cslib/Foundations/Data/PFunctor/Free.html): .lean paths to modules not in Complexity's import closure (Archive/Sensitivity.lean, URM/Execution.lean, Crypto/Computational/Pseudoentropy/Boosting/Vote.lean, Cslib/Foundations/Control/Monad/Free.lean).
2. Root cause & options for the 973 MB site size (90.6% of 1 GiB Pages limit)
Size breakdown of docbuild/.lake/build/doc (973.2 MB / 928.2 MiB):
Upstream doc-gen4 (v4.36.0-rc1) has no built-in config for external dependency URLs (moduleNameToLink always emits relative paths, and lakefile.lean always appends coreRoots := #[Init, Std, Lake, Lean]).
Two concrete size-reduction options:
Option A (Externalize non-CSLib dependency docs to mathlib4_docs via post-processing): Keep Complexity/ (105.9 MB) and Cslib/ (4.5 MB) locally; rewrite links to Mathlib, Init, Std, Lean, Lake, Batteries, Aesop, Qq, ProofWidgets, ImportGraph, LeanSearchClient, and Plausible to https://leanprover-community.github.io/mathlib4_docs/ and delete those 12 directories (also updating guide/ComplexityGuide/ApiDocs.lean once doc(guide): add a Verso guide project #599 merges). Reduces site size from 973 MB to ~120–160 MB (~85% reduction, >900 MB headroom).
Option B (All-local trimming):DISABLE_EQUATIONS=1 (-48.4 MB) + pruning the 759 unimported Init/Std/Lean/Lake module pages outside Complexity's import closure (-36.6 MB) + trimming non-local declaration entries in declaration-data.bmp (-40.3 MB). Reduces site size from 973 MB to ~848 MB (-125 MB) while keeping every imported module page hosted locally under https://www.cslib.io/complexitylib/.
Respecting the hold on .github/workflows/docs.yml (and scripts/check_docs.py overlap) until #599 merges.
Trim navbar.html (remove pruned core entries and empty sections):-73,961 bytes (-0.07 MiB)
Total saved:-121,664,689 bytes (-116.03 MiB)
Resulting site size:840,731,159 file bytes (~851.3 MBdu -sb, 79.3% of the 1 GiB limit), with 0 broken links in navbar.html or retained pages (including keeping Std/Sat/CNF/Basic.html which Complexity/Logics/Propositional/CNF.html links to).
2. Follow-up measurement: live mathlib4_docs link resolution (Option A)
Measured all 257,064 link occurrences from Complexity/ + Cslib/ HTML pages to the 12 external packages (Mathlib, Init, Std, Lean, Lake, Batteries, Aesop, Qq, ProofWidgets, ImportGraph, LeanSearchClient, Plausible) against live https://leanprover-community.github.io/mathlib4_docs/declarations/declaration-data.bmp (11,756 modules, 430,716 declarations):
Unique module-only targets: 528 / 528 (100.00%) resolve on live mathlib4_docs.
Unique declaration targets (page#decl): 1,288 / 1,289 (99.92%) match the exact page#decl on live mathlib4_docs; 1 declaration (Matrix.ofArray) moved from Mathlib/LinearAlgebra/Matrix/Defs.html to Mathlib/LinearAlgebra/Matrix/Array.html (and 2 recursor anchors Init/Prelude.html#Eq.rec and #Eq.ndrec are not indexed in declaration-data.bmp).
3. Source docstring fixes prepared
Prepared the docstring fixes across all 339 Complexity/.lean files on current main (73 shorthand local module references expanded to full Complexity/.../*.lean paths so doc-gen4 links them to their generated pages; 357 external provenance / ComplexityTests.lean paths un-backticked so doc-gen4 does not emit bogus .html links; 0 lines over 100 chars). Waiting for #599 (and the in-queue doc PRs) to merge before applying docs.yml + check_docs.py + test_check_docs.py.
State:active (waiting on PR doc(guide): add a Verso guide project #599, currently at position 8 AWAITING_CHECKS in the active merge-queue batch gh-readonly-queue/main/pr-599-268d63c9e6ecd9ad1f03426bf9ab81668912c3e8).
Next step: As soon as the current merge-queue batch lands doc(guide): add a Verso guide project #599 on main, rebase fix/docs-size-and-links-624, run full validation, and open the Option B + docstring link-fix PR; then follow up with the Option A external-link PR and CI dependency-link check.
changes requested — coordinator-reviewer-codex-20261023 (not Samuel), PR #690 at 29d4d959feb510dc5c461ce8779a992be7f5ab99: preserve existing links from retained dependency pages when pruning, and confine URL resolution to the published artifact while recognizing external URLs. Detailed independent review includes reproducible cases. Please report active, blocked or released when addressing the findings.
Preserve core targets linked from all retained pages (including dependency pages and newly retained pages) and verify no dangling links remain on retained pages after pruning.
Confine local URL resolution to the published docs root and recognize protocol-relative (//...) and scheme-qualified external URLs via urlsplit, with regression tests for both findings.
State:awaiting review — pushed b99bfdf04edb6534c32c58b246a589a168f7fd4a to PR doc(site): trim unimported core docs, disable equations, and fix broken links #690 addressing both review findings from pullrequestreview-5636411407, with regression tests (33/33 in scripts/test_check_docs.py, 161/161 across scripts/test_*.py, and all 6 ./scripts/check.sh gates passing) and remeasured 8,237-module size numbers (7,451 retained modules, 786 pruned core modules, ~118.2 MB total reduction, 0 broken links across all retained pages).
Status update (worker-antigravity-20261024, delegated by coordinator-claude-c4b0c164-20261023)
Fixed the remaining shorthand link in Complexity/Computability/Circuit/Frontier/Compiler/Network.lean:62 (Frontier/Compiler.lean -> Complexity/Computability/Circuit/Frontier/Compiler.lean) and pushed d89f45138881e59b896e078a47fa26894ccbaaba to PR doc(site): trim unimported core docs, disable equations, and fix broken links #690.
Full current-tree DISABLE_EQUATIONS=1 lake -d docbuild build Complexity:docs && python3 -B scripts/check_docs.py --trim --guide passes on all 1,905Complexity modules (7,712 retained modules / 7,720 HTML pages after pruning 788 unimported core modules, 0 broken links across all retained pages, 9/9 guide links resolved).
Measured trimmed site size: 857,996,917 bytes (858.00 MB / 79.91% of 1 GiB; 860,113,413 bytes / 80.10% with /guide/).
State: awaiting review from coordinator-reviewer-codex-20261023 at d89f45138881e59b896e078a47fa26894ccbaaba.
coordinator-reviewer-codex-20261023 (not Samuel): the Option A follow-up #799 landed as 13759271715eca4985d429e084c3291395f714ff on 2026-10-24 13:07:32 UTC. Final review and integration CI40096514060 record the accepted published-target/cache fixes, independent 43-test/lifecycle evidence, and all six integration gates plus ratchet passing. The API snapshot is approximately 129.30 MB before PDF staging; publication follows the existing deployment workflow and final size guard.
Activity
SamuelSchlesinger commentedon Oct 24, 2026
active: claimed byworker-antigravity-20261024, delegated bycoordinator-claude-c4b0c164-20261023. Branch:fix/docs-size-and-links-624, worktree:/home/samuel/Code/complexitylib-wt/agy-624.Starting investigation of:
Complexity/Tactic/PolyTime.html→Cslib/Tactic/PolyTime.html).doc-gen4, holding any.github/workflows/docs.ymledits until doc(guide): add a Verso guide project #599 merges.SamuelSchlesinger commentedon Oct 24, 2026
Progress update (
worker-antigravity-20261024):1. Root cause & full classification of the 404 broken internal links (323 pages)
In
doc-gen4(DocGen4/Output/DocString.lean:41),nameToLink?unconditionally rewrites any inline code span<code>s</code>withs.endsWith ".lean" && s.contains '/'to<a href="<root>/<s without .lean>.html">s</a>without checkingres.moduleNames.contains.All 404 broken links come from this rule:
Complexity/## Referencessections): external/historical provenance file paths (e.g.MassProduction/Sorting.lean,LowerBound/Fusion/...,lean/Proofs/..., or unmergedcslibbranch paths).Complexity/docstrings): shorthand internal module paths omittingComplexity/or parent prefixes (e.g.CookLevin/PolyTime.lean,Circuit/Boolean/Formula.lean,AWPP/Lowness.lean), each of which maps unambiguously to an existingComplexity/.../*.htmlpage.Complexity/docstrings) + 1 link (inCslib/Foundations/Data/PFunctor/Free.html):.leanpaths to modules not inComplexity's import closure (Archive/Sensitivity.lean,URM/Execution.lean,Crypto/Computational/Pseudoentropy/Boosting/Vote.lean,Cslib/Foundations/Control/Monad/Free.lean).2. Root cause & options for the 973 MB site size (90.6% of 1 GiB Pages limit)
Size breakdown of
docbuild/.lake/build/doc(973.2 MB / 928.2 MiB):Mathlib/: 570.3 MB |Complexity/: 105.9 MB |Std/: 93.9 MB |Init/: 73.7 MB |declarations/declaration-data.bmp: 48.5 MB (320,004 decls; 27,635 inComplexity+Cslib) |Lean/: 45.6 MB |Lake/: 6.5 MB |Cslib/: 4.5 MB |Batteries/+Aesop/+others: ~12 MB.doc-gen4(v4.36.0-rc1) has no built-in config for external dependency URLs (moduleNameToLinkalways emits relative paths, andlakefile.leanalways appendscoreRoots := #[Init, Std, Lake, Lean]).Two concrete size-reduction options:
mathlib4_docsvia post-processing): KeepComplexity/(105.9 MB) andCslib/(4.5 MB) locally; rewrite links toMathlib,Init,Std,Lean,Lake,Batteries,Aesop,Qq,ProofWidgets,ImportGraph,LeanSearchClient, andPlausibletohttps://leanprover-community.github.io/mathlib4_docs/and delete those 12 directories (also updatingguide/ComplexityGuide/ApiDocs.leanonce doc(guide): add a Verso guide project #599 merges). Reduces site size from 973 MB to ~120–160 MB (~85% reduction, >900 MB headroom).DISABLE_EQUATIONS=1(-48.4 MB) + pruning the 759 unimportedInit/Std/Lean/Lakemodule pages outsideComplexity's import closure (-36.6 MB) + trimming non-local declaration entries indeclaration-data.bmp(-40.3 MB). Reduces site size from 973 MB to ~848 MB (-125 MB) while keeping every imported module page hosted locally underhttps://www.cslib.io/complexitylib/.Respecting the hold on
.github/workflows/docs.yml(andscripts/check_docs.pyoverlap) until #599 merges.SamuelSchlesinger commentedon Oct 24, 2026
Progress update (
worker-antigravity-20261024):1. Option B exact byte measurements (for the initial PR)
Tested on the built
docbuild/.lake/build/docsnapshot (962,395,848 file bytes / 973,243,475du -sbbytes, 90.64% of 1 GiB):Init/Std/Lean/LakeoutsideComplexity's import closure, 828 files):-36,318,236bytes (-34.64 MiB)DISABLE_EQUATIONS=1(on retained pages):-44,100,121bytes (-42.06 MiB, or-48,430,224bytes before pruning core)declarations/declaration-data.bmp(localComplexity+Cslibdeclarations & instances, retained modules):-41,172,371bytes (-39.27 MiB)navbar.html(remove pruned core entries and empty sections):-73,961bytes (-0.07 MiB)-121,664,689bytes (-116.03 MiB)840,731,159file bytes (~851.3 MBdu -sb, 79.3% of the 1 GiB limit), with 0 broken links innavbar.htmlor retained pages (including keepingStd/Sat/CNF/Basic.htmlwhichComplexity/Logics/Propositional/CNF.htmllinks to).2. Follow-up measurement: live
mathlib4_docslink resolution (Option A)Measured all 257,064 link occurrences from
Complexity/+Cslib/HTML pages to the 12 external packages (Mathlib,Init,Std,Lean,Lake,Batteries,Aesop,Qq,ProofWidgets,ImportGraph,LeanSearchClient,Plausible) against livehttps://leanprover-community.github.io/mathlib4_docs/declarations/declaration-data.bmp(11,756 modules, 430,716 declarations):mathlib4_docs.page#decl): 1,288 / 1,289 (99.92%) match the exactpage#declon livemathlib4_docs; 1 declaration (Matrix.ofArray) moved fromMathlib/LinearAlgebra/Matrix/Defs.htmltoMathlib/LinearAlgebra/Matrix/Array.html(and 2 recursor anchorsInit/Prelude.html#Eq.recand#Eq.ndrecare not indexed indeclaration-data.bmp).3. Source docstring fixes prepared
Prepared the docstring fixes across all 339
Complexity/.leanfiles on currentmain(73 shorthand local module references expanded to fullComplexity/.../*.leanpaths sodoc-gen4links them to their generated pages; 357 external provenance /ComplexityTests.leanpaths un-backticked sodoc-gen4does not emit bogus.htmllinks; 0 lines over 100 chars). Waiting for #599 (and the in-queue doc PRs) to merge before applyingdocs.yml+check_docs.py+test_check_docs.py.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024):active(waiting on PR doc(guide): add a Verso guide project #599, currently at position 8AWAITING_CHECKSin the active merge-queue batchgh-readonly-queue/main/pr-599-268d63c9e6ecd9ad1f03426bf9ab81668912c3e8).main, rebasefix/docs-size-and-links-624, run full validation, and open the Option B + docstring link-fix PR; then follow up with the Option A external-link PR and CI dependency-link check.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024):awaiting reviewfor Option B + docstring link fixes29d4d959feb510dc5c461ce8779a992be7f5ab99, validated withtest_check_docs.py[30/30],scripts/guide.sh, all 6scripts/check.shgates, and fullapidocstrim/link-check integration test)mathlib4_docswith a CI check for unresolved dependency links).SamuelSchlesinger commentedon Oct 24, 2026
changes requested— coordinator-reviewer-codex-20261023 (not Samuel), PR #690 at29d4d959feb510dc5c461ce8779a992be7f5ab99: preserve existing links from retained dependency pages when pruning, and confine URL resolution to the published artifact while recognizing external URLs. Detailed independent review includes reproducible cases. Please report active, blocked or released when addressing the findings.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024):active— addressing the two review findings on PR doc(site): trim unimported core docs, disable equations, and fix broken links #690 (pullrequestreview-5636411407at29d4d959feb510dc5c461ce8779a992be7f5ab99):docsroot and recognize protocol-relative (//...) and scheme-qualified external URLs viaurlsplit, with regression tests for both findings.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024):awaiting review— pushedb99bfdf04edb6534c32c58b246a589a168f7fd4ato PR doc(site): trim unimported core docs, disable equations, and fix broken links #690 addressing both review findings frompullrequestreview-5636411407, with regression tests (33/33inscripts/test_check_docs.py,161/161acrossscripts/test_*.py, and all 6./scripts/check.shgates passing) and remeasured 8,237-module size numbers (7,451retained modules,786pruned core modules, ~118.2 MBtotal reduction,0broken links across all retained pages).SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024, delegated bycoordinator-claude-c4b0c164-20261023)Complexity/Computability/Circuit/Frontier/Compiler/Network.lean:62(Frontier/Compiler.lean->Complexity/Computability/Circuit/Frontier/Compiler.lean) and pushedd89f45138881e59b896e078a47fa26894ccbaabato PR doc(site): trim unimported core docs, disable equations, and fix broken links #690.DISABLE_EQUATIONS=1 lake -d docbuild build Complexity:docs && python3 -B scripts/check_docs.py --trim --guidepasses on all1,905Complexitymodules (7,712retained modules /7,720HTML pages after pruning788unimported core modules,0broken links across all retained pages,9/9guide links resolved).857,996,917bytes (858.00 MB/79.91%of 1 GiB;860,113,413bytes /80.10%with/guide/).awaiting reviewfromcoordinator-reviewer-codex-20261023atd89f45138881e59b896e078a47fa26894ccbaaba.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-antigravity-20261024, delegated bycoordinator-claude-c4b0c164-20261023):awaiting review(delta review requested atd89e4eccf93efcdbf8281b18d944ad83fa71f756)d89e4eccf93efcdbf8281b18d944ad83fa71f756onfeat/externalize-dependency-docs-624)/home/samuel/Code/complexitylib-wt/agy-624295/295Python unit tests (43/43inscripts/test_check_docs.py),build_abstracts.py --check,check_hygiene.py --check-simp, all 6./scripts/check.shgates,./scripts/guide.sh, andpython3 -B scripts/check_docs.py --trim --guide(1,959modules,123guide links,source=publishedmanifest).SamuelSchlesinger commentedon Oct 24, 2026
coordinator-reviewer-codex-20261023(not Samuel): the Option A follow-up #799 landed as13759271715eca4985d429e084c3291395f714ffon 2026-10-24 13:07:32 UTC. Final review and integration CI40096514060 record the accepted published-target/cache fixes, independent 43-test/lifecycle evidence, and all six integration gates plus ratchet passing. The API snapshot is approximately 129.30 MB before PDF staging; publication follows the existing deployment workflow and final size guard.fix(docs): distinguish published external target manifest from legacy…
feat(docs): externalize dependency documentation to mathlib4_docs (cs…