Skip to content

[P2] Add deterministic grammar-driven differential compiler tests with shrinking #67

Description

@wsdt

Audit: 2026-09-05, commit 2b3b1ee24da2.
Classification: Regression-prevention enhancement grounded in audit results and prior failures. Priority: P2.

Motivation and current evidence

The repository has extensive example, hostile-input, and property tests. tests/property_tests_v1.rs tests the language's property-generation surface; it is not a replacement for systematically generating compiler inputs across syntax/ownership combinations.

Earlier issues #21#47 include backend local-indexing errors, checked-arithmetic mismatches, frontend stack failure, and superlinear analysis. During this audit, 72 independently generated small programs across i64/i32/u8/usize/f32/f64 produced the expected 42 in both the interpreter and ordinary Wasm runtime. That is useful focused evidence, not exhaustive correctness. No dedicated continuously exercised compiler fuzz target/job was found in the inspected tree/workflows.

Proposed first slice

Build a seedable typed grammar generator for the commonly admitted scalar subset, with shrinking that preserves enough structure to reproduce a discrepancy. Generate nested operands, parameterized helper calls, branches, loops with explicit bounds, shadowing/mutation, contracts, checked failure, and lazy evaluation.

Compare canonical parse-format-parse stability and graph identity, verifier/HIR agreement, interpreter outcomes, native O0/O2, and Wasm outcomes only where each target admits the same profile. Normalize expected arithmetic/contract failures; distinguish capacity rejection from semantic disagreement. Add an invalid-input mutation lane for the parser and protocol boundaries, with strict process/time/memory bounds.

Acceptance criteria

  • Fixed seeds run in PR CI, while a larger bounded campaign can run separately.
  • A discrepancy produces source, seed, compiler commit, toolchain identities, exact commands, expected/observed outcomes, and a minimized case.
  • Imported earlier regression cases remain deterministic seeds.
  • Unsupported profiles and absent provisioned tools are explicit outcomes, never silently counted as parity passes.
  • Failure injection proves the differential checker notices a wrong backend value, incorrect failure selection, and an abort.
  • Add work/allocation counters or scaling fixtures to catch complexity regressions without flaky global time thresholds.
  • No fuzzer-generated file is executed with ambient network, filesystem, process, or signing effects.

Reuse existing backend/parity harness modules rather than adding hundreds of standalone integration binaries. The first tranche can be scalar-only; owned cleanup and task schedules should be separate incremental extensions.

Agent handoff

Recheck the working revision and existing issues first. Read AGENTS.md, the relevant completion-matrix row, and the owning versioned specifications. This proposed slice must preserve canonical source, independent replay, precise target admission, and separately granted authority. Place regressions in the existing owning harness. Execute the applicable quality gates and record what actually ran; unrun native, hosted, or device evidence must stay unpromoted.

Audit revision scope

Runtime observations in this ticket belong to commit 2b3b1ee. A final source-tree comparison against e1c5b56 was used to check for obvious superseding changes. That later snapshot was not rebuilt or exhaustively retested. Reproduce on the intended fixing revision before implementation.

Audit ID: SPX-AUDIT-20260905-20

Suggested scope: M then L. Dependencies: None required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions