Skip to content

Test-graph cache key omits the compiler binary — miscompiled tests stay green across gate runs #655

Closed

Description

@ehartford

What happened

During the D7 gate runs, behav_arena_vec.w reported green in a full with build :test while the compiler in use actually miscompiled it (sizeof-in-generic regression: every arena_vec_push stored 0 bytes). The test only went red on the NEXT gate run, after an unrelated commit. Bisect proof: a pure-checkpoint compiler rebuilt from the exact gate-1 tree fails the test — so gate 1 never executed it; the test-graph carried it as cached-green from a pre-regression run.

Root cause

The behavior-test graph's cache key covers the test inputs but not the compiler binary (or its content hash) that compiles/runs them. When only the compiler changes, cached test results are reused, so compiler regressions do not re-execute the suite's cached-green tests.

Expected

with build :test must re-run a test when the compiler that would build it differs from the one that produced the cached verdict — e.g. include the stage2/release binary's content hash (or the stage inputs' hash) in each test target's cache key.

Impact

Gate runs can report a green suite for a compiler that miscompiles arbitrary tests; "tests passed" then means "tests passed under some earlier compiler." This directly weakens :test as a bootstrap gate (spec: the success checklist requires the suite to pass for the change under test).

Repro sketch

  1. Run with build :test to populate the cache (green).
  2. Introduce a codegen regression that breaks a cached-green behavior test; rebuild stages.
  3. Run with build :test again: the broken test does not re-run and stays green.

Found while gating the D7 receiver campaign (sizeof[T] regression, fixed separately with behav_generic_sizeof_param.w as its pin).

Activity

  1. ehartford commented on Jul 11, 2026

    @ehartford
    ContributorAuthor

    Redesigned in 8c88c5f per maintainer direction, following the unanimous reference-toolchain design (Go test.go:1879 — toolchain chained into the verdict key; Rust compiletest lib.rs:666 — rustc binary is stamp input #1; Zig Compilation.zig:2115 — compiler version seeds every manifest):

    • Per-file PASS verdict cache keyed on sha256(target config + WITH_MEMORY_LIMIT_BYTES + compiler content fingerprint + test rel path + test file fingerprint). Failures never cache. A red run banks its greens, so consecutive gates cost only failures + changed files.
    • The runner no longer aborts at the first failing batch — every failure is reported in one sweep (the abort over alphabetized files is why ten consecutive gate chains each surfaced exactly one pre-existing bug).
    • The .test-pass evidence manifest (:test-green/:last-green) is now v2 with compiler-sha256 + per-file content hashes; build/retention.w mirrors it byte-for-byte.

    Verified by a six-step sandbox matrix including explicit compiler-swap invalidation (0 cached, 3 ran). Leaving open until the full gate chain validates it repo-scale.

  2. ehartford commented on Jul 14, 2026

    @ehartford
    ContributorAuthor

    Fixed in 8c88c5f: per-file verdicts are keyed compiler-fingerprint-first, so a changed compiler invalidates every cached verdict. This session exercised it end to end — switching the driver binary invalidated the full cache and forced live reruns of every target.

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