Expand description
v2.76.0 — the EMS compilation cache: content-addressed, with GHC-style early cutoff. Nix model: a compile is a pure function of its inputs, so matching inputs ⇒ the recorded outcome is the outcome.
§What is actually cached (stated precisely, so the claim can be true)
The unit of persisted skip is a module’s validation (the type-check — by far the expensive pass; the 680k-line checker dwarfs parse + IR generation). Parsing and IR generation always re-run: IR nodes are Serialize-only by design (consumers re-derive from source), so the honest cache skips what it can prove skippable and recomputes the cheap, total passes.
- Module validation hit — a module whose
content_hashAND dependencyinterface_hashset match a recorded CLEAN validation skips its per-module type-check. - Early cutoff — a dependency edited without changing its public
surface (comment, body-only edit) keeps its
interface_hash, so every dependent’s key still matches: the dependents skip re-validation. This is real, observable viaCacheStats, and sound because per-module validation consumes only interface facts (v2.76.0) — nothing body-derived is cached per-dependent. - The merged revalidation re-runs whenever any module changed. Cross-module semantics are global; v1 does not scope it. When NO module changed, the project-level entry marks the whole compile clean and the driver skips validation entirely.
§Laws
- Source hash changed → module miss.
- Any dependency interface hash changed → module miss.
- Both match a recorded clean validation → hit.
- Dependency source changed, interface stable → dependents still hit (early cutoff).
- Writes are atomic (
.tmp+ rename). A corrupt or unreadable cache is NOT an error: it self-heals by re-deriving from source (the boot-hydrate doctrine — a cache is never the source of truth). - The manifest pins
schema_version+axi_format+ the compiler version; any mismatch busts the cache wholesale.
Only CLEAN validations are recorded: a failing module re-validates every run so diagnostics re-emit from source, never from a replay.
Structs§
- Cache
Stats - Observable cache behavior — the tests’ witness that the laws run.
- Cached
Diagnostic - One persisted diagnostic (merged-gate warnings only — errors are NEVER cached; a failing compile re-derives from source every run).
- Compilation
Cache - The EMS compilation cache. All operations are infallible by contract: any I/O or shape problem degrades to “no cache” (law 5).
Constants§
- CACHE_
DIR_ NAME - Cache directory name, created beside the entry file.
- CACHE_
SCHEMA_ VERSION - On-disk manifest schema version.