Repository navigation
Validate REPL imports with the selected Lean toolchain - #106
Conversation
…e' into codex/pr106-header-fix-20261005
…e' into codex/pr106-header-fix-20261005
|
Exact-head review is complete at |
… into split/repl-lean-header-validation
LeanRepl._check_header spawns `lean --deps-json` as the wrapper's own process and reaps it through close(). Disposable cleanup, cancellation precedence, and pool settlement now treat the parser exactly like the REPL child, so the separate kill path, _HeaderProcessCleanupError, and the ownership handoff in run_disposable are gone. A parser whose cleanup fails stays owned by the slot until close() verifies it exited. Reuse _decode_repl_json for strict JSON, drop the test-only _lean_header_modules wrapper and two guards for states the only caller cannot produce, and fold the leading-import gate into the existing warmup generator.
Parametrize the three warmup-composition tests over one scaffold with an explicit expected frame per header, compress the deps-json fixture, and use the fake parser's exit status to pin the nonzero-exit rejection that no test exercised. Give the import-rejection test a budget that covers spawning the parser child it now runs.
… into split/repl-lean-header-validation
… into split/repl-lean-header-validation
… into split/repl-lean-header-validation # Conflicts: # skills/setup/SKILL.md
|
Swarm pass on header validation, the middle of the #105 → #106 → #107 stack. What changed and why
Diff vs #105: +847/-9 → +609/-8 (10 files; 106 lines are the example Checks: exact-head CI on Remaining risks
Posted by PR swarm: Swarm · REPL #105-107 |
Problem
The disposable path found imports with a string splitter. A leading comment hid
import Unsafefrom the allowlist, and prefixing warmup imports onto amoduleorpreludeheader turned a valid file into an invalid one. A project target namedreplcould also shadow the REPL executable.Fix
LeanRepl._check_headerruns the Lake toolchain'slean --deps-jsonon the submitted code. A launcher execs$LEAN_SYSROOT/bin/lean, so aPATHshadow cannot substitute the parser.close(), same pool retry, sameis_clean()gate as the REPL child. No separate cleanup path.module,prelude, and legacy-schema headers are sent unchanged.lake exe @repl/repl. Setup states that neitherproject newnorinitadds the REPL, requires an immutable, toolchain-tested REPL revision, and the bundled example pins one.Invariant
No REPL child starts for a header Lean rejects or Autoform cannot decode, and the parser process is reaped before the slot is reused.
Tests
tests/test_repl_core_protocol.py: current and legacy schemas, launcher ignores aPATHshadow, fail-closed parametrization (Lean errors, nonzero exit, garbage, duplicate keys, NaN), header checked before the warmup prefix, warmup prefix only on proven ordinary headers (5 cases), disallowed warmup root.tests/test_shared_lean_runtime.py: package-qualified default command.tests/test_skill_examples.py: docs and the example lakefile pin the REPL revision.Stack
10 files, +609/-8 against #105 (was +847/-9 before golfing; most remaining data lines are the example's
lake-manifest.json). Merge after or together with #105.Behavior note: if a request is cancelled while the parser runs and the parser's cleanup also fails, the wrapper stays dirty and the pool's
_settlereaps it, the same as for a REPL child.