Skip to content

fix: restore subverso definition sites, unbreaking verso-slides - #41

Open
Kha wants to merge 1 commit into
masterfrom
push-uqqpxnmuxntu
Open

fix: restore subverso definition sites, unbreaking verso-slides#41
Kha wants to merge 1 commit into
masterfrom
push-uqqpxnmuxntu

Conversation

@Kha

@Kha Kha commented Sep 4, 2026

Copy link
Copy Markdown
Member

master is red on nightly-2026-09-03 (run
33849693560
):
verso fails to build and verso-web-components, verso-slides and the critical
reference-manual are skipped behind it. There are two independent causes; this PR fixes
one of them, so it will not by itself make the run green.

subverso — fixed

Not visible in the run, because verso-slides never got to build. With the dependency fixup
below undone locally, verso-slides fails with

error: Demo.lean:305:0: No declaration named `Verso.Code.External.withNl` in module.

leanLibCode … (decl := …) looks the declaration up in ModuleItem.defines, which
subverso-extract-mod fills from the tokens the highlighter marked as definition sites. For
Verso.Code.External that set had collapsed from 56 names to 9 — only where helpers and
constructors survived, no top-level declaration did.

The monorepo's subverso is exactly one commit ahead of the fda188f7 that verso and
verso-slides pin, so this arrived when subverso was added as a subrepo: leanprover/subverso#237
(the fix for the InternalTests breakage from lean4#14834) made the definition-site check in
termInfoKind run in the environment constEnv selects, which is the info node's own
environment whenever that already contains the constant. Declaration ranges are registered as
the command finishes, so a node's environment holds the constant but not its ranges, and
isDefinition then reports the declaration as a plain occurrence. The names that still worked
are exactly those whose info nodes predate their addition to the environment, where constEnv
falls back to the command environment anyway.

The check now prefers the command's environment and falls back to the node's for constants that
environment does not contain. Worth reporting upstream: subverso's own CI pins v4.29.0-rc7
and does not exercise defines, so it will not catch this.

Verified: Verso.Code.External back to 56 defines; lake build clean (56 jobs) and
subverso-internal-tests passes. subverso defines no test or lint driver, so lake build is
its full phase set in CI.

The dependency fixup — still broken, needs a .downstream/ change

downstream: fixup repo verso writes subverso into the .lake/package-overrides.json of
verso's nested test projects test-projects/{anchor-examples,documented-package,website-examples,website-literate}.
Those four pin leanprover/lean4:v4.31.0 in their own lean-toolchain, so verso's build runs
elan run --install leanprover/lean4:v4.31.0 lake build over the in-tree subverso and
rewrites subverso/.lake/build with v4.31.0 .oleans. Every verso module importing subverso
then fails with

error: src/tests/Tests/Linters.lean:6:0: failed to read file
'.../subverso/.lake/build/lib/lean/SubVerso/Highlighting/Highlighted.olean', incompatible header

and where the nightly outputs are still read-only the nested build fails first with a bogus
permission denied (error code: 13).

Updater.fixup_subrepo_toolchain already skips nested lean-toolchain files whose contents
differ from the subrepo's; fixup_subrepo_dependencies applies fixup_manifest_dependencies to
every **/lake-manifest.json with no such check and needs the same guard. That is a
.downstream/ change, which this run may not make, so it is not in this PR. Hand-editing the
four override files is not a fix either: fixup_subrepo_and_commit regenerates them on every
downstream: update repo verso, which lands daily.

Verified with the four override entries emptied locally

Everything behind the fixup is clean on this nightly once subverso is fixed, so the guard plus
the commit here should be all master needs:

repo build test
verso ✅ 1114 jobs ✅ all tests passed
verso-slides ✅ 636 jobs ✅ (--no-playwright, as in CI)
verso-web-components ✅ 400 jobs no driver
reference-manual ✅ 1180 jobs no driver

Also: #39 can be closed. Its subverso/InternalTests.lean commit is superseded by
leanprover/subverso#237, which reached the monorepo in downstream: update repo subverso
(3558e9b) and made subverso green in this run.

🤖 Generated with Claude Code

subverso#237 made the definition-site check in `termInfoKind` run in the
environment `constEnv` picks, which is the info node's own environment whenever
that environment already contains the constant. Declaration ranges are only
registered as the command finishes, so a node's environment holds the constant
but not its ranges, and `isDefinition` consequently reported every top-level
declaration as a plain occurrence. `ModuleItem.defines` collapsed to the names
whose info nodes predate their addition to the environment — `where` helpers and
constructors — which broke `verso-slides`' `leanLibCode … (decl := …)` blocks
with "No declaration named `Verso.Code.External.withNl` in module."

Prefer the command's environment for that check, falling back to the node's for
constants the former does not contain.

Verified: `Verso.Code.External` goes from 9 back to 56 `defines`; subverso
builds and `subverso-internal-tests` passes; verso-slides builds and tests.
@downstream-lean4

Copy link
Copy Markdown
Contributor

Build report for fix: subverso lost definition sites in extracted modules

Stayed red
Repo Critical Build Test Lint
reference-manual ⏭️ ⏭️ ⏭️
verso 🟥 in 69s ⏭️ ⏭️
verso-slides ⏭️ ⏭️ ⏭️
verso-web-components ⏭️ ⏭️ ⏭️
Stayed green
Repo Critical Build Test Lint
aesop ✅ in 7s ✅ in 5s ⏭️
batteries ✅ in 5s ✅ in 4s ✅ in 2s
import-graph ✅ in 2s ✅ in 3s ⏭️
lean4-cli ✅ in 1s ✅ in 0s ⏭️
mathlib4 ✅ in 216s ✅ in 47s ✅ in 91s
plausible ✅ in 1s ✅ in 2s ⏭️
ProofWidgets4 ✅ in 3s ✅ in 1s ⏭️
quote4 ✅ in 2s ✅ in 1s ⏭️
BibtexQuery ✅ in 3s ⏭️ ⏭️
comparator ✅ in 2s ⏭️ ⏭️
cslib ✅ in 5s ✅ in 8s ✅ in 3s
doc-gen4 ✅ in 9s ⏭️ ⏭️
illuminate ✅ in 3s ✅ in 10s ⏭️
lean4-unicode-basic ✅ in 2s ⏭️ ⏭️
lean4export ✅ in 0s ✅ in 7s ⏭️
LeanSearchClient ✅ in 1s ✅ in 0s ⏭️
leansqlite ✅ in 7s ✅ in 15s ⏭️
nerodia ✅ in 3s ✅ in 21s ⏭️
repl ✅ in 1s ✅ in 57s ⏭️
subverso ✅ in 19s ⏭️ ⏭️

View run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant