Skip to content

test: run the contract suite on nextest, counted from its JUnit report (test-suites PR 1) - #243

Merged
aRustyDev merged 4 commits into
mainfrom
test/contract-suite-nextest
Nov 16, 2026
Merged

aRustyDev merged 4 commits into
mainfrom
test/contract-suite-nextest

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

PR 1 of the test-suites plan (.agents/plans/test-suites/): the contract suite runs on nextest. It was the last Rust suite on cargo test whose scripts parse libtest's text. The Postgres and SMTP adapter suites follow in PR 2.

What

  • Every pass is one call. Each arm of scripts/contract.sh (11) and scripts/stage2-contract.sh (13) is now suite_pass <bin> '<filterset>' [nextest args], which runs cargo nextest run -p thrust-contract-tests --profile contract -E 'binary(<bin>) & (<filterset>)'. Flags map directly: --test-threads=1 --nocapture becomes --no-capture. The mail pass ran in parallel with --nocapture, so it stays parallel and prints each test's output as it finishes.
  • .config/nextest.toml gets a contract profile: JUnit on, no fail-fast, and no kill. Its own override outranks the default profile's prop|model timeout, which would otherwise kill a model test after 5 minutes. The profile also gets a mock-idp test group of one thread for the compat_oidc_* tests.
  • The count guard (ADR-0121) reads the passed count from nextest's JUnit report, which the scripts keep beside the pass's log as <log>.junit.xml, not from libtest's test result: line.
    • A test failure exits with nextest's 100, passed through.
    • nextest's 4 ("no test ran") becomes 5, because contract.sh's 4 already means the target never came up.
  • scripts/check-contract-counts.sh lists each arm's filterset with cargo nextest list --message-format oneline and counts the lines. Its records are tab-separated, because a filterset holds |. Its self-test is rewritten for the new arm shape and has two new cases: an arm whose filterset is not single-quoted.
  • scripts/mutants.sh: a row run through contract.sh is killed when nextest exits 100 and the row's JUnit report counts a failure. A build that failed (101) is no longer a kill. The adapter rows (pg_adapter, smtp_*, the Cloudflare email tests) keep the cargo test check until PR 2 moves them.
  • Docs: AGENTS.md, the testing chapter (rules, running, evidence and controls, the contract-suite page), the standards table, and the rust-test-logic skill's nextest reference.

Why the OIDC tests need a group

Under nextest each test is a process of its own. The suite's mock identity provider (src/mock_idp.rs) is a per-process OnceLock bound to the one fixed port the target was given as its issuer. Each compat_oidc_* test therefore starts its own provider on that port, and two running at once collide. A key per process is safe: thrust-adapters-oidc fetches the discovery document and the key set on every call, and each flow runs inside one test.

Evidence

Every check below has a control that makes it fail (AGENTS.md rule 8).

