Skip to content

Run the repository checks

Run the fast zero-Lean Rust workspace tests on any OS, validate OpenSpec schemas, and run path-selected native verification suites with lema-native in a lema-lang checkout.

If you are contributing to the lema-lang repository itself (as opposed to running lema test inside a user project), Lema organizes its repository test suites into two tiers (LEMA-381, Decision 0033):

  1. The default plain tier (cargo test --workspace): Starts no Lean process, opens no store, and needs no Linux sandbox. It runs in seconds on both macOS and Linux, testing canonical object hashing (lema-core), Pythonic .lema rendering/parsing/rederive (view.rs), semantic version control and lema.contract/v1 witness checking (lema-store), LemaIR compilation and ConstantTime / SecretFlow static analyses (lema-ir), in-memory VM execution (lema-vm and lema-vm-runner), 6-tag capability framing (lema-cap), and static site generation (lema-site).
  2. Path-selected native suites (cargo run -q -p lema-native): End-to-end tests that invoke the pinned Lean 4.34.1 kernel inside the Linux bubblewrap sandbox or run full VM deployment and release scenarios (natives.json).

Before you start

  • A checkout of lema-lang with the pinned Rust 1.98.0 toolchain installed.
  • Node.js 20.19 or newer when validating openspec/ specifications.
  • For native suites (Step 3), an x86_64 Linux machine where lema toolchain install and lema check-runtime have passed (Set up a machine for Lema).

1. Run the fast plain tier (any OS, no Lean process)

From the root of your lema-lang checkout, run formatting, Clippy, and the workspace unit and integration tests:

Shell
cargo fmt --check
cargo clippy --workspace --all-targets
cargo test --workspace

Why is cargo test --workspace so fast in Lema v0.2?

  • Every library module (Core, BlockStore, ChaCha20Poly1305, X25519, Ed25519, P256Verify, RsaVerify, Noise, Tls13, Http1, S3, S3d, Collector, EscrowLedger) has its committed canonical input in audit/inputs/ and its generated audit view in audit/view/ (LEMA-190, LEMA-191).
  • That allows cargo test --workspace to test LemaIR compilation, Ir.Semantics differential checks, ConstantTime and SecretFlow static guarantees, Store::check_witness contract selection discharge, and VM task/actor/session execution directly in memory without spawning a single lean subprocess.

2. Validate OpenSpec specifications (when touching specs)

If your change adds or modifies an OpenSpec change proposal under openspec/, run the Node check:

Shell
npm ci --ignore-scripts
npm run check

3. Select and run native suites for changed paths (lema-native)

Notice an important rule when reporting test coverage: #[ignore]d native tests have not run merely because cargo test --workspace is green.

Rather than guessing which native suites your change affects, natives.json and the lema-native tool map modified repository paths to the exact native test rows they require. List the native suites triggered by your branch relative to origin/main:

Shell
cargo run -q -p lema-native -- list --changed origin/main

For example:

  • Editing crates/lema-core/src/view.rs or audit/inputs/ triggers the library_publish reproducibility suite (which re-publishes a fixed set of library modules into a fresh store through the Lean 4.34.1 kernel) and contract view round-trip checks.
  • Editing crates/lema-vm-runner/, crates/lema-cap/, or crates/lema-store/src/release.rs triggers the vm_release (crates/lema-cli/tests/vm_release/deploy.rs) and escrow_ledger (crates/lema-cli/tests/escrow_ledger/deploy.rs) native rows.

Run the selected native rows using lema-native (or by passing the isolated runtime configuration environment variable for that row with -- --ignored --test-threads=1 --nocapture):

Shell
cargo run -q -p lema-native -- run --changed origin/main

Each native row automatically gets its own isolated runtime output directory so its ledger.jsonl, .olean module cache, and fault state stay separate from other runs.

4. How to interpret and report check results

When summarizing verification results in a commit message or pull request, keep the three evidence tiers distinct (Checked, tested and assumed):

  • checked: Declarations and theorems replayed through the pinned Lean 4.34.1 kernel under the store’s axiom policy (library_publish, reverify).
  • tested: Rust workspace tests (cargo test --workspace), ConstantTime and SecretFlow static LemaIR analyses, and native VM application suites (vm_release, escrow_ledger). Distinguish between the default minimal release gate suites and the full stress scenario suites (LEMA_ESCROW_FULL, LEMA_COLLECTOR_FULL).
  • assumed: The pinned Lean 4.34.1 kernel, the Rust compiler and VM worker, bwrap, and the host OS.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility