Skip to content

WIP: test(differential): anchor oracle resolution to GNU_BIN (Refs #1478) - #1481

Merged
caomengxuan666 merged 2 commits into
mainfrom
fix/runner-oracle-resolution-1478
Nov 1, 2026
Merged

caomengxuan666 merged 2 commits into
mainfrom
fix/runner-oracle-resolution-1478

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #1478

Problem

tests/differential/runner.sh resolved the GNU oracle by bare name whenever GNU_BIN lacked a command: find_oracle fell back to command -v, so the host silently answered — procps /usr/bin/kill graded the util-linux kill corpus (11/12 cases in the #1468 baseline run), BSD ncal answers for cal, and in non-exec lookup forms a bash builtin token could stand in for a binary. No warning, no record: the report never said which program produced the oracle side.

Fix (mechanism, not a kill special case)

  • Anchored by default: with GNU_BIN set, a command resolves only inside that tree (plain or .exe).
  • Explicit, noisy fallback: host resolution survives only for commands named in the new tests/differential/oracle-host-allowlist.txt — the audited set coreutils does not build (util-linux, diffutils, findutils, grep/sed, gettext/glibc helpers, file/which/xxd/unix2dos). Every use warns on stderr. GNU_BIN unset remains available as an explicitly warned ungoverned host mode for ad-hoc runs.
  • type -P instead of command -v for host lookup: it returns executable files only, never a builtin/function/alias token for echo/printf/test/kill.
  • Pre-flight audit: before any case runs, the runner resolves every selected command once and prints an Oracle resolution table (command | binary | source: gnu-bin/host-allowlist/host/missing) into the report header; run_case consumes that table. Unresolvable commands still SKIP, now with a warning that distinguishes 'not allowlisted' from 'allowlisted but no host binary'.
  • find_timeout and absolute_command get the same treatment. Invocation interface unchanged (same flags/env); the baseline job's GNU_BIN=/usr/bin anchors every present command exactly where it anchored before, and the workflow comment is updated to describe the new semantics.

Local validation (Linux host; product build is Windows-only and untouched)

Synthetic oracle trees + host decoys + subject stubs, driven through the runner itself:

  • Full tree + decoy kill first in PATH: kill/echo/printf/test/cal all resolve gnu-bin from the tree, 5/5 PASS.
  • Partial tree (no kill/cal/ls): kill/cal resolve via allowlist with stderr warnings and table entries; ls (coreutils, not allowlisted) is missing → SKIP — the old runner silently graded it against the PATH decoy (OUT_DIFF, no warning, no record).
  • GNU_BIN unset: global + per-command host warnings; table records source host.
  • Real corpus, --only kill, GNU_BIN=/usr/bin: table shows kill → /usr/bin/kill (gnu-bin) — the distro identity is now on record in every report.
  • Full real corpus smoke (637 cases, no subject on this host): exit 0, all SKIP as before; audit covered all 111 corpus commands (101 anchored, 10 missing on this host — all allowlisted non-coreutils commands with no local binary).

Notes

…resolution (Refs #1478)

find_oracle fell back to a bare-name PATH lookup for any command the
GNU_BIN tree did not carry, so the host silently answered for it:
procps /usr/bin/kill graded the util-linux kill corpus, and in other
lookup forms a bash builtin token could stand in for a binary.

- With GNU_BIN set, a command now resolves only inside the tree.
- Host fallback survives only for commands named in the new
  oracle-host-allowlist.txt (what coreutils does not build:
  util-linux, diffutils, findutils, ...), and every use warns on
  stderr. Host lookup uses type -P, which can never return a builtin,
  function or alias token. GNU_BIN unset remains as an explicitly
  warned ungoverned host mode.
- Before any case runs, the runner resolves every selected command
  once and prints the table (command, binary, source) into the report
  header; run_case consumes that table, so the program answering a
  case is always the one on record. Unresolvable commands SKIP as
  before, now with a warning naming the reason.
- find_timeout and absolute_command get the same treatment; the
  workflow comment and tests README are updated to match.

CI invocation is unchanged; with the baseline job's GNU_BIN=/usr/bin
every present command anchors exactly where it anchored before.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 1, 2026 07:49
@caomengxuan666
caomengxuan666 merged commit 9c56eda into main Nov 1, 2026
5 of 7 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/runner-oracle-resolution-1478 branch November 2, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant