RFD 0055 — The conformance corpus: a standing golden differential-correctness gate
- State: accepted
- Depends on: RFD 0048 (the
testatom — the in-language golden vehicle), RFD 0050 (documentation architecture / “every package compiles and runs in CI”), RFD 0018 / RFD 0020 (the reasoner andEngine::evaluatethe corpus exercises), RFD 0005 (refined collections / field projection — the keystone bug’s home), RFD 0025 (mutation delta-guard — the write-path goldens) - Tracks: issues #1024, #1025, #1026; guards #1014, #1015, #991, #1001, #1005, #996
- Prior art: differential testing (McKeeman 1998); metamorphic testing (Chen et al.); golden / characterization tests (Feathers); SQL logic tests (SQLite’s
sqllogictest); the project’s own Lean batched oracle (engine_agrees_with_batched_lean_oracle) and pipeline differential audit (pipeline_differential_audit_over_corpus)
Question
A 2026-06 maturity audit and a real-ontology dogfood found roughly nine silent-wrong engine bugs — wrong answer, no error — that 3,200+ unit tests, the Lean differential oracle, and the pipeline differential audit all passed over. The field-projection P0 (#1014) is the archetype: a field read aliasing across two co-classifying concepts with same-named fields, whose regression test had been #[ignore]d and whose shape no oracle covered.
Why did every oracle miss them, and what gate closes the class?
Context
Every existing correctness oracle attaches at or below Engine::evaluate:
- the Lean batched oracle and the golden replay vectors check the reasoner over already-elaborated programs;
- the pipeline differential audit checks
direct ≡ pipeline ≡ frozen— three evaluation routes over the same compiled rules; - the
FullRecomputeMaintainerIVM oracle checks incremental maintenance against from-scratch recompute.
The silent-wrong bugs live in the front half of the pipeline — elaboration (value-fn inlining #991/#1001/#1005), lowering and materialization (field-projection concept-keying #1014, defined-concept extent ordering #1015), the mutate write path (#992, #996), and serialization (#993–#995). A self-differential oracle is structurally incapable of catching a front-end defect: when a lowering bug corrupts the input, every downstream route inherits it and they agree — on the wrong answer. The pipeline audit passes the #1014 buggy state for exactly this reason.
The gap was therefore not oracle existence but corpus breadth at the surface, checked against a truth the oracles cannot derive: the program’s intended meaning.
Decision
Add a standing conformance corpus of small, clean, documented ontologies whose expected results are hand-pinned and checked end-to-end through the real ox CLI, gated in CI. Golden (human-anchored) is the primary method; the existing oracles remain the floor underneath for the reasoning core and the optimizer/IVM paths. This is the front-half layer they cannot reach.
It lives Argon-side (Tide depends on Argon, not the reverse — the gate must stand alone), in a new top-level conformance/ directory, separate from examples/: examples/ is the teaching corpus gated on compilation (ox check); the conformance corpus is adversarial, gated on golden output, and enforces a rule that would be wrong for teaching examples — no entry without a golden.
Design
- Tree.
conformance/corpus/<entry>/— an ordinaryoxpackage (ox.toml,root.ar, model modules) plus its golden: atests/directory (thetestatom) and/or ademo.tomlscenario withexpectassertions. AREADME.mdcarries provenance (guards:/feature:/method:). Refusal fixtures carry arefuses.txtlisting theOE####code(s) the build must be refused with. - Gate.
compiler/crates/oxc-driver/tests/conformance_corpus_gate.rs— acargo nextesttest that discovers everyox.tomlundercorpus/and shells out toCARGO_BIN_EXE_ox(always source HEAD, never a stale installed toolchain). Positive entries mustox buildthen passox testandox run-scenario; refusal fixtures must be refused byox check --codeswith each pinned code. - Three guarantees beyond the examples gate. Correctness not just compilation; no entry without a golden (the
#[ignore]d-test failure mode, prevented structurally); refusals pinned by code. - Methodology. “Correct” is established per entry by a hand-specified golden encoding the program’s intended answer — so a front-end bug that corrupts every route still fails against the human-known truth. Where an oracle is independent (the reasoning fragment), it remains a second check.
The keystone multi_classification_fields is the acceptance witness for #1014: on a toolchain without the fix both version projections return both type-confused rows and the equals golden fails (got 2, expected 1); with the fix, green.
This RFD also records the stratify.rs fix it carries: the refusal Display strings for AggregateCycle (OE1317), NegatedWfsRelation (OE1365), and NafCycle (OE1309) now embed their code prefix, so ox check --codes names them — the eval-time variants already did; the stratify-path ones silently dropped the code the corpus pins (#1025).
Alternatives considered
- Tide-side workflow corpus. Rejected: Argon’s correctness gate must not depend on a downstream repo. The wire/serialization bugs (#993–#995) live in Argon crates (
oxc-connection,oxc-gen) and are checkable Argon-side. - Extend the Lean fuzzer instead. Rejected as the primary fix: the fuzzer generates post-elaboration
ProgramFeaturerules, bypassing the surfacefn/lowering/mutate paths where the bugs live. It remains the right tool for the reasoning fragment. - Fold into
examples/. Rejected: conflates teaching with adversarial regression and makes the no-golden rule impossible to enforce (teaching examples legitimately lack goldens).
Open follow-ups
- #1024 — write-side enum/option value literals (
None,Some(x), enum constants) error at runtime despite building clean; blocks the real absent-optional write entry (optional_iterationguards the nearest expressible contract meanwhile). - #1026 — the scenario harness drops the Truth4 verdict from federated rows, so
expectcannot assert it;standpoint_federationpins membership + scoped views meanwhile. - The corpus may later sweep
examples/goldens (theirdemo.toml/testsare not currently run wholesale in CI) and register reasoning-evaluable entries into the pipeline differential audit for the free route-equivalence check.