Skip to content

xtask: repair 7 stale wasm-fixture tests and gate cargo test -p xtask#836

Open
brandonpayton wants to merge 2 commits into
mainfrom
gascity/kd-u7f/kd-872c-fix-7-stale-xtask-test-fixtures-assertions-and-gate-carg
Open

xtask: repair 7 stale wasm-fixture tests and gate cargo test -p xtask#836
brandonpayton wants to merge 2 commits into
mainfrom
gascity/kd-u7f/kd-872c-fix-7-stale-xtask-test-fixtures-assertions-and-gate-carg

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Why

cargo test -p xtask has been red with 7 failing unit tests since PR #605
(3430c5bbc, "Fix browser demos and artifact validation") added program
output/cache artifact validation — and, for one test, since ABI_VERSION moved
past 4. These are stale test defects, not product regressions: the fixtures
emit artifacts the (correct) validation rejects. They went unnoticed because
xtask's ~298 unit tests were entirely un-gated in CIci-run-test-suite.sh
and prepare-merge.yml build and run xtask but never run its own tests.

This blocks the validation-gates work (internal kd-u7f): a pre-merge gate that
runs xtask tests can't be enabled while these 7 are red.

Implements the triage design in
docs/plans/2026-07-02-xtask-stale-wasm-fixture-test-failures-triage.md
(internal kd-xc19 → kd-872c).

What

Repair the 7 stale tests (test-only; production validation unchanged):

  • Class A (5 cmd_resolve_* tests): build scripts touched an empty
    .wasm, rejected as "is not a wasm binary". They now emit a valid minimal
    module via new emit_wasm_build_script + minimal_executable_wasm test
    helpers. The kernel output emits the full HOST_ADAPTER_REQUIRED_KERNEL_EXPORTS
    set built from the shared const, so it self-updates if that set changes.
  • Class B (binaries_dir_program_fetch_does_not_require_built_deps): the
    fetched-archive fixture was a wasm header only (no exports), so cache
    validation forced a source-build fallback (a dep that exit 42s → panic). Now
    uses valid wasm, so the remote-first path the test means to prove is actually
    exercised.
  • Class C (cli_produces_archive_with_canonical_filename): assertion
    hardcoded abi4 while the canonical filename correctly encodes the real ABI.
    Now version-relative via shared::ABI_VERSION, doubling as a guard that the
    filename encodes ABI_VERSION. (Its sibling ..._uses_build_toml_revision
    stays abi-pinned on purpose — it passes --abi "4" to test the revision
    field.)

Lock the class shut: a new negative test
wasm_artifact_policy_rejects_empty_and_exportless_when_exports_required asserts
empty/non-wasm → "is not a wasm binary" and export-less wasm → "missing
required exports"
stay rejected, so the tests can't be "fixed" later by
weakening validation.

Close the gate gap: add a cargo-xtask suite to
scripts/ci-run-test-suite.sh and wire it into the prepare-merge,
staging-build, and force-rebuild suite matrices (not kernel-gated; ~16s, no
toolchain/workspace). Documented in docs/agent-guidance/validation.md and
docs/repository-organization.md.

Validation

cargo test -p xtask --target aarch64-apple-darwin: 290 passed / 7 failed →
298 passed / 0 failed
(the 7 repaired + 1 new negative test). Confirmed green
at both the convoy base (ABI 15) and rebased on main (ABI 16). Verified the CI
path end-to-end via ci-run-test-suite.sh cargo-xtask, and check-abi-version.sh
reports the ABI snapshot unchanged. Not run (change touches none of these
surfaces): vitest, libc, POSIX, browser, kernel suites.

Follow-up (design open question): consider broadening the gate to
cargo test --workspace after auditing other un-gated workspace crates
(e.g. tools/mkrootfs).

🤖 Generated with Claude Code

brandonpayton and others added 2 commits July 2, 2026 09:35
Seven xtask unit tests have failed since PR #605 (`3430c5bbc`) added program
output/cache artifact validation (and, for one, since ABI_VERSION moved past 4).
They are stale *test* defects, not product regressions: the fixtures emit
artifacts the (correct) validation rejects.

- Class A (5 cmd_resolve_* tests): build scripts `touch`ed an empty `.wasm`,
  rejected as "is not a wasm binary". They now emit a valid minimal module via
  new `emit_wasm_build_script` + `minimal_executable_wasm` helpers; the kernel
  output emits the full `HOST_ADAPTER_REQUIRED_KERNEL_EXPORTS` set from the
  shared const so it self-updates.
- Class B (binaries_dir_program_fetch_does_not_require_built_deps): the fetched
  archive fixture was a wasm header only (no exports), so cache validation forced
  a source-build fallback (baddep `exit 42` -> panic). Now uses valid wasm, so
  the remote-first path it means to prove is actually exercised.
- Class C (cli_produces_archive_with_canonical_filename): assertion hardcoded
  `abi4`; the canonical filename correctly encodes the real ABI. Now
  version-relative via `shared::ABI_VERSION`, doubling as a guard that the
  filename encodes ABI_VERSION.

Production validation is unchanged. A new negative test
(`wasm_artifact_policy_rejects_empty_and_exportless_when_exports_required`)
locks in that empty/non-wasm -> "is not a wasm binary" and export-less wasm ->
"missing required exports" stay rejected, so the class cannot be "fixed" by
weakening validation.

xtask's ~298 unit tests were entirely un-gated in CI, which is how these rotted.
Adds a `cargo-xtask` suite to `scripts/ci-run-test-suite.sh` and wires it into
the prepare-merge, staging-build, and force-rebuild suite matrices (not
kernel-gated; ~16s, no toolchain/workspace). Documents the suite in
`docs/agent-guidance/validation.md` and `docs/repository-organization.md`.

cargo test -p xtask: 290 passed / 7 failed -> 298 passed / 0 failed.

Implements kd-xc19 triage design
(docs/plans/2026-07-02-xtask-stale-wasm-fixture-test-failures-triage.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Durable evidence for the stale-fixture repair: before 290 passed / 7 failed,
after 298 passed / 0 failed on the convoy base (ABI 15), and 315 / 0 rebased on
origin/main (ABI 16). Includes per-run passed/failed/skipped outcome lists (the
skipped lists are empty by construction — the xtask suite declares no #[ignore]
tests) and the serial repro logs. Mirrors the kd-xc19 triage artifact layout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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