Skip to content

Stop committing generated Lean sources; regenerate them at build - #71

Open
sam-xif wants to merge 1 commit into
mainfrom
drop-committed-generated-lean
Open

sam-xif wants to merge 1 commit into
mainfrom
drop-committed-generated-lean

Conversation

@sam-xif

@sam-xif sam-xif commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Generated Lean sources are build outputs, not source. This stops committing them and has make regenerate each one before anything that reads it, extending what 42801a8c already does for Generated/BootedHeap.lean to the rest:

  • every file in ruby-lean/RubyCore/Generated/ — PreludeJson, Prelude, CRubyNames, Unicode (and BootedHeap, already uncommitted);
  • the 13 modules books/scripts/generate_audited_checker.py writes into books/Books/TypeSoundness/Checker/Audit/.

Checker/Audit/ also holds hand-written sources — Derive.lean, Erase.lean, Permissions.lean — which stay committed. (The first version of this PR un-committed the whole directory, deleting those three; that is what CI failed on.)

What changed

  • Un-committed the 17 generated files. .gitignore covers Generated/*.lean and lists the 13 audit modules one by one (plus transient *.lean.tmp).
  • generate_audited_checker.py --list prints the paths it writes; the Makefile reads it (AUDIT_OUT), so the generated set is defined once, in its MODULES.
  • Build wiring: rules for CRubyNames.lean and Unicode.lean; an audit stamp; lean-exes depends on the tables, BootedHeap and the audit stamp (the checker imports audit modules, so validate-one needs them); soundness likewise; books/metatheory/comparator through lean-exes. BootedHeap's inputs include the regenerated tables, since generating it compiles the model.
  • gen-check (still a make check target, so ci-sync is unchanged) fails if a committed file under Generated/ or Audit/ carries a generated header, or if .gitignore's audit list differs from --list. Exercised locally: passes as-is; fails, naming the file, with a generated module staged; fails, showing the diff, with one module missing from .gitignore.
  • gen also writes BootedHeap.lean. clean removes Generated/*.lean and AUDIT_OUT only — not the hand-written audit sources.
  • Docs: a README in each directory; AGENTS.md rule 6, docs/contributing.md and docs/semantics/index.md no longer say these files are committed.

The CRuby-name and Unicode tables are oracle snapshots, so regenerating them assumes the Ruby the repository pins. #74 makes CRubyNames.lean independent of the oracle's startup load state, which this relies on: land this after #74. They touch different files.

Consequence: a bare lake build in a fresh checkout with no prior make will not find these files; run make gen once (needs Ruby and Python). Every make target that builds the model, checker or books does it already.

Verification

make check was not run locally; CI runs it on the pinned Ruby. Locally: make gen-check (and its two failure modes, above); generate_audited_checker.py --check; and lake build validate-one against the restored hand-written sources plus regenerated audit modules, the step CI failed on. ruff format and check pass on the generator.


Authored by Claude (an agent). A human should review before merging.
🤖 Generated with Claude Code

@sam-xif
sam-xif force-pushed the drop-committed-generated-lean branch from 48b8ba7 to 4a5f043 Compare October 15, 2026 12:44
Every file in ruby-lean/RubyCore/Generated/ and the audited checker modules that
books/scripts/generate_audited_checker.py writes into Checker/Audit/ are build
outputs: each is derived from in-repo inputs (the prelude and the desugarer, the
CRuby-name and Unicode oracles the repository pins a Ruby version for, the
checker's Check/ modules). Commit them no longer. BootedHeap.lean was already a
build artifact; this extends the same treatment to the rest.

Checker/Audit/ also holds hand-written sources (Derive, Erase, Permissions),
so it is not ignored as a whole. .gitignore lists the generated modules one by
one, and the generator gains --list, which the Makefile uses for `make clean`
and `make gen-check`.

`make` regenerates each file before any target that compiles the model, the
checker or the books reads it. `make gen-check` now fails if a file carrying a
generated header is committed, or if .gitignore's list of generated audit
modules differs from the generator's. A README in each directory, AGENTS.md and
the contributing guide say which files are generated.

A bare `lake build` in a fresh checkout, with no prior `make`, will not find
these files; run `make gen` once first (needs Ruby and Python).

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.

1 participant