fix: run the HTML phase again when the analysis of its inputs changes - #418
Conversation
The `docInfo`, `coreDocs`, `docsHeader` and `docs` steps record their completion in marker files. Lake computes the trace of a built file from its content, and the markers were empty, so their traces never changed and the `docs` step stayed up to date while the database changed under it. A declaration added to a module reached the database and not the page. `writeMarker` writes the hash of the dependency trace of the step into the marker, so the marker changes exactly when the inputs of the step change, and the steps that depend on it run again. The multi-library test adds a declaration to a library after the first build and checks that its page shows the declaration after the next build. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The test adds two phases. The first runs `lake build LibA:docs --no-build` after a build, so a marker whose content changes while the inputs stay the same makes the test fail. The second adds a declaration to `LibA.Basic`, which `LibA` imports, so the change must reach the `docs` step through two markers. `LibA` now imports `LibA.Basic`. The docstring of `writeMarker` names `buildFileUnlessUpToDate'`, the Lake function that gives a built file the trace of its content. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
d7aa988 to
027d33c
Compare
Co-authored-by: David Thrane Christiansen <david@davidchristiansen.dk>
|
We use squash merges here with the PR description becoming the commit message, so I'm moving Claude's message down to a comment for posterity: ProblemThe Example. A library
Issue #389 reports this behavior: a rebuild after a change to a doc string leaves the page as it was. This PR fixes that part of #389. The other part, a deleted page is not written again, is a separate problem: Lake tracks the marker, not the page. ChangeThe lakefile gains An existing build directory needs no cleanup. A marker gets its hash the first time its step runs again, and the steps that depend on it run at that point. Test
Phases 3 and 5 fail on 🤖 Generated with Claude Code |
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>
The Lake part of
doc-gen4uses marker files as build products. These files represent data that has been added to the database, because Lake fundamentally tracks files and their contents. Previously, these marker files were empty, which could cause changes upstream of them to not invalidate a build. Now, they contain the hash of everything involved in their production, invalidating them correctly.Closes: #389