Formal Verification Pipeline
This page is part of the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at formal-verification-pipeline.md, and llms.txt lists every page.The TLA+ specifications under spec/ are checked by TLC
through an ordinary NUnit fixture, and each one is tied to production code by a
refinement note. Several CI lanes cooperate to keep both halves honest at an
affordable cost. This page explains which lane runs what, how a pull request
decides whether to model-check, how per-module verdict receipts let unchanged
modules skip TLC, and which gates connect the specifications to the code they
describe.
What is guaranteed, in short: a pull request that changes anything able to alter a TLC verdict model-checks every module whose fingerprint it changes, unless an earlier run already passed that module at the identical fingerprint and left a trusted receipt; release lines, the nightly lane and a dispatch with receipts off check every module regardless. A change that cannot alter a verdict skips exhaustive TLC, and what remains outside every check is listed under What a green check means.
Formal Coverage says what is checked, area by area. This
page says how and when it is checked. The file formats and the gate list for a
module directory live in spec/README.md.
The page deliberately states no shard name, case count, runtime or price. TLC
work is routed by mechanism - the TlcShard* and TlcModule_<Module> test
categories that TlcCiShard attaches, and the shard partition in
test-shards.json - and the
measured costs live in
test-durations.tsv and in the
module counts tables, so a rebalance
cannot make this page false.
Lanes
Every lane below except the weekly perturbation lane runs the same harness,
test/lattice/Formal/. What differs is which of its pieces run, and whether a module that has already passed is
trusted instead of rerun.
| Lane | Structural Formal gates | Smoke TLC | Exhaustive TLC | Reads receipts | Writes receipts | Perturbations | Formal-impact report |
|---|---|---|---|---|---|---|---|
Pull request into main (ci.yml) |
Yes | Yes | Modules without a trusted receipt, only when a verdict input changed | Own scope, main |
Own scope | Gate only | Yes (advisory) |
Member pull request into an integration branch (ci.yml) |
Yes | Yes | Modules without a trusted receipt, only when a verdict input changed | Own scope, the integration branch, main |
Own scope | Gate only | Yes (advisory) |
Integration-branch push (ci.yml) |
Yes | Yes | Every module without a receipt | The branch, main |
The branch | Gate only | No |
Release-line pull request or push (ci.yml) |
Yes | Yes | All modules | Never | Never | Gate only | Pull request only |
Push to main (formal-receipts.yml) |
No | No | Modules main has no receipt for; none when every module has one |
main |
main |
No | No |
Nightly Coverage (coverage.yml) |
Yes, under coverlet | Yes | All modules | Never | main |
Gate only | No |
Weekly perturbation lane (formal-perturbations.yml) |
No | No | No | No | No | Every perturbation, run for real | No |
| Local run | By filter | By filter | By filter | No | No | By hand | By hand |
How to read the columns:
- Structural Formal gates are the toolchain-free gates: discovery, manifests,
mutation pairing, refinement mappings and every gate listed under
Refinement gates. In
ci.ymlthey run in the content gates job, which selects everyFormal,HygieneandDocstest except theTlccategory, so they run whether or not any TLC runs. - Smoke TLC is the one base-model case that the
"tlcSmoke": trueshard oftest-shards.jsonselects. It proves the toolchain provisions and launches end to end. - Every TLC case lives in the core test project, so on a pull request TLC runs
only when the change selects
test/lattice(select-test-packages.shderives that from the project graph). A change confined to another package, or to documentation, runs no TLC at all; pushes and dispatches select every package. - Exhaustive TLC is every base, variant and mutation case of the modules
that run, routed onto the
"tlc": trueshards. Each module promoted from the live checkpoint advance's design model (epic #5605), and the composite interface check that joins them, has a shard of its own, routed by its exact module name inTlcCiShard, holding its base, variants and mutations together, so its base serves its mutations' controls and the module never lengthens another shard.WalLiveAdvanceCoreoutgrew one shard: its variants and its claimless-advance mutations are routed onto further shards of their own, and its base keeps every mutation whose control it serves. - Gate only under perturbations means
RefinementPerturbationTests, which checks every perturbation's anchors, row and detectors without building or running anything. Only the weekly lane applies the perturbations. - A lightweight pull request (only
videos/,.github/copilot-instructions.mdand files under.github/workflows/other than the TLC routing files thatlightweight-change.pylists) runs no test leg and no content-gate fixture at all, so it runs neither smoke nor exhaustive TLC. Those listed files, the toolchain action and pins, and everything underspec/are never lightweight; a change toci.ymlorcoverage.ymlalone is. ci.ymlcan also be dispatched by hand on any branch. That run is evaluated like a push: every package, every tier and exhaustive TLC, with an input that switches receipts off.- Two other workflows provision the toolchain but are not lanes of this table.
ci-serial-old.yml, the manual-dispatch serial control thatci.ymlreplaced, runs every TLC case in its single deterministic leg when it tests the core package, and never reads or writes a receipt. The test legs ofpublish.ymlskip both exhaustive TLC and the smoke case, because that workflow first requires a successful release-linebuild-and-teston the exact tag commit.
Deciding whether a pull request model-checks
tlc-inputs.json sorts every file
that can affect a TLC run into three classes, and
tier-scope.py reads it:
- Verdict inputs can change a verdict or the set of TLC cases: the
.tla,.cfg, manifest and mutation files underspec/; the Formal harness that discovers modules, builds cases and configurations, and launches and judges TLC; the shared hygiene code and build files it compiles against; and the TLA+ toolchain (tools/tlc/, whosetoolchain.jsonholds every pin, and thetla-toolchainaction). A change to any of them runs exhaustive TLC. - Routing files decide which job runs which existing case, or provision and
launch legs:
test-shards.json, the matrix planners,tier-scope.py,TlcCiShard.cs, the census, the receipt scripts and the workflows that launch TLC legs. A routing-only change that is not lightweight runs the smoke case, and the toolchain-free partition check inCiMemberPullRequestTieringTestsproves every TLC case is still selected by exactly one TLC shard. - Neutral files never affect a TLC run: refinement notes and READMEs, the
perturbation files, unmanifested design models under
spec/<area>/design/, and the Formal and workflow files nothing on the TLC path references. A design model is not a module until it gains a manifest, so no TLC run executes it;TlcInputClassificationTestsfails if any module's manifest,.tlaor cfg is neutral, so promoting a model makes it a verdict input.
Routing and neutral are exclusions, so a path inside a verdict glob that a
routing or neutral glob also matches is not a verdict input. When unsure, a file
is a verdict input. TlcInputClassificationTests requires every file under
test/lattice/Formal/, .github/workflows/ and .github/actions/ to be
classified exactly once.
When exhaustive TLC is selected, receipts then decide which modules actually run (next section). The flowchart shows the whole decision for one pull request.
flowchart TD
PR["Pull request: changed-file list"] --> LW{"lightweight-change.py: only videos, unlisted workflow files or the instructions file?"}
LW -- yes --> NOTEST["No test legs: no TLC"]
LW -- no --> SEL{"select-test-packages.sh: does the change select test/lattice?"}
SEL -- no --> NOTLC["No TLC case is selected"]
SEL -- yes --> TS{"tier-scope.py with tlc-inputs.json: a verdict input changed, or the list is missing or empty?"}
TS -- no --> SMOKE["Smoke case only, plus the partition check"]
TS -- yes --> REL{"Base is release/**?"}
REL -- yes --> ALL["Every module runs on the tlc shards; no receipt read or written"]
REL -- no --> FP["tlc-fingerprint.py: one fingerprint per module"]
FP --> CEN["TlcCaseCensusTests: case census and categories"]
CEN --> LOOK["tlc-receipts action, lookup: own scope, base branch, main"]
LOOK --> PLAN["plan-test-matrix.py removes the TlcModule cases of every module with a trusted receipt"]
PLAN --> LEGS["Legs run the remaining modules; each finished item saves partial receipts"]
LEGS --> AGG{"Aggregate: did every census case of the module pass, or did a receipt verify it?"}
AGG -- "ran and passed" --> SAVE["Save a receipt in the pull request's own scope"]
AGG -- "verified by receipt" --> CACHED["Reported as cached, naming the run that wrote the receipt"]
AGG -- "failed or incomplete" --> RED["Check fails"]
For a release-line pull request, tier-scope.py plans exhaustive TLC whatever
the diff touches, once the run selects test/lattice and is neither lightweight
nor a version bump. Integration-branch and release-line pushes, and a ci.yml
dispatch, select every package and always plan exhaustive TLC, as does the
nightly lane. An integration-branch push is never skipped by its own diff, because the run for the previous push may
have failed or been cancelled by this push's concurrency group, so its verdict
cannot be assumed. It saves only through receipts, which exist only for
fingerprints that actually passed.
Fingerprints and verdict receipts
A fingerprint (tlc-fingerprint.py)
is a content hash per module over everything that can change that module's
verdict:
- the module's specification closure (every
.tlain its directory), its cfg and variant cfgs, its manifest and every file in its mutation directory; - the harness: every verdict input that no module claims, such as the Formal harness, the build files and any stray specification file;
- the toolchain: the files
tlc-inputs.jsonlists undertoolchain.
Routing and neutral files are excluded, so editing a refinement note or a shard
assignment leaves every fingerprint unchanged. Every .tla in a module
directory belongs to each module there, so editing a specification changes the
fingerprints of the modules in that directory and no others; editing the harness
or the toolchain changes all of them, so every module reruns. Content is hashed after
normalising line endings the way git does, so a Windows and a Linux checkout
agree. TlcFingerprintCompletenessTests runs the script's self-test.
A verdict receipt records that every census case of one module passed at one
fingerprint, in one run. It is a GitHub Actions cache entry keyed
tlc-verdict-v1-<Module>-<fingerprint>, written by
tlc-receipts.py through the
.github/actions/tlc-receipts action, and it names the run, attempt, commit,
event and ref that produced it. The aggregate job reports every module as ran,
cached, failed or incomplete, and an incomplete module - one with neither a
receipt nor a result for every census case - fails the check, because that is
what a receipt or routing defect would look like.
Each leg also writes a partial receipt per module and finished item whose cases of that module all passed, even when the leg fails or the run is cancelled. A later run that trusts that scope assembles a full receipt from one run's partials once they cover the module's census, so a cancelled run's completed modules are not paid for twice.
The trust model
Receipts are read only from the run's own cache scope, its pull request's base
branch, and main, never from another pull request. That is the Actions cache's
own scoping rule, and the lookup lists only those refs. A pull request writes
only to its own scope, so it cannot plant a receipt that its base branch or
main would read.
sequenceDiagram
participant PR as Pull request run (ci.yml)
participant IB as Integration-branch push (ci.yml)
participant MW as Push to main (formal-receipts.yml)
participant NC as Nightly Coverage (coverage.yml)
participant C as Actions cache
PR->>C: lookup in own scope, base branch and main
C-->>PR: receipts for unchanged fingerprints
PR->>C: save receipts and partials in the pull request scope only
Note over PR,C: No other pull request and no branch can read that scope
IB->>C: lookup in the branch scope and main
IB->>C: save receipts in the branch scope
Note over IB,C: Member pull requests read them as their base branch
MW->>C: list main receipts for the new fingerprints
MW->>C: run only the modules with none, then save in the main scope
NC->>C: never look up: every module runs
NC->>C: save receipts in the main scope
Note over MW,NC: Every pull request and branch can read main receipts
Release-line pull requests and pushes never use receipts, so Publish's
requirement of a successful release-line build-and-test on the exact tag
commit still means every module ran on that commit. A ci.yml dispatch with
tlc_receipts: off runs every module the same way, which is the dry run of a
release line on any branch.
What a fingerprint cannot see is runtime drift: the JDK patch level setup-java
resolves within the pinned major version, or the runner image itself. Two runs
with identical fingerprints can in principle diverge on those, which is why the
nightly lane ignores receipts.
Nightly exhaustive TLC
The Coverage workflow (coverage.yml)
runs nightly from its schedule. When a push to main finds that the night's
scheduled run has not happened,
coverage-catch-up.yml
dispatches it. Beside the coverage legs it
runs every "tlc" and "tlcSmoke" shard of test-shards.json on main,
planned by plan-coverage-matrix.py from CI's own partition and estimates:
- Uninstrumented. The TLC legs run through
run-test-leg.pyexactly asci.yml's legs do, not under coverlet. - No receipt is ever read. This is the one lane that checks every module
against a toolchain and runner image that can drift without a diff, and a
receipt would turn that backstop into a check of nothing.
CiCoverageLaneScheduleTestsforbids a receipt lookup in it. A separatetlc-receiptsjob then saves a receipt in themainscope for every module whose every census case passed that night, which keepsmainwarm for the next pull request; a receipt-writing fault never reads as a TLC failure. - One tracking issue. A failing night opens or updates one issue labelled
ci, titled "Nightly exhaustive TLC failing on main", and the first green night closes it. Only the tracking job may write issues. - A quiet night skips with the coverage legs, so TLC reruns when
mainmoves; a manual dispatch rechecks an unchanged commit. A dispatch on another branch can restrict the run to named TLC shards to validate the lane itself; the default branch ignores that restriction.
Push to main: keeping receipts warm
formal-receipts.yml runs on every
push to main. It fingerprints the commit and lists the receipts main already
holds. When every module has one, it stops before building anything. Otherwise
it takes the case census, runs only the modules without a receipt on TLC legs,
and saves their receipts in the main scope once every census case passed. A
pull request opened just after a merge then finds main receipts for every
module it did not change.
Weekly production perturbations
A refinement row says that a detector test would notice production deviating
from the specification. A production perturbation is the experiment behind
that claim: an anchored edit to one file under src/ that breaks the behaviour
the row describes, plus the detectors the row cites (format: the perturbations/
row of the module layout).
- On every non-lightweight pull request,
RefinementPerturbationTestschecks without building that every anchor applies exactly once, the row and detectors resolve, and every behaviour row of a perturbed module is either seeded or listed with a reason. - Weekly,
formal-perturbations.ymlrunstools/perturbations/run-perturbations.pyover every perturbation onmain, split across parallel shards that each build once. In each shard the detectors first run on the unperturbed tree as a control that must pass; then, per perturbation, the edit is applied, the tree rebuilt and the detectors run, and at least one must fail. A failing run opens or updates oneciissue, "Weekly production-perturbation lane failing", listing every undetected perturbation and red control; the first green full run closes it. A partial dispatch on the default branch never touches the issue.
Only rows that have a perturbation are re-checked this way. For every other row, "the detector goes red when that code is perturbed" is a claim made when the row was written, held in place by the existence and runnability gates below but not re-run.
Refinement gates
The refinement gates are toolchain-free, run in the content gates on every non-lightweight pull request, and connect each module to production code. The graph shows what each artifact is checked against.
graph LR
SPEC["spec module .tla and .cfg"] --> MUT["mutations"]
MUT --> TLC["TlcModelCheckTests"]
SPEC --> NOTE["refinement note"]
NOTE --> PROD["production symbols"]
PROD --> STALE["RefinementMappingStalenessTests"]
NOTE --> DET["detector tests"]
DET --> EXIST["RefinementDetectorMappingTests"]
DET --> RUN["RefinementDetectorRunnabilityTests"]
NOTE --> GAPS["deliberate abstraction gaps"]
GAPS --> REG["RefinementGapRegisterTests"]
PERT["perturbations"] --> PGATE["RefinementPerturbationTests"]
PERT --> WEEK["formal-perturbations.yml"]
WEEK --> DET
NOTE --> IDX["RefinementIndexTests: refinement index"]
GAPS --> IDX
DIFF["pull request diff"] --> IMPACT["formal-impact.py"]
IDX --> IMPACT
IMPACT --> SUMMARY["job summary: rows and gaps touched"]
GRAINS["grain classes under src"] --> SURF["RefinementSurfaceCensusTests"]
NOTE --> SURF
UNM["spec/UNMODELLED.md"] --> SURF
- Existence and staleness.
RefinementMappingStalenessTestsrequires every production symbol a note names to exist undersrc/, andRefinementDetectorMappingTestsrequires every behaviour-asserting row to cite at least one detector that resolves to a real test. Its acceptance census requires every such row to readYesand no note to cite an open issue as the owner of a gap. - Runnability.
RefinementDetectorRunnabilityTestsrequires every cited detector to be a test some CI lane executes: not[Ignore]or[Explicit], on the method, its fixture or a base fixture, and carrying categories that a filter of the planner's full plan selects. A detector only the Coyote or chaos tier runs is runnable but is not run on member pull requests, which skip those tiers; the census reports it rather than failing it. - Abstraction-gap register. Each note's
## Deliberate abstraction gapssection is a register: one bullet per gap, ending in the production symbols it concerns or a stated reason it names none.RefinementGapRegisterTestsresolves every listed symbol and requires every production symbol the prose names to be listed. - Unmodelled grains.
RefinementSurfaceCensusTestsrequires every grain class undersrc/to be named by some note, by its class name or its own contract interface, or to be listed with a reason inspec/UNMODELLED.md. A row for a grain that is gone, moved or now named fails it. - Refinement index.
RefinementIndexTestswrites every note's rows (with their production symbols and detectors) and gaps (with their symbols) as one JSON document whenLATTICE_REFINEMENT_INDEXnames a file. The content gates upload it as therefinement-indexartifact. - Formal impact. On every non-lightweight pull request,
formal-impact.pymaps the changedsrc/**/*.cstypes and members onto that index and writes to the job summary which refinement rows the change touches, and which abstraction gaps - code the specifications explicitly do not model. The report is advisory: it fails only when the index is missing or malformed, or git fails. Its--gatemode is implemented and self-tested but not wired, for the reasons recorded in the script. - Area census.
FormalCoverageAreaCensusTestsre-derives every figure of the areas table from the manifests and notes, and requires every module to be counted exactly once on that page.
Trace validation - checking that a recorded production run is a behaviour the
specification allows - was evaluated for AtomicCommit as a spike and is not a
CI gate; see the spike report.
What a green check means, and what it does not
- A green pull request into
mainor an integration branch that changed no verdict input ran the structural gates and, when it selectedtest/lattice, the smoke case - not exhaustive TLC. Its diff could not change a verdict, which is what the classification guarantees. - A module reported as cached was not model-checked in this run. A receipt says its every census case passed at the identical fingerprint in the named run, which the run summary links.
- Runtime drift - a new JDK patch release or runner image - is outside every fingerprint. Only the nightly lane, which ignores receipts, would see it.
- Perturbation evidence covers only rows that have a perturbation, and is refreshed weekly, not per pull request.
- The formal-impact report never blocks. A pull request that changes code a refinement row or abstraction gap names is told so in its job summary, and is free to merge.
- A member pull request skips the Coyote and chaos tiers. Detectors that only
those tiers run are exercised on the integration branch's push lane and on its
pull request into
main, not on the member. - A pull request that does not select
test/latticeruns no TLC, not even the smoke case. Its diff touches neither a specification nor anything the core test project builds from. - A lightweight pull request runs no TLC. That includes a change to
ci.ymlalone, which the workflow self-tests and its pull request's guard steps cover instead.
Failure directions
Wherever the pipeline cannot tell, it runs more, never less:
- A missing or empty changed-file list runs exhaustive TLC.
- An unreadable, malformed or unknown-schema
tlc-inputs.jsonfails the run; it never skips TLC. - An event or base
tier-scope.pydoes not recognise keeps exhaustive TLC. - A receipt cache miss, or a fingerprint that moved, runs the module.
- A module with neither a receipt nor a result for every census case fails the aggregate as incomplete, rather than reading as green.
- A failed or cancelled run saves partial receipts only for items whose cases all passed; nothing it did not finish is trusted.
- Release lines, the nightly lane and a dispatch with
tlc_receipts: offrun every module and read no receipt. - In CI a missing toolchain fails
TlcModelCheckTests; only locally does it skip, as a visibleSkippedcount.
How to
Reproduce a lane locally
The structural gates of the core project (the content gates run the same filter, also excluding
Explorer.UiTests, over the whole solution):dotnet test test/lattice/Orleans.Lattice.Tests.csproj --filter "(FullyQualifiedName~Formal|FullyQualifiedName~Hygiene|FullyQualifiedName~Docs)&TestCategory!=Tlc"The TLC decision for a list of changed paths:
python3 .github/workflows/tier-scope.py --event pull_request --base-ref main --changed-files changed.txtFingerprints, to see which modules a change reruns:
python3 .github/workflows/tlc-fingerprint.py --output fingerprints.jsonOne module's exhaustive TLC, with the toolchain provisioned as How to run TLC describes:
dotnet test test/lattice/Orleans.Lattice.Tests.csproj --filter "TestCategory=TlcModule_AtomicCommit"One area's perturbations:
python3 tools/perturbations/run-perturbations.py --area atomic-commit --output result.jsonThe formal-impact report for a commit range, given an index written by
RefinementIndexTests:python3 .github/workflows/formal-impact.py --index refinement-index.json --base <base-sha> --head <head-sha>
Force a full run
Dispatch ci.yml on the branch with tlc_receipts: off: every package, every
tier and every module runs, and no receipt is read. Dispatching coverage.yml
on the default branch reruns the nightly lane, including every TLC shard,
against the current main.
Add a module, mutation, variant or perturbation
- A module. Create
spec/<area>/with the files the module layout lists. Discovery finds it with no code change: the module gets aTlcModule_<Module>category, runs in the TLC catch-all shard (or, when its name or directory matches one ofTlcCiShard's prefix rules, has some or all of its cases routed by that rule) untilTlcCiShardroutes it by name, and has a new fingerprint, so the pull request that adds it runs it exhaustively. The same pull request adds it to thespec/README.mdindex and to Formal Coverage's census - a row of the areas table (withFormalCoverageAreaCensus.AreaModules) or the materialised-view companions table - and deletes anyUNMODELLED.mdrow for a grain its note now names. - A mutation. Add the
.mutationfile and raisecounts.mutationsin the manifest, the module README's counts table and the area's row of the areas table. The module's fingerprint changes, so that module, and only that module, reruns. - A variant. Add
<Module>.<Variant>.cfgand declare it undervariantsin the manifest with its state count.TlcCiShardroutes variants automatically; the module's fingerprint changes and it reruns. - A perturbation. Add
spec/<area>/perturbations/<Name>.perturbationand update that directory's## Unseeded rowstable. Perturbation files are TLC-neutral, so the pull request runs only the smoke TLC case; the rest of the suite and the content gates,RefinementPerturbationTestsamong them, run as for any change underspec/. The next weekly run applies it, and aworkflow_dispatchofformal-perturbations.ymlwith that file as the selection applies it straight away.
Related
- Formal Coverage - what each area checks, how much, and what it does not cover.
spec/README.md- the module index, the module layout, the gates, and the CI decision and budget.- Testing instructions - the test tiers and the filters that exclude TLC from the dev loop.