Skip to content

deep-debugging-tools: a migration differential, and corpus tests that print the provenance of what they ran (bisecting a corpus is a missing tool) #2230

Closed

Description

@ehartford

Found on #2214. Re-migrating pcre2 under the zeroed migrator changed 15 sites in six files; the first pcre2-promote failed its heap-8 test (free 40960 printed as free unremembered block). Locating it took: the compiler alone on the checked-in corpus (pass), then the fresh files one at a time (all pass), then the official promote again (pass). The first failure never reproduced: it coincided with the native runner's first attempt at pcre2-build/pcre2-check-generated exiting 97 at Workspace.begin_intercept and the evaluator re-running them, so the test very likely ran a pcre2test built from a half-finished state. Two tools are missing, per Eric (2026-10-06: "when we are bisecting that means we have a lack of instrumentation"):

  1. Corpus tests print what they ran. run_pcre2_test_action (and the zlib/tommyds/c-algorithms test actions) record nothing about the binary and bundle under test. Each should write a provenance line into its output dir and the log: the sha256 of the test binary, the .wo manifest key, the compiler's generation and the source digest of the corpus directory; <stem>-promote names it. A stale or partial build is then visible at the first failure instead of after three rebuilds. And build_runner_postprocess's 97 fallback must not leave the native attempt's partial outputs for the next target to consume: outputs land only on success (scratch + rename), and the fallback line names the outputs it discarded.

  2. A migration differential. with migrate-diff <old-dir> <new-dir> (or with analyze over two migrations): pairs the changed functions, names the migrator rule behind each changed site (the migrator tags each rewrite it applies), compiles both corpora and diffs the MIR facts (analyze facts) of every changed function, and reports any difference beyond the intended rewrite — a drop, a move, an extra temporary, a changed call — by function and site. On migrate: map {0} initializers and memset-to-zero to T.zeroed() (D101) #2214 that answers "which of 15 .zeroed() rewrites changed behavior" in one run; the answer for this incident would have been "none", which points at the build.

Route to add to docs/spec/toolchain/deep-debugging-tools.md: A re-migrated corpus fails its own test suite → provenance line first, then migrate-diff, then the corpus route; never a file-by-file bisect.

Activity

  1. ehartford commented on Oct 7, 2026

    @ehartford
    ContributorAuthor

    Part 1 (corpus tests print what they ran) is PR #2232 on stack #2228. Part 2 v1 is tools/migrate_diff.w (branch migrate-diff, stacked on #2232, PR after the stack merges): lays both migrations out as the cohesive lib layout, check --dump-mir of the main module, per-function statement comparison with every positional id normalized. On #2214's pcre2 it names 4 functions, each with exactly the zeroed rewrite. Still open from this issue: the migrator naming the rule behind each rewritten site, and the 97-fallback leaving the native attempt's partial outputs in place (the likely cause of the never-reproduced heap-8 failure). A regex literal opening a statement is #2233.

  2. ehartford commented on Oct 7, 2026

    @ehartford
    ContributorAuthor

    Second half (migrator rule tags, rules.tsv read by migrate_diff) merged in db013d9 (PR #2247). Both halves of this issue are now in: the provenance lines and the 97-fallback discard (#2234), and the rule-attributed migration differential.

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