Apply Bats-specific judgment only when the task materially depends on the Bats
harness. Establish the repository’s Bats and Bash versions before relying on a
runner feature. Use the highest justified Green — routine,
Yellow — caution, Orange — warning, or Red — crisis / stop response for
the current coherent decision.
Own Bats evaluation, run, assertion state, hooks, skips, TAP and file
descriptor behavior, fixture scopes, parallel-test isolation, and harness
cleanup. Leave Bash quoting, expansion, pipelines, traps, and command
construction to bash-language-profile when those semantics are independently
material.
Do not use this profile for:
bash-language-profile;run, required status and output assertions,
hooks, suite setup, skips, version guards, TAP output, file descriptor 3,
temp scopes, parallelism, shared state, background children, teardown, and
rollback.implementing-with-test-discipline
primary; a test review can keep
reviewing-and-verifying-repository-work primary.These defaults apply mainly to maintained hand-written Bats tests. They are guidance, not automatic enforcement or architecture selection.
| Signal | Green — routine | Yellow — caution | Orange — warning | Red — crisis / stop |
|---|---|---|---|---|
| Test-file physical lines | <= 200 |
201–350 |
351–600 |
>= 601 |
| Test count | <= 12 |
13–24 |
25–40 |
>= 41 |
| Maximum test-body commands | <= 15 |
16–25 |
26–50 |
>= 51 |
| Maximum setup/teardown/bootstrap commands | <= 12 |
13–20 |
21–35 |
>= 36 |
| Maximum helper commands | <= 20 |
21–35 |
36–50 |
>= 51 |
| Shared fixture/global-state owners | 0–1 |
2–3 |
4–5 |
>= 6 |
| Maximum concurrent background child groups | 0 |
1, fully owned |
2–3, fully owned |
>= 4, or any unowned/leaking child |
| Independent responsibility families | 1 |
2 |
3 |
>= 4 |
Count physical records after universal-newline decoding, including comments,
blank lines, and a final unterminated segment. Count runner-recognized tests,
including native @test declarations and supported comment function forms.
Exclude incidental comments, strings, heredoc data, generated fixtures, and
static-extraction samples. Do not evaluate a Bats file merely to count tests
without authority to run that target code.
For each test, hook, or helper, count shell grammar commands or compound-command starts; continuations count once, while comments, blanks, delimiter-only lines, and heredoc payloads do not. Use the maximum individual body. Count mutable independently mutable state or resource owner domains visible to multiple tests or file/suite hooks, not scalar aliases or per-test values recreated under the per-test temporary directory. Count the maximum simultaneously alive child or service groups, not sequential external commands. Responsibilities are independently changeable behavior families.
Classify generated, vendored, fixture, snapshot, migration, compatibility, and data-driven tests before structural action. A repository-accepted coherent matrix may lower a line-count-only response by at most one level when no other Red signal applies and bounded growth is justified. It does not relax shared state, lifecycle, status, safety, privacy, or authority stops.
An existing Red legacy suite may receive the smallest safe fix when it adds no independent responsibility and avoids meaningful growth. A new responsibility or major feature remains Red pending decomposition or an accepted bounded exception.
run records command status in $status, combined output in $output, and
lines in $lines, while returning control to the test. Plain run requires
an explicit status assertion whenever status is material. An output-only
intent can be Yellow when explicit; ambiguity is Orange; a materially
required status that can false-pass is Red.run producer | consumer outside
the intended run boundary. Use the version-supported Bats pipeline helper
form when repository policy selects it, and assert the selected or expected
status explicitly. Bats owns run and helper capture semantics; the Bash
profile owns the underlying pipeline and command construction. Neither
set -e nor pipefail replaces an observable test assertion.setup and teardown, file hooks, and suite hooks have different
scopes. Shared file or suite state is at least Yellow, consequential external
state is Orange, and order-dependent state without accepted isolation is
Red. Cleanup must be explicit even when teardown normally follows failure.This profile was inspected and calibrated on 2026-07-21 from bats-core 1.13.0
documentation and source, including evaluation, run, hooks, parallelism,
support-matrix, TAP, and file-descriptor behavior, plus read-only Bats suites.
bats-core and its associated documentation are MIT-licensed. APG copies or
adapts no upstream or private expression or code; this profile is independently
written synthesis.
The inspected support matrix and local runner are evidence, not a universal minimum or target. Refresh before a behavior-bearing correction, maturity review, or publication when Bats releases, Bash support, evaluation, runner flags, hooks, parallelism, file descriptors, or representative false-escalation evidence materially change. Removal must delete the canonical leaf, checked projection, catalog and capability-map entries, and focused tests while preserving ADR, evaluation, and exit history. No private guidance is migrated, so rollback restores none of it.
The repository owns Bats and Bash versions, helper libraries, file layout, runner flags, formatter, TAP consumer, parallelism, timeouts, fixtures, temporary roots, live-service policy, test commands, coverage, CI, artifact classification, accepted exceptions, authority, validation, and rollback.
When material, report the Bats profile level, structural and harness signals, version and policy inputs, status/output assertions, hook scope, isolation, background ownership, test evidence, exception if any, and rollback. Orange requires an accepted local design and focused adverse-case evidence. Red records the stopped false-pass, leak, unsafe mutation, exposure, or growth and the condition required before reconsideration.
Stop or escalate when a test mutates live or destructive state without exact authority and disposable isolation; a background child can hang, leak, retain file descriptor 3, or survive cleanup; a test can pass without validating a materially required status; secrets or private payloads can leak; suite-level state makes results order-dependent without accepted isolation; or meaningful new growth crosses Red without decomposition or an accepted bounded exception.
run fails the test on a nonzero command status.