acceptance: Update testing guidance and backfill best practices#5630
Merged
Conversation
Document the conventions agents most often miss when writing acceptance tests, so the rules file is the single source of truth instead of relying on precedent in existing tests: - print_requests.py: document --unique/--oneline, and add a rule against hand-rolling a local print_requests() jq wrapper (the most common copy-pasted anti-pattern) or inline `jq select out.requests.txt`. - Built-in shell helpers: document trace/title/errcode/musterr (and the rest of acceptance/script.prepare) with rules to assert expected failures via musterr (not `! cmd`) and tolerated failures via errcode (not `|| true`). - Test server: prefer modeling behavior in libs/testserver/ over per-test [[Server]] response stubs, which only help one test and never converge on the real API contract. Also surface musterr/title in acceptance/README.md next to the existing errcode/trace helpers. Co-authored-by: Isaac
Replace hand-rolled `jq 'select(...)' out.requests.txt` request filtering with the print_requests.py helper across 23 existing tests, so the examples agents copy from match the rule added in the previous commit. Each local print_requests()/print_sorted_requests()/print_app_requests() wrapper (and a couple of inline jq pipelines) that reimplemented the helper now calls print_requests.py directly (--sort for the previously shell-sorted variants). The helper puts method/path first and deletes out.requests.txt itself, so the redundant `rm` lines are dropped. Behavior-preserving: the regenerated request output is identical except that method/path now lead each request ahead of the body; most output files are byte-identical. Left as jq: pipelines that filter on request body content or extract/delete specific body fields, which print_requests.py can't express (and which the rule explicitly permits). Co-authored-by: Isaac
errcode tolerates both success and failure, so a regression that makes a "this must fail" command start succeeding slips through. musterr fails the test on unexpected success, which is the correct assertion for these error-path tests. Convert standalone errcode to musterr across 35 tests whose command must fail (invalid args/flags, not-found, unknown subcommand, missing auth, client-side validation errors: select/missing, paths, multi_profile, duplicate keys, ...) — each confirmed by an `Exit code:` line in its output.txt. The regenerated output drops that line (musterr doesn't print it; the asserted error message stays). Left as errcode: piped `errcode ... | jq` (musterr's failure is swallowed by the pipe without pipefail), commands that may legitimately succeed (e.g. `secrets list-scopes`, the default_profile resolution paths, `--var a=one` in arg-repeat), engine-dependent failures (*-terraform-error, select/rejected), WAL/crash side-effect tests, and cloud-recording selftests where the failure is genuinely tolerated. Co-authored-by: Isaac
Collaborator
Integration test reportCommit: b3a25b7
21 interesting tests: 14 SKIP, 7 KNOWN
Top 24 slowest tests (at least 2 minutes):
|
The bundle is named deploy-postgres-recreate, so its state-file paths
(.bundle/deploy-postgres-recreate/.../state/*.json) contain the substring
"postgres". The backfill converted the request filter to
print_requests.py //postgres, but on Windows Git-Bash/MSYS strips the
leading slash the helper relies on, degrading the filter to a bare
"postgres" that also matches those workspace-files writes. The direct
variant then diverged from the committed golden (which was generated on
macOS, where the filter stays /postgres). Only this test collides because
its bundle name contains the filter keyword.
Revert this wrapper to jq: contains("/postgres") matches only the API
paths and, being inside the jq program rather than an argv path, isn't
subject to MSYS mangling. Consistent with the sibling
postgres_branches/recreate and postgres_endpoints/recreate tests. The
recorded output reverts to its pre-backfill form.
Co-authored-by: Isaac
pietern
approved these changes
Jun 17, 2026
Collaborator
Integration test reportCommit: 5b28658
425 interesting tests: 341 MISS, 38 FAIL, 24 RECOVERED, 13 flaky, 4 KNOWN, 3 PANIC, 2 SKIP
Top 50 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Why
Unify practices across doc & lead by example
Tests
CI