Check Result Control
each arm's nextest selection against its old libtest selection, name for name the same for all 24 arms (main 71, stage2 main 65, …) main's filterset with csrf_off_ dropped selects 77 tests, where libtest selects 71; stage2 bindings without version_metadata selects 4, where it selects 3
real passes through the new contract.sh native-memory: main 71, sweeper 3, csrfoff 6, panic 1, engine 4, mail 7. worker-memory: main 71, cron 1. worker-cf worker 1 (its HIBERNATION-OBSERVATION line still passes through). native-pg budget 1. Each equals its EXPECT
the count guard main's filterset narrowed by 3 tests: exit 5, "exit 0 but passed count != expected". A filterset that selects nothing: exit 5, "no test ran (nextest exit 4)"
the mock-idp group the three compat_oidc_* tests at -j 3, ten runs: 0 failed the same ten runs without the group: 4 failed, each on "port is free"
scripts/mutants.sh exit 0: 49 rows killed (the 43 of #221 and the 6 that #220 added), the 4 guards refused, none survived the new kill rule on real runs: a main run with no mutant (71 passed) reads SURVIVED. The ignore-tenant row (7 of 71 failed) reads KILLED and lists them. Exit 101 with no report reads SURVIVED
scripts/check-contract-counts.sh 24 arms ok, and its control (a wrong stage2 main count) refused; --self-test 18 cases it is the control
every step of CI's deps and ci-scripts jobs, shell scripts under dash 46 of 46 exit 0

main merged in. It moved 7 commits, among them #224 (the port fix, which also edits contract.sh), and the merge was clean. On the merged tree the counts guard passed, and native-memory main and mail passed (71, 7).

worker-memory worker is not a cell, and this PR does not change that. It fails at the WebSocket connect (worker_only.rs:57) on main's own cargo test script, at the same line. contract-all.sh runs worker on worker-cf only, where it passes.

Found by CI on the first push. contract (worker-memory, sweeper) failed with nextest exit=101 60 ms after its target came up. cargo-nextest was installed only in the hermetic job, so in a contract cell cargo nextest was not a command. The local runs could not show this, because nextest is installed here. The fix (third commit): setup-rust gains a nextest input and nextest-version, which is now the one pin (0.9.140). It installs nextest with the same pinned taiki-e/install-action the hermetic job used, and is on for hermetic (whose own install step is gone), mutants, contract-cell.yml and flake-hunt.yml. That covers every job that runs scripts/contract.sh. The workflow lint and all 46 deps/ci-scripts steps pass with it.

.config/ and scripts/contract.sh changed, so CI runs everything.

🤖 Generated with Claude Code

aRustyDev and others added 4 commits November 16, 2026 17:22
…from its JUnit report

PR 1 of the test-suites plan. Every pass of scripts/contract.sh (11) and
scripts/stage2-contract.sh (13) is now one call,
`suite_pass <bin> '<filterset>' [nextest args]`, which runs
`cargo nextest run -p thrust-contract-tests --profile contract
-E 'binary(<bin>) & (<filterset>)'`. The filtersets select exactly what
the libtest filters did, name for name, for all 24 arms.

- .config/nextest.toml: a `contract` profile (JUnit on, no fail-fast, no
  kill: its own override outranks the default profile's prop|model
  timeout) and a `mock-idp` test group of one thread for the
  compat_oidc_ tests. Under nextest each test is a process, and each of
  those starts the mock identity provider on the one fixed port the
  target was given.
- The count guard (ADR-0121) reads the passed count from nextest's JUnit
  report, which the scripts keep beside the pass's log
  (`<log>.junit.xml`), not from libtest's `test result:` line. nextest's
  exit 4 ("no test ran") becomes 5, because contract.sh's 4 already means
  the target never came up. A test failure is nextest's 100, passed
  through.
- --test-threads=1 --nocapture becomes --no-capture (serial, output
  passed through). The `mail` pass, which ran in parallel with
  --nocapture, stays parallel and prints each test's output as it
  finishes.
- scripts/check-contract-counts.sh lists each arm's filterset with
  `cargo nextest list --message-format oneline` and counts the lines. Its
  records are tab-separated, because a filterset holds `|`. The self-test
  is rewritten for the new arm shape, and adds two cases: an arm whose
  filterset is not single-quoted.
- scripts/mutants.sh: a contract-suite row is killed when nextest exits
  100 and the row's JUnit report counts a failure. A build that failed
  (101) is no longer a kill. The adapter rows (pg_adapter, smtp_*, the
  Cloudflare email tests) keep the cargo test check until PR 2 moves them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- AGENTS.md: the contract suite runs on nextest with the `contract`
  profile; only the Postgres and SMTP adapter suites stay on cargo test,
  until PR 2 of the test-suites plan.
- docs/src/testing: rules.md, running.md (the exit codes; what a pass
  runs), evidence-and-controls.md (the count guard and
  check-contract-counts.sh read nextest), techniques/contract-suite.md
  (an arm is a filterset; the OIDC test group).
- docs/src/contributing/standards.md: what a kill needs, per kind of row.
- The rust-test-logic skill's nextest reference: this repository's suite
  has been migrated, and how.
- The plan: stage2-contract.sh has 13 passes (it said 14), and PR 1's
  status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first CI run of this branch failed `contract (worker-memory, sweeper)`
with `nextest exit=101` 60 ms after the target came up: cargo-nextest was
installed only in the `hermetic` job, so `cargo nextest` was no such
command in a contract cell. Locally nextest is installed, so the local
runs could not show it; CI did, and failed closed.

setup-rust gains a `nextest` input (and `nextest-version`, 0.9.140, the
one pin), installing it with the same pinned taiki-e/install-action the
hermetic job used. It is on for `hermetic` (whose own install step goes),
`mutants`, the contract cells (contract-cell.yml, which the e2e schedule
also calls) and flake-hunt.yml: every job that runs scripts/contract.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit a5a11ff into main Nov 16, 2026
38 checks passed
@aRustyDev
aRustyDev deleted the test/contract-suite-nextest branch November 16, 2026 22:53
aRustyDev added a commit that referenced this pull request Nov 16, 2026
main moved by five commits while CI ran on this branch, among them the contract suite on
nextest (#243), which edits plan-ci.py, test_plan_ci.py, ci.yml and cicd.md as this branch
does. The merge is textually clean; it was tested before it was committed, because a clean
merge of two CI changes is not evidence that they agree:

- test_plan_ci.py: 6,761 checks pass
- test-ci-scripts.sh under dash: 173 cases pass
- mutate_gate.py: 53 of 53 mutants killed, none broken (so every text a mutant replaces is
  still found exactly once in the merged files), and both equivalent mutants survive
- lint-all-workflows.sh exits 0 on the merged ci.yml

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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