Skip to content

fix: regenerate the HTML of the project after a cache hit - #38

Open
marcelolynch wants to merge 2 commits into
leanprover-community:mainfrom
marcelolynch:fix/regenerate-project-html-on-cache-hit
Open

marcelolynch wants to merge 2 commits into
leanprover-community:mainfrom
marcelolynch:fix/regenerate-project-html-on-cache-hit

Conversation

@marcelolynch

@marcelolynch marcelolynch commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33. Refs #28.

This ports dwrensha/docgen-action@8c6b36d by @dwrensha.

After a cache hit, each page of the project can give a 404. The :docs facet of doc-gen4 writes the HTML in one pass and records the pass in a marker <target>.docs_built in .lake/build/doc-data/ (see generateHtmlDocs). Lake checks the marker, not the HTML. The cache restores the marker but not the HTML of the project, so Lake skips the pass and the project has no pages. A cache miss gives a fresh build, so the bug looks intermittent. In doc-gen4 versions before leanprover/doc-gen4#418, the marker also stays up to date after a change to a Lean file.

This PR deletes the markers before lake build, so the HTML pass runs on each build. The cache paths and the key do not change. The pass reads the cached database. In a Noperthedron run with 2936 modules, it took 71 s.

To test: a run on main after a cache hit and a change to a Lean file has no pages for the project. The same run on this branch has all pages.

🤖 Generated with Claude Code

@marcelolynch
marcelolynch force-pushed the fix/regenerate-project-html-on-cache-hit branch from fe89d05 to a49fae0 Compare September 16, 2026 18:57
The `:docs` facet of `doc-gen4` gates its HTML pass on an empty marker
`<target>.docs_built` in `.lake/build/doc-data/`. Lake runs the pass when
the marker is absent or when the hash of its dependency trace differs from
the saved hash. The HTML files are outside this check. The trace changes
only with the `doc-gen4` executable and the bibliography. The `docInfo`
markers which feed it are empty files, and Lake takes the trace of a built
file from its content, so the hash of each marker is constant.

The cache holds the markers, because it holds `doc-data`. It holds the HTML
of the dependencies only, because the cached paths come from the packages
in `lake-manifest.json`, and the project is not one of them. After a cache
hit, Lake therefore skips the pass on every push, and the site has no pages
for the project. Each page of the project gives a 404.

This commit deletes the markers after the cache restore. The pass then runs
on each build and writes the HTML from the cached database. It takes about
one minute for a project with 3000 modules in its import closure.

This ports dwrensha/docgen-action@8c6b36d by David Renshaw.

Fixes leanprover-community#33
Refs leanprover-community#28

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The comment now also holds for doc-gen4 versions that include
leanprover/doc-gen4#418.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

After cache hit, project-specific docs error with 404

1 participant