Skip to content

Script sweep: every gate in one compiled language, and no gate invoked by nothing #368

Description

@avrabe

[fathom (gale) — script sweep: every gate in one compiled language]

A sweep of every script in the repo, to decide what is actually used and move
verdict-bearing logic off shell. Inventory is measured, not estimated.

Inventory

80 tracked .sh/.py — 60 shell, 20 Python.

bucket count
invoked by a workflow 24 (12 sh / 12 py)
referenced only by another script 18
referenced by neither ("dark") 38

The dark set is not rot: only 4 are untouched >90d. The other 34 are recent
silicon/bench operator tools. But 5 of them are gate-like — they assert
properties and nothing runs them:

11  silicon/wasm-testbed/arch/riscv/run_rv_funccheck.sh
 6  benches/gust/optimization/wsc-facts-phase1.sh
 5  silicon/wasm-testbed/resurvey_struct_return_decides.sh
 3  silicon/wasm-testbed/arm_harness.py
 3  benches/gust/run-fused.sh

This is the shape emit-wcet.sh already had: a real gate, written, invoked by
nothing. It was catalogued in #324 and dismissed as "builders, and less alarming".

Why this is worth doing

Hazard classes in the 12 CI-invoked shell scripts: 23 || true, 20
2>/dev/null, 12 verdicts read through a pipe, 11 grep -c/wc -l as a
verdict. Not all are defects — some are correct and commented. But each is a
place where a failure becomes a passing verdict, and reviewing them one at a time
is the only way to tell which.

Re-reading a single script the sweep started on produced four real defects (fixed
in abd76eb):

  1. cmp A B && echo "byte-identical" — in an && list a failing left-hand
    command is exempt from set -e. A drifted object printed its diff to stderr
    and the script ran on to print ALL GATES GREEN. Verified directly: cmp a b && echo on differing files exits 0.
  2. Fixing (1) exposed the comparison asserted the wrong thing — it compared
    current-synth output against a synth#757 reproduction frozen at 0.45/0.46.
    The file's header already stated the real claim (--emit-wcet does not
    perturb the object) and nothing checked it.
  3. It resolved synth from a path on one laptop and no runner, and the job never
    ran varve install.
  4. It overwrote a committed sidecar every run, so checking the evidence rewrote it.

And in a Python gate: check-object-freshness.py claimed to census every
committed object while globbing */*-cm3.o — one directory deep, one suffix. 24
committed, 22 seen. Language is not the whole story; enumeration is.

Target

An xtask crate. There is no Rust workspace or xtask today, so it has to be
built first. Every gate becomes cargo xtask check <name>, conforming to the
CLI baseline (--version/-V, --help exit 0, unknown flag exit 2,
--format json).

Scope decided: one language. The 7 Python gates port too, not just the
shell — a repo with gates in three languages cannot state a single rule about
how a verdict is produced.

The safety mechanism

The failure mode of this migration is porting a gate into one that is green
because it cannot distinguish — the exact defect class the sweep exists to
remove. So no gate is retired on review alone:

  1. Port the gate to xtask, including its negative control (--self-test).
  2. Run old and new in the same job and assert the verdicts agree, on the
    real inputs, for at least one merge cycle.
  3. Only then delete the original.

A port whose negative control does not fire is not done.

Phases

  • 0 — xtask skeleton, CI harness, one gate end-to-end as the pattern.
  • 1 — the 7 Python gates, one PR each, shadow-then-retire.
  • 2 — verdict-bearing shell (check-wit-resolve.sh, emit-wcet.sh's embedded
    Python, the build scripts' assertions).
  • 3 — the 5 dark gate-like scripts: decide gate-or-tool, wire the gates.
  • 4 — label the remaining operator tools so "dark" stops being ambiguous;
    delete the 4 stale after confirming nothing needs them.

Phases land against the 2-PR ceiling (~60-75 jobs each), so this is paced, not
a single sweep.

Non-goals

  • Rewriting operator tools. Shell is fine for loud orchestration a human runs.
  • build-cross-arch.sh stays shell: it is used only as a negative control, where
    its failure is the assertion.

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