LemmaScript icon indicating copy to clipboard operation
LemmaScript copied to clipboard

Clarify Lake project discovery and avoid invoking lake from filesystem root

Open DivyamTalwar opened this issue 2 months ago • 3 comments

@namin

Summary

The Lean backend's project discovery behavior needs an explicit compatibility decision. At the current main baseline (299e6b057a5dfc7f255d3e06d998573918e6e429), tools/src/lean-commands.ts::leanCheck walks upward looking only for lakefile.lean. If it finds no marker, it reaches the filesystem root and still invokes lake build there.

Observed behavior

A reduced filesystem fixture containing a nested source directory and only lakefile.toml selected / rather than the fixture project. This confirms the discovery behavior, but the current LemmaScript documentation does not establish that TOML-only Lake projects are a supported layout.

Decision requested

Please clarify whether LemmaScript should:

  • support both lakefile.lean and lakefile.toml with nearest-ancestor semantics; or
  • support only lakefile.lean, but return an actionable “Lake project not found” error without spawning Lake from an unrelated directory.

Either contract should cover a nested project, no project marker, paths containing spaces, missing proof files, and a failed Lake build. This should remain a focused discovery/error-handling change, not package-root guessing or a Lean project migration.

No implementation PR is opened until the supported layout is confirmed.

DivyamTalwar avatar Sep 17 '26 03:09 DivyamTalwar

I think we should support both lean and toml lakefile with near-ancesor semantics and if none is found, return an error instead of spawning lake

namin avatar Sep 17 '26 04:09 namin

Thanks for clarifying. I implemented both lakefile.lean and lakefile.toml with nearest-ancestor semantics, starting in the source directory and checking through the filesystem root. If neither marker is found, the check now returns an actionable error without starting Lake. Missing proof files also fail before spawning the subprocess.

The implementation and CLI documentation are pushed to DivyamTalwar/LemmaScript on codex/ls-04-lake-project-discovery, at commit be01dee.

The 15 focused tests cover both formats, nested-project precedence, relative paths, paths with spaces, root lookup, and subprocess failure/no-spawn behavior. They live under tools/fixtures and are wired into the existing fixture script.

Focused tests and targeted TypeScript checks pass. The Lake subprocess cases are mocked, so I am not claiming a full Lean proof run. The implementation is available on the branch; the upstream PR has not been opened yet.

@namin

DivyamTalwar avatar Sep 17 '26 15:09 DivyamTalwar

Thanks, I opened the PR!

namin avatar Sep 17 '26 23:09 namin