full-test-battery
Skill329 starsChanged 7 days agoMIT-0View on GitHub
Use when validating a branch or merge with the full test battery (every suite plus lint and typecheck), including the baseline of known pre-existing failures.
- Installs packages
In this repository42 other files it gives its agents.
- .claude/rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-modelSkill
- agent-capability-reviewSkill
- api-rbac-testSkill
- backend-lambdaSkill
- code-reviewSkill
- create-hf-dataset-prSkill
- curate-security-resultsSkill
- cut-release-changelogSkill
- dependabot-prsSkill
- documentationSkill
- extraction-pipelineSkill
- fix-single-issueSkill
- frontend-uiSkill
- infrastructureSkill
- live-auth-checksSkill
- live-eval-and-costSkill
- prepare-changelogSkill
- prep-develop-for-releaseSkill
- product-demoSkill
- pr-review-ciSkill
- pr-reviewSkill
- releaseSkill
- release-validationSkill
- remove-classification-flat-keysSkill
- repo-quality-reviewSkill
- run-benchmarksSkill
- run-stack-testsSkill
- srt-security-scanSkill
- sync-pii-anonymizerSkill
- testing-qaSkill
- test-upgradeSkill
- transform-deploy-testSkill
- ui-i18nSkill
- update-solution-profileSkill
- ux-test-ciSkill
- ux-testSkill
- ux-test-stories-ciSkill
- ux-test-storiesSkill
- work-the-backlog-hazardsSkill
- work-the-backlogSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when asked to "run the full battery of tests", validate a branch before/after a merge, or gate a release.
- Very specific: line 62
Before a merge, make premerge runs exactly the gates both CIs run — the SHARED_GATES list in scripts/tests/test_ci_gate_parity.py, read by …
- Very specific: line 75
Run from repo root with the venv active.
- Very specific: line 94
Check also that git ls-files '*.py' | wc -l equals the filesAnalyzed the run prints — the gate reads every tracked .py file and that …
- Very specific: line 223
Through
make, the pin is applied for you: Every pytest invocation in both Makefiles goes through PYTEST_HERMETIC (make/hermetic_aws.mk), … - Distinctive: line 319
If you do find a genuine standing failure, add it to the table above with the date and the verified cause, bump the count in that heading, …
- Very specific: line 352
If it fails on pristine develop with a correct install → pre-existing, not yours.
- Very specific: line 372
Use AWS_PROFILE=default for all AWS calls (see .claude/skills/live-eval-and-cost/SKILL.md and the deploy-target memory).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Full Test Battery — GenAI IDP Accelerator
Use this skill when asked to "run the full battery of tests", validate a branch
before/after a merge, or gate a release. It runs every unit suite make test
covers, plus lint/typecheck, and — critically — tells you how to separate a real
regression from an environment problem, which is what nearly every surprising
failure in this repo turns out to be.
This is a read-only verification skill. It does not deploy or commit. For the deploy step (publish + CloudFormation update) see
.claude/skills/infrastructure/SKILL.mdand the "Deploy" note at the bottom.
Environment setup (do this first — three gotchas)
- Install the pinned test extras BEFORE you believe any failure. This is the
single biggest source of wasted time on this repo:
A venv that predates the currentcd lib/idp_common_pkg && pip install -e ".[test]" # what CI's test-unit-cicd does make install-first-party # from repo root, for the sibling packages[test]extra produces ~45 failures and ~17 collection errors that look exactly like environment-only "known" failures — stalestickler-eval(No module named 'stickler.doc_split',ImportError: cannot import name 'aggregate_from_comparisons'), plus missingz3,xlrd,sklearnandaws_xray_sdk. They are not repo defects and there is nothing to fix in the tests. Check before diagnosing anything:python -c "import importlib.metadata as m; print(m.version('stickler-eval'))" # must match the pin in pyproject [test] python -c "import z3, xlrd, sklearn, aws_xray_sdk; print('deps ok')"idp_cli's suite additionally errors withNo module named 'idp_sdk'untilmake install-first-partyhas run. - Activate the repo venv — it has all deps (pdfium, PIL, boto3, strands, …):
Baresource <checkout>/.venv/bin/activate # e.g. lib/idp_common_pkg/.venvpython3may import a STALEidp_commonfrom another checkout (this repo is commonly cloned side by side asidp1/idp2/idp3). When runningidp_commontests directly, force the path:
Both CIs runexport PYTHONPATH=<checkout>/lib/idp_common_pkgpython:3.13-bookworm(.gitlab-ci.ymlimage:, and the job container in.github/workflows/developer-tests.ymlandsecurity-checks.yml) — there is no 3.12/3.13 skew between them. A suite run under a system 3.12 is therefore not what CI measures, and "it passes in CI because CI is on a different Python" is a claim to check against those three files, not to assume. publish.pymust run in a CLEAN env — the venv onPATHbreaks SAM's OpenSSL (OPENSSL_3.4.0 not found/_sha2). Build with:env -i HOME=$HOME PATH=/usr/local/bin:/usr/bin:/bin AWS_PROFILE=default bash -lc \ 'python3 publish.py <bucket-basename> idp us-west-2 --clean-build'
The CI gate set in one command: make premerge
Before a merge, make premerge runs exactly the gates both CIs run — the
SHARED_GATES list in scripts/tests/test_ci_gate_parity.py, read by
scripts/premerge.py rather than copied — and reports every failure at the end
rather than stopping at the first. It includes what a hand-picked run tends to miss:
make srt-scan, make test-packages-cicd (which holds benchmarks/tests), the
coverage reports and their ratchet, dep_audit.py and make terraform-check. It
needs network access and Node, and it checks this working tree rather than the merge
result, so merge the base in first. make premerge PREMERGE_ARGS=--list prints the
plan without running it (#2115). The per-suite commands below are for isolating a
failure.
The battery (mirrors Makefile test: + lint/typecheck)
Run from repo root with the venv active. make test runs it all in one go; the
per-suite commands below are for when you want isolated pass/fail (and to apply the
-p no:cacheprovider flag that avoids stale cache noise):
make test # everything below, canonical
make lint # ruff-lint + format + ARN check + buildspec + UI lint + codegen
make typecheck # basedpyrightmake typecheck fails with make: basedpyright: No such file or directory if the
tool is absent — it is not in the [test] extra. make setup-node installs it with
npm install -g basedpyright, the command both CIs run.
Errors are the gate, and develop is at zero, so any error is yours. That is the
durable half and it needs no comparison: a single error is a regression. The eleven
errors this page once told you to expect were resolvable-import failures, fixed when
pyrightconfig.json gained extraPaths
(#1109).
Check also that git ls-files '*.py' | wc -l equals the filesAnalyzed the run
prints — the gate reads every tracked .py file and that identity is the property to
rely on, rather than any figure for how many there are.
⚠️ The warning total is a standing set, and it is not stable enough to quote here.
It has been measured at both 42 and 43 on different machines in the same week, and
nothing in the tree pins it — the set is reportUnsupportedDunderAll on several
__init__.py re-export lists plus a duplicate import, and which file a diagnostic
lands in shifts with the installed dependency set (z3-solver moves two of them
between rule_validation/z3/__init__.py and the validator itself). So a number
written here tells you less than a measurement, and it goes stale the way the error
count did. Measure develop on the machine you are judging from:
git worktree add -q /tmp/dev-typecheck github/develop && cd /tmp/dev-typecheck
make typecheck 2>&1 | tail -1 # the "N errors, M warnings, K notes" line
cd - && git worktree remove /tmp/dev-typecheck --forceThen compare totals against that, not against a literal, and check that no diagnostic names a file your change touched.
Per-suite (isolated) — PP=<checkout>/lib/idp_common_pkg:
Counts are the 2026-09-11 baseline unless a row says otherwise. Two exceptions,
both re-measured later: the three pii-anonymizer rows at 28d2fc33e (2026-09-18),
and the two chat rows at 2026-09-19.
| Suite | Command | Expected (all green) |
| idp_common unit | cd lib/idp_common_pkg && PYTHONPATH=$PP pytest tests/unit -q -p no:cacheprovider | 5682 pass, 13 skip, 0 fail (~2.5 min) |
| idp_cli | cd lib/idp_cli_pkg && pytest -q | 177 pass |
| idp_sdk | cd lib/idp_sdk && pytest -m "not integration" -q | 471 pass (~2.5 min) |
| idp_feature_sdk | cd lib/idp_feature_sdk && pytest -q | 140 pass (slow, ~75s) |
| feature platform | cd feature-platform/main-stack-extensions && pytest -q | 207 pass |
| pii-anonymizer feature API | cd feature-platform/pii-anonymizer/feature-api && pytest tests -q | 14 pass |
| pii-anonymizer hook | cd feature-platform/pii-anonymizer/hook && pytest tests -q | 17 pass |
| pii-anonymizer UI deployer | cd feature-platform/pii-anonymizer/ui-deployer && pytest tests -q | 10 pass |
| config library | pytest config_library/test_config_library.py -q | 114 pass |
| pipeline-hooks | cd lib/idp_common_pkg && pytest tests/unit/lambdas/test_pipeline_hooks_dispatcher.py -q | 6 pass |
| capacity Lambda | cd src/lambda/calculate_capacity && pytest -q | 33 pass |
| chat-with-document | cd src/lambda/chat_with_document_processor && pytest tests -q | 42 pass |
| chat-stream | cd src/lambda/chat_stream_processor && pytest tests -q | 32 pass |
Reading a gate result, and not running the same suite twice
Two ways to mistake one measurement for another. They are together because they are the same error in opposite directions: the first reads a non-result as a pass, the second reads one result as two.
⚠️ A gate result is a count of passed tests plus zero failures. It is not an exit
status. The long suites — idp_common unit, idp_sdk, scripts/tests,
test-packages-cicd — outrun the assistant's 120-second Bash timeout and have to be
wrapped: timeout N ... > log 2>&1 in the background, then the log is read. Several
rows in the table above finish in under four seconds and need none of that.
Which wrapper you use decides whether the status means anything. Measured:
| form | exit code when the command is killed |
timeout 1 sleep 5 | 124 |
timeout 1 sleep 5 > log 2>&1 | 124 |
timeout 1 sleep 5 2>&1 | tail -1 | 0 |
set -o pipefail; timeout 1 sleep 5 2>&1 | tail -1 | 124 |
So timeout reports a kill reliably, and in the redirect-only form 124 is a usable
signal — check it. The misleading 0 comes from the pipeline, which returns the
last command's status, so a trailing | tail throws the kill away — unless
pipefail is set, which restores it. Prefer redirecting to a log and reading the
file; if you must pipe, set pipefail in the same command, and remember that without
it the status tells you nothing and only the summary line does.
Either way the log of a killed run looks exactly like a completed one — a column of
dots, no failure section, nothing obviously wrong. Measured: pytest scripts/tests/
killed by a 280-second timeout at 24% of the way through, read through a pipe,
reported as exit 0.
The check that actually distinguishes them is the summary line:
3165 passed, 47 skipped in 505.86s # a result
........................ [ 24%] # not a result, whatever the shell saidSo: read the totals, and treat a run that printed no summary line as not having run.
Budget for the range rather than one sample: scripts/tests/ has been measured
between 5.8 and 11.6 minutes on this machine (347 s on a quiet one, 696 s loaded),
and test-packages-cicd at about 5 on 4 CPUs (305 s on 2026-11-12, since it stopped
running the suites a coverage tree measures). A 600-second timeout is therefore too small for
either whenever anything else is running, which on a shared machine is most of the
time.
make test-packages-cicd does not run scripts/tests/, nor idp_sdk, idp_cli,
idp_feature_sdk, main-stack-extensions, the seller service or the pii-anonymizer
hook and feature API. In CI those run once, under coverage, in make coverage-all-cicd,
and the recipe leaves them out so they are not run twice. Locally, run them through
python3 scripts/coverage_all.py --only <tree> for the gate signal with coverage, or
pytest scripts/tests/ -q --tb=no -rf for a readable failure list. Do not run the two concurrently over one worktree either: two
pytest processes sharing a rootdir contend on its cache, which produces failures
belonging to neither run. (-p no:cacheprovider removes that particular contention;
the duplication argument stands regardless.)
Two invocation corrections for the CI-equivalent gates:
make lint-cicdexercises the UI lint andnpm run typecheckunconditionally, because it passesUI_LINT_NO_SKIP=1; you do not needFORCE=1for it. Baremake ui-lint,make lintandmake fastlintstill take thesrc/uichecksum cache, and a cache hit there prints⏭️ UI lint SKIPPEDnaming the two tools that did not run rather than a green tick — so if you are reading one of those logs for a gate signal, check which line you got, or useFORCE=1. CI never hits the cache at all:.checksumis gitignored, so a fresh checkout has none. See #1152.Do not reach for
PYTHONPATHto makemake typecheckresolve first-party imports, and do not conclude from that that the tool ignores the environment.pyrightconfig.json'sextraPathsnames every first-party root, so resolution is a property of the configuration rather than of the invocation. Measured on the current tree the two agree exactly — same error count, same warning count, same exit status — both withPYTHONPATHexported and underenv -u PYTHONPATH. The point is the equality, so no figure is quoted here: per the warning-total note above, the absolute number is not stable across machines and would go stale, while the equivalence is what this bullet is about.⚠️ That equivalence is a consequence of
extraPathsbeing populated, not a property ofbasedpyright, which does honourPYTHONPATH. Before those entries existed the gate resolved nothing first-party and so could not produce a diagnostic for any call into the shared library, while reporting zero errors over every file (#1109). So what matters is thatextraPathsstays populated, whichscripts/tests/test_pyright_config.pyasserts — not which way you invoke the gate.
Through make, the pin is applied for you. Every pytest invocation in both
Makefiles goes through PYTEST_HERMETIC (make/hermetic_aws.mk), which exports an
absolute PYTHONPATH naming every first-party root of the checkout that makefile
belongs to, and scripts/run_all_tests.py hands the same value to each subprocess
make test starts. So make test, make test-packages-cicd, make test-hooks and
make test-cicd -C lib/idp_common_pkg measure the tree you ran them from, in a
worktree as much as in the main checkout. make <target> FIRST_PARTY_PYTHONPATH=
suppresses the pin, for deliberately testing an installed copy.
⚠️ Running pytest by hand, PYTHONPATH has to name EVERY first-party root and be
absolute. The provenance guard (scripts/tests/first_party_provenance.py, wired into
several conftests) checks each first-party package independently, so a pin naming only
lib/idp_common_pkg gets as far as idp_sdk resolves OUTSIDE the checkout under test;
a relative pin is dropped by any subprocess that changes directory. The guard repairs
what it can — it puts the checkout's own roots first on sys.path and says it did, so
a bare pytest scripts/tests now runs against the right tree and warns that the
environment still points elsewhere. What it cannot repair it refuses, and a refusal
is not a failure, it is a run that did not happen: the message opens with REFUSED:
and names the pin that works.
W=$(pwd) # from the worktree root
export PYTHONPATH=$W/lib/idp_common_pkg:$W/lib/idp_sdk:$W/lib/idp_cli_pkg:$W/lib/idp_mcp_connector_pkg:$W/lib/idp_feature_sdkThat list is the same set as FIRST_PARTY_EDITABLES in the Makefile, and both are
now derived from lib/*/pyproject.toml rather than typed —
scripts/tests/test_first_party_pythonpath.py fails if they disagree.
scripts/check_first_party_deps.py tells you whether the environment itself is
pointing at this checkout (make install-first-party runs it, and so do both CIs).
It reports an editable pointer into another checkout as a failure, naming both trees.
That is the fastest way to find out that this machine's shared interpreter has been
repointed by another session.
There is no standing failure set — green means green
Expected standing failures: 0. A correctly installed tree passes every suite
above with zero failures (verified on develop at 3101aeeb, 2026-09-11; the three
pii-anonymizer rows added and re-verified at 28d2fc33e, 2026-09-18). So treat
any failure as a real regression until you have proved otherwise.
The accepted-failure list is the table below, and it is empty. Keep the count in the
heading and the table in step — scripts/tests/test_standing_failure_baseline.py
fails if they disagree, and also fails if docs/testing.md or
release-validation.md still claim zero while this table is non-empty. That gate
exists because those three documents claimed zero for weeks while
pii-anonymizer/feature-api/tests/test_handler.py::test_report_list_and_aggregate
failed on any machine with an assume-role AWS_PROFILE (#974).
make test compares this table against what it observed, in both directions,
and fails the run on either asymmetry: a failure the table does not declare (a
regression, as before), or a declared row whose test passed (a waiver that has
outlived its cause — delete the row and lower the count). So the table is
load-bearing rather than advisory: while it is empty, any failure is red; a row in
it makes exactly that node id acceptable and nothing else. Two consequences worth
knowing before you write a row:
- Write the Test cell as a pytest node id —
path/to/test_x.py::test_name, repo-relative, backticks optional. That is the form a run reports, so it is the only form the comparison can key on, and a row written as prose fails the gate rather than being silently ignored. - A run that produces no JUnit entry at all cannot be declared away, and is reported separately: a crash, an internal pytest error, or a failure before anything was collected. Note where that boundary actually falls — a module that fails to import does get an entry, under a synthetic name derived from the module, so that failure is declarable like any other and a row naming that id makes the run green. The undeclarable case is only the one where nothing was collected.
Each root's results are written as JUnit XML under test-reports/, with a
test-reports/run_all_tests.json summary naming the observed, declared,
unexpected and resolved sets. Those are for reading; the verdict is decided in the
run that produced them, so there is no stale-results path through the check.
<!-- STANDING-FAILURES-BEGIN -->| Suite | Test | Expected failure mode | Verified cause | Date |
<!-- STANDING-FAILURES-END -->Keep that table empty unless a failure is verified. A stale allow-list is worse than none: it invites you to wave through a genuine regression that happens to land in a file it names. Two things to check before you add a row:
- Most apparent standing failures are an environment artifact, not a repo state
— the symptom of a venv missing the pinned
[test]extras (see gotcha 1). Reach forpip install -e ".[test]"before you reach for this section. - Order-dependent pollution is a real phenomenon. If a test fails in the full
run, re-run the file alone (
pytest <file> -q) before concluding anything — but note that re-running the file alone is not sufficient to rule order out.test_report_list_and_aggregate(#974) reproduced perfectly with the file run alone, because what mattered was that it was the first DynamoDB test in the file to run: moto resets its backends when eachmock_awsstarts, so only the first one saw the polluted state. Deselect the failing test and watch whether the failure moves to its neighbour; if it does, the fault is ordinal, not in the test.
If you do find a genuine standing failure, add it to the table above with the date and the verified cause, bump the count in that heading, and delete the row the moment it stops reproducing.
How to verify a suspected regression is real (not inherited)
Order matters — check the cheap explanation first:
- Read the error.
ModuleNotFoundError/ImportErroron a third-party name (stickler.*,z3,xlrd,sklearn,aws_xray_sdk,idp_sdk) is an install problem, not a regression. Fix the environment (gotcha 1) and re-run. ⚠️ A broken install does not always produce an import error. Several Lambdas catch a missingidp_commondeliberately and degrade — the config-preset handler logsidp_common is unavailable (...)at ERROR and skips the revision write — so the test fails on a plain assertion with no hint of the cause. Before anything else, confirmpython3 -c "import idp_common; print(idp_common.__file__)"resolves inside your own checkout; an editable install here has been observed pointing at another agent's deleted/tmpcheckout, which fails every suite that needs it while looking like a logic bug. Note this is not an interpreter-version effect, however much it looks like one when two interpreters on the same machine disagree:test_apply_feature_config_preset.pygives2 failed, 18 passedwheneveridp_commonis unimportable and20 passedwhenever it is, identically under 3.12 and 3.13. What differs between interpreters is which editable install each one carries, not the language. - Re-run the file alone to rule out order-dependent pollution.
- Only then compare against pristine
develop:
If it fails on pristine develop with a correct install → pre-existing, not yours. (Notegit worktree add -q /tmp/dev-check github/develop cd /tmp/dev-check/lib/idp_common_pkg pip install -e ".[test]" # the worktree needs the deps too, or you prove nothing PYTHONPATH=/tmp/dev-check/lib/idp_common_pkg pytest <the failing test> -q -p no:cacheprovider cd - && git worktree remove /tmp/dev-check --force/tmpworktrees may belong to a sibling checkout — verify the git dir before running git commands there.)
Reporting
State totals per suite, then explicitly: "0 failures across N suites" — or name each
failure with its error and which of the three checks above you applied. Two things
never to do: report a raw failure count without saying whether the environment was
correctly installed (a stale venv reads as a broken repo), and describe a failure as
"pre-existing" without having reproduced it on develop with the test extras
installed.
Deploy (separate step, when asked to update the stack)
Active test stack: IDPUpgradeTest2, region us-west-2, publish bucket
basename idp-accelerator-artifacts-<ACCOUNT_ID>. Resolve <ACCOUNT_ID> at run
time — AWS_PROFILE=default aws sts get-caller-identity --query Account --output
text — rather than carrying it in this file; the expected account is recorded in
the idpagentic-deploy-target memory.
Use AWS_PROFILE=default for all AWS calls (see .claude/skills/live-eval-and-cost/SKILL.md
and the deploy-target memory). Build (clean env, above) → aws cloudformation
update-stack with --parameters UsePreviousValue → wait. Container-image Lambda
updates rebuild via CodeBuild, so a stack update commonly runs ~15-20 min; the
CLI wait may hit its 590s ceiling — re-issue it. PATTERNSTACK reaching
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS means the function code is already live.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

