jig-harness/jig
M14

Testing strategy

Test tiers with budgets, honest doubles, injected clock, polling, tests with every change
1 · The idearead this first

Tests are the main evidence that a change works, and that evidence wears away in two quiet ways. Slow suites creep into the per-change gate: someone adds the full end-to-end sweep to every pull request “to be safe”, every change now waits half an hour, and people and agents learn to batch changes, retry until green, or skip the gate. And false greens hide failures: a stand-in for a real service that accepts any input, a suite that skips itself when a secret is missing and reports success, a test that sleeps five seconds and hopes the work is done, a test that was never seen to fail. Each one passes while the thing it claims to check is broken. Without a strategy, a green run means less every month and costs more. This module says where each suite runs and how long it may take, and gives the rules that make a passing test mean something.

Invariantthe rule, independent of any tool

Every test suite has a declared tier with a trigger and a time budget; the full end-to-end sweep, whose journeys other checks already cover, never runs per change, and a check enforces that. A passing test means the behaviour works: test doubles reject what the real dependency rejects, runtime code reads time only from an injected clock, waits poll against a deadline instead of sleeping, isolation predicates are proven against the engine that evaluates them, test data comes from typed builders, test files are type-checked, and a new test is seen to fail before its pass is trusted. A changed source file comes with a test or a registered exemption; a job that exists for a suite fails unless the suite executed at least one test; a failure is attributed to a change only after it is reproduced on a freshly fetched base; every workaround for a dependency’s defect has a test that pins the defect and names the workaround; the suites run against the next release of the runtime on a schedule that blocks nothing; tests never touch the developer’s real state; and coverage is a scheduled trend, never a per-file gate.

Each piece below is a tool-independent rule; the tools that implement it in each ecosystem are in mappings.md. Terms in bold are defined in the glossary.

2 · The practicewhat each level asks of your repository

M14 Lite — minimum useful

the tiers are written down, each suite with its trigger and time budget, and the testing rules (doubles, clock, waiting, developer state) and the triage of a failure the change did not cause are written where agents and people will read them. Enforcement may be convention.

What the audit checks at Lite convention-only is enough must be mechanically enforced
  1. Every test suite has a written tier (unit, integration, end-to-end or the repository's own names) with the trigger that runs it and its time budget.
    test-tiers-declaredWhat the audit looks for (2)
    • a testing doc, the instruction file or comments in the CI configuration name each suite with its trigger and budget
    • the full end-to-end sweep, where one exists, is written down as nightly or on demand, never per change; end-to-end tests of journeys nothing else checks may run after every merge
  2. The testing rules are written where agents and people read them: test doubles reject what the real dependency rejects, runtime code reads time from an injected clock, waits poll with a deadline instead of sleeping, tests change the home directory, working directory or environment only in a subprocess, and a new test is seen to fail before its pass is trusted.
    testing-rules-writtenWhat the audit looks for (2)
    • a testing doc, rule file or the instruction file states the rules for doubles, time, waiting, developer state and seeing a new test fail first
    • the instruction file points at it
  3. The procedure for a test failure the change did not cause is written where agents and people read it: the failure is reproduced on a freshly fetched base in a throwaway worktree before it is attributed, never with a stash, and a failed fetch is no answer; a test that fails on the base too is fixed inline when cheap or deleted with a tracker item recording what it covered; a test is regenerated only when its premise is obsolete and the new test asserts what the old one protected.
    stale-test-triage-writtenWhat the audit looks for (3)
    • a testing doc, rule file or the instruction file states the fresh-base reproduction, the fix-inline-or-delete-with-a-tracker-item rule and the regenerate-only-on-an-obsolete-premise rule
    • it names the steps or the command (fetch, a throwaway worktree, the install into it, the test command on one file) and forbids a stash or a checkout of the base in the working tree
    • the instruction file points at it

M14 Standard — production teams

every CI test job has an enforced time budget; the full end-to-end sweep runs only on a schedule or on demand (end-to-end tests of journeys nothing else checks stay in post-merge verification), and a lint fails a per-change trigger on it; test files are type-checked in CI, and an assertion on a spawned process’s exit status goes through a helper that prints the child’s output; a gate fails a changed source file without a test or an exemption, and an exemption that matches no file; a gate rejects fixed sleeps without the registered token, and a token with no delay beside it; every job that exists for a suite fails when the suite executed zero tests, counted from the runner’s report; and every workaround for a dependency’s defect has a behaviour pin that names it.

What the audit checks at Standard convention-only is enough must be mechanically enforced
  1. Every CI job that runs tests has an enforced budget on the suite's elapsed time: a job timeout, a timeout on the command that runs the suite, or a step that fails when the suite runs over its tier's budget. A per-test timeout alone does not count: it bounds one test, not the suite.
    tier-budgets-enforcedWhat the audit looks for (3)
    • test jobs carry timeout-minutes / timeout: / options { timeout(...) }, or the suite's command runs under timeout <duration>
    • or a step compares the suite's elapsed time with the budget and fails
    • where the tier declares a budget, the bound that counts is no looser than it: a job timeout well above the suite's budget is a backstop against a hang, not the budget's enforcement
  2. The full end-to-end sweep, whose journeys other checks already cover, runs only on a schedule or on demand, and a check over the CI configuration fails when its workflow gains a per-change trigger (end-to-end tests that are the only check of a critical journey may run after every merge; expected-absent where the repository has no end-to-end suite).
    full-e2e-never-per-changeWhat the audit looks for (2)
    • the workflow running the full end-to-end suite triggers on schedule / dispatch only
    • a lint or grep gate run in CI fails a per-change trigger (pull_request, push, merge request) on that workflow
  3. Test files are type-checked in CI by the same kind of check as runtime code (for a compiled language, the test sources compile in CI; expected-absent only for a language that has no type checker to apply; a checker that exists for the language but is not configured scores absent).
    tests-type-checkedWhat the audit looks for (2)
    • the type-check configuration CI runs includes the test files (tsconfig include, tsconfig.test.json, mypy/pyright paths)
    • or the language compiles test sources as part of the CI build
  4. A test that asserts a spawned process's exit status asserts it through a helper that prints the child's captured output when the assertion fails, and the rule is written where agents and people read it (expected-absent where no test spawns a process).
    spawn-exit-assertions-print-outputWhat the audit looks for (3)
    • a shared test helper takes the spawn result with its captured stdout and stderr and throws with both on a mismatch, and the tests that spawn a process assert through it
    • the testing doc or the instruction file names the helper as the rule
    • at the mechanical rung, a lint rule or grep gate flags an assertion on a spawn result's exit field in test files, blocking in CI directly or through a ratchet on its count
  5. A CI check fails a change whose changed source file has no test, unless the file is listed in a registered exemption with a reason, and a pre-push hook runs the same check before the push.
    tests-come-with-changesWhat the audit looks for (3)
    • a CI job maps each changed source file to its test path and fails when none exists
    • the pre-push hook configuration runs the same check
    • exemptions live in a reviewed file or list, each with a reason
  6. The check that fails a changed source file without a test also fails an exemption that matches no file, so an exemption leaves with the code it excused.
    test-exemptions-prune-themselvesWhat the audit looks for (2)
    • the check fails an exemption that matches no file in the tree it reads (M14's tests-with-changes reference does)
    • a check that passes a stale exemption scores convention at most
  7. A gate rejects fixed sleeps in test and tooling code, except those carrying a suppression token registered for local timing; waits for external state poll with a deadline.
    fixed-sleeps-bannedWhat the audit looks for (2)
    • a lint rule or grep gate run in CI flags sleep / setTimeout / time.sleep / Thread.sleep in tests
    • its suppression token is listed in the suppression-token registry
  8. The gate that rejects fixed sleeps fails a suppression token with an empty reason, and a token with no delay on its line or the line below.
    fixed-delay-tokens-prune-themselvesWhat the audit looks for (2)
    • the gate fails a token without a reason, and a token with no delay on its line or the line below (M14's fixed-delay reference does both)
    • a gate that passes an empty or stale token scores convention at most
  9. Every CI job that exists for a suite that can run nothing (a job that provisions a database, a queue, a browser or a credential the suite skips itself without; a shard or path selection of one suite) fails when that suite executed zero tests, counted from the runner's machine-readable report as the test cases not skipped, and fails when the report is missing (expected-absent where no job exists for such a suite).
    provisioned-suites-executedWhat the audit looks for (3)
    • the job runs the suite with a JUnit (or equivalent) report written to a file
    • a step after the suite reads the report and fails the job when no test case executed, per suite where several suites in the job could each skip
    • the count comes from the report's test cases, not from the runner's human summary line, and a missing or unreadable report fails the job
  10. Every workaround for a defect in a dependency has a test beside it that asserts the defective behaviour against the real dependency and names the workaround, and the written rule is that a pin failing after an upgrade retires or adapts the workaround rather than updating the assertion (expected-absent where the repository has no such workaround).
    dependency-workarounds-pinnedWhat the audit looks for (2)
    • each dependency workaround (a patch, a wrapper, a decode step compensating for a driver's or library's defect) has a test naming it that asserts the defective behaviour against the real dependency, not against the workaround or a double
    • the testing doc or the pin's header states that a failure after an upgrade is the signal to retire or adapt the workaround, never an assertion to update

M14 Strict — regulated / compliance posture

a lint rule rejects direct wall-clock reads in runtime code; isolation predicates are tested in CI against the real engine; test runs are isolated from developer state mechanically; test doubles and builders are typed against the real contracts; coverage is published as a scheduled trend that rejects incomplete data; and a scheduled canary that blocks nothing runs the most informative suites, and a compiled-binary smoke test where there is a binary, against the next release of the runtime, recording the build it used.

What the audit checks at Strict convention-only is enough must be mechanically enforced
  1. A lint rule rejects direct wall-clock reads in runtime code outside the one system-clock adapter, so runtime code gets the current time from an injected clock.
    clock-reads-lintedWhat the audit looks for (2)
    • a lint rule (GritQL plugin, no-restricted-syntax, banned-api, forbidigo, ArchUnit, BannedApiAnalyzers) bans Date.now / new Date() / datetime.now / time.Now / Instant.now in runtime code
    • it blocks in CI, directly or through a ratchet on its count
  2. Isolation and visibility predicates (tenant scope, soft delete, authorization) are tested in CI against the engine that evaluates them, with data that would leak if the predicate were missing (expected-absent where the repository has no such predicates).
    predicates-proven-against-engineWhat the audit looks for (2)
    • a CI job provisions the real database or policy engine and runs predicate tests against it
    • those tests seed a second tenant or a deleted record and assert it is hidden
  3. Test runs cannot touch the developer's real state: the home directory, temp directory and the tool's own configuration point at per-run locations before any code under test starts (the test command launches the runner with them set, or tests spawn the code under test as a subprocess with them set), and a lint rejects in-process changes to them in test files.
    developer-state-isolatedWhat the audit looks for (2)
    • the test script or a wrapper sets HOME / TMPDIR / the tool's configuration variables to per-run locations in the environment it launches the runner with; a fixture that changes them inside the test process does not count
    • a lint or grep gate rejects process.env.HOME = / process.chdir( (or the ecosystem's equivalent) in tests
  4. Test doubles and test-data builders are typed against the real contract, doubles reject inputs the real dependency rejects, and builders return one declared type with deterministic defaults.
    doubles-and-builders-typedWhat the audit looks for (4)
    • doubles are declared with the real interface type (Pick<T>, satisfies, autospec, implementing the interface), not any
    • fakes of command-line tools or APIs fail on an unknown flag or request
    • the testing doc or the pull-request template asks for a mutation check on a new double: break the real call site, see the test fail, restore it
    • builders declare their return type and use fixed identifiers and timestamps
  5. A scheduled CI job publishes coverage as a trend, also when it is below target, refuses to publish incomplete data, and no merge is blocked on a per-file coverage threshold.
    coverage-trend-scheduledWhat the audit looks for (3)
    • a workflow on a schedule runs coverage and publishes it (dashboard, hosted service, artifact)
    • the publish step runs even when the coverage step fails, and fails when a package's report is missing
    • no per-file blocking coverage threshold is configured
  6. A scheduled workflow with no per-change trigger, which is not a required check, runs the suites with behaviour pins and the integration tier with its dependencies provisioned, and a compiled-binary smoke test where the product ships a binary, against the next release of the runtime or a driver, and records the build it used.
    next-release-canaryWhat the audit looks for (4)
    • a workflow on schedule and manual dispatch installs the runtime's next-release channel (canary, nightly, beta, release candidate) and runs the integration-tier suites with their dependencies provisioned
    • it writes the runtime's version and revision to the run summary or log
    • it has no pull_request or push trigger and is not among the required checks; where the product ships a compiled binary, a job builds it with the next release and executes it against its exit-code contract
    • its next-release pin is a registered exception wherever the repository checks its pin sites (M2's toolchain-pins declaration, or its equivalent)

Some criteria are expected-absent by shape: a library with no running system has no end-to-end sweep to place, and a repository with no database or authorization layer has no isolation predicate to prove. The audit calibrates by repository shape.

Adoption steps

  1. Copy templates/TESTING.md into your docs tree, fill in the tier table with your suites, triggers and budgets, name your base branch and tracker in its triage rule, and point your instruction file at it. This is Lite.
  2. Enforce each CI test suite’s tier budget on the command or step that runs it, inside a job timeout sized as M13’s backstop; move the full end-to-end sweep to a nightly schedule and a manual trigger, and add a check over the CI configuration that fails if it gains a per-change trigger (mappings.md). In each job that exists for one suite (the integration job that provisions its database, a shard), write the runner’s report and end the job with reference/tests-executed/ on it (mappings.md).
  3. Make sure your type check includes test files, and run it in CI. Route every assertion on a spawned process’s exit status through a helper that prints the child’s output on a mismatch, and add a lint rule for the bare shape, under the ratchet where many exist (mappings.md).
  4. Wire reference/tests-with-changes/ into the pre-push hook and CI with your source globs and test layout; start an exemptions file with a reason on every line.
  5. Run reference/fixed-delay/, or a lint rule that does the same job, over test and tooling code in the pre-push hook and CI; register the fixed-delay: token in your suppression-token registry, and replace the sleeps it finds with a polling helper. Give every workaround for a dependency’s defect a behaviour pin beside it, named for the workaround. This is Standard.
  6. Introduce a clock interface, pass it into runtime code, and add the lint rule that bans direct wall-clock reads; start it under M1’s ratchet if there are many existing reads.
  7. Test isolation predicates against the real engine in a CI job that provisions it; isolate test runs from developer state by pointing the home directory, temp directory and the tool’s own configuration at per-run locations before any code under test starts (the test command launches the runner with them set, or tests spawn the code under test with them set), and add a lint that rejects in-process changes to them in test files; type doubles and builders against the real contracts; schedule a coverage trend job; and copy templates/runtime-canary.yml, point it at the suites with behaviour pins and the integration tier, and register its next-release pin as an exception in your toolchain-pins declaration (M2). This is Strict.
3 · The mechanicsopen what you need
Core piecesOpen
  1. Tiers, with a trigger and a time budget. Every suite belongs to a declared test tier that says what starts it and how long it may take, and the budget is enforced on the suite itself (a timeout on the command that runs it, or a step that fails when it runs over). The job’s own timeout stays the generous backstop M13 sizes at about two to three times the slowest healthy run, so it enforces a budget alone only when the budget is that loose.

    TierWhat it testsTriggerExample budget
    Unitone piece of code, no network, no real servicesevery pushseconds; a minute at most
    Integrationcode against real services (a database, a queue)every pull request that changes their paths, and every push to the default brancha few minutes
    End-to-end (critical journeys)a journey nothing else checks, through the system’s real interfacesevery push to the default branch, before the verified pointer movesa few minutes
    End-to-end (full sweep)the whole running system, journeys other checks already covernightly and on demand, never per changeas long as it needs, bounded by a timeout

    A suite that outgrows its budget is split or moved to a less frequent trigger without changing what it tests; it does not quietly stretch the budget. The full end-to-end sweep is the suite most tempting to put back on every pull request, so its placement is checked, not just written down: a lint over the CI configuration fails if the workflow that runs it gains a per-change trigger. A cheap stand-in runs per change instead, such as “the end-to-end images still build”. End-to-end tests that are the only check of a critical journey are not the sweep: M10’s post-merge verification runs them, because the verified pointer needs their answer. Where a tier is selected by changed paths and its check is required, select it inside the pipeline rather than with a trigger-level path filter. A workflow that a path filter never starts leaves its required check pending, so the pull request cannot merge until someone runs it by hand; a job the pipeline itself skips reports a result (M1’s pull-request template shows the shape; M3’s catalog can supply the paths). Placement in general, what runs per change, after merge, on a schedule or on demand, belongs to M13 (Pipeline economy); M10’s CI architecture says which suites the verified pointer waits for.

  2. Honest doubles. A test double (a fake, stub or mock standing in for a real dependency) is part of what decides whether a test passes, so it must fail where the real dependency would. A fake command-line tool rejects a flag the real one does not accept; a fake API client rejects a request the real API would refuse. The double’s accepted inputs are written independently of the code under test (never read from the same constant, or both repeat the same typo) and typed against the real contract. A new boundary is proven with a mutation check: misspell the flag at the real call site, see the test fail, then restore it.

  3. Injected clock. Runtime code gets the current time only from an injected clock passed in as a dependency, so a test can fix or advance time. A lint rule rejects direct reads of the wall clock outside the one adapter that implements the system clock. Arithmetic on a time obtained from the clock (“thirty days after clock.now()”) is allowed; only reading “now” directly is not.

  4. Poll, don’t sleep. Waiting for external state (a job to finish, a row to appear) checks the state repeatedly against a hard deadline, and the failure message names what it waited for, how long and how many times it checked. A fixed delay is allowed only for local timing (a retry back-off, an abort deadline, the pause between two polls), and only with an inline suppression token such as fixed-delay: <reason>, registered in M1’s suppression-token registry. A gate fails a delay without the token, a token without a reason, and a token with no delay beside it, so the token leaves with the delay it excused: reference/fixed-delay/ takes the files and the delay texts as arguments. reference/poll-until/ is a small helper that polls with a deadline, and pauses only with the token.

  5. Predicates where they execute. An isolation predicate, the condition that keeps one tenant’s rows from another, hides soft-deleted records, or checks an authorization, is tested against the engine that evaluates it (the real database, the real policy engine), with data that would leak if the predicate were missing: a second tenant’s rows, a deleted record. A mock that returns only the rows the test expects proves nothing about the filter.

  6. Typed builders. A test-data builder returns one declared contract type (the route’s response type, the table’s row type) with deterministic defaults (fixed identifiers and timestamps), and a test overrides only the fields it cares about. When the contract gains a required field, the builder fails the type check, or the completeness lint an ecosystem needs for that (mappings), instead of every test that uses it failing in a confusing way. This is distinct from M10’s test-data factory, which seeds a running environment with realistic, tenant-isolated data: builders make values inside one test process, a factory fills a database that many runs share.

  7. Tests are code. Test files are type-checked by the same check as runtime code, in CI; a test configuration that leaves them out makes a clean type check meaningless for them. A new test, probe or gate is seen to fail once (against a deliberately broken input or a mutated call site) before its pass is trusted. A test that asserts a spawned process’s exit status asserts it through a helper that prints the child’s captured output when the assertion fails (lib/test-helpers/expect-spawn-exit.ts is Jig’s): a bare assertion reports two numbers and discards what the child printed, so a genuine regression and a process killed under load read alike, and the failure is dismissed as flaky. A lint rule flags the bare shape, under M1’s ratchet where many exist (mappings).

  8. Tests come with changes. A changed source file comes with a test, or its path is listed in a registered exemption with a reason. An exemption that matches no file fails, so it leaves with the code it excused instead of exempting new code written at that path later. A gate checks both in a hook and in CI: reference/tests-with-changes/ takes the base ref, the source globs, the test-path templates and the exemptions file as arguments.

  9. No real developer state. A test that redirects process-global state (the home directory, the working directory, environment variables) does it in a subprocess it spawns, with the redirected values in that child’s environment. Changing them inside the test process can leak into other tests running in the same process, and some runtimes read the home directory once at start-up, so the code under test would read and write the developer’s real files.

  10. Coverage is a scheduled trend. Coverage is measured on a schedule and published as a trend, including when it is below target, because the drop is when the chart matters. The publisher refuses incomplete data (a package whose report is missing or unreadable) rather than charting a partial number as if it were whole. Per-file blocking thresholds are not recommended: they punish whoever touches a legacy file, they invite tests written to raise the number rather than to check behaviour, and they block a merge on a percentage rather than on a behaviour that broke.

  11. Skipped is not passed. A suite that needs a real dependency (a database, a queue, a browser, a credential) usually skips itself when the dependency is missing, so the rest of the tests still run on a machine without it. In the CI job that provisions the dependency, that courtesy becomes a false green: the job passes whether the suite ran or not, and a misspelt connection variable or a test file outside the runner’s discovery root (the directories it looks in for tests) passes with nothing executed. Most runners also report success for a path or shard that matched nothing. So every job that exists for a suite ends with a skip tripwire: it reads the runner’s machine-readable report (the JUnit report every mainstream runner can write), counts the test cases that were not skipped, and fails when the count is zero or the report is missing. The count comes from the report, never from the runner’s human summary line, whose wording changes between versions; and where a job runs several suites that could each skip, it is taken per suite, because an aggregate proves only that one of them ran. reference/tests-executed/ is the check; the report flag per runner is in mappings.

  12. Triage before attribution. A failing test is attributed before it is fixed. Where the test, the file it tests or their directory is not in the change, the failure is reproduced on a freshly fetched base, in a throwaway worktree: never with a stash, because worktrees share one stash stack and a stash and pop can revert another session’s files, and never by checking the base out in the working tree. The fresh-base probe checks out the commit the fetch returned, not the remote-tracking ref already present, which is only as fresh as the last fetch, and installs the dependencies into the worktree itself, because an install linked to the working checkout would run the change’s code against the base’s test; a fetch that fails is no answer. A command that fails on the base proves only that something failed there (a missing install, an import error, another test), and a test’s name in the output proves nothing either, since a passing test prints its name too. So the failure counts as reproduced only when the failing test case’s own result, in the report the runner writes on the base, is a failure (for a check with no per-case report, a type check or a lint, when the base’s output shows the error message the change’s failure showed). A failure that reproduces on the base is a stale test, and the base’s problem: it is fixed inline when the fix is cheap (an assertion value, a mock’s return value, an import path), and otherwise deleted with a tracker item that records what it covered (the file, its cases, the behaviours they asserted, the failing output), so the coverage is owed rather than lost. A test is regenerated only when its premise is obsolete (its setup models a dependency shape or an architecture that no longer exists), and the new test asserts every behaviour the old one protected before the old one goes; a test is never regenerated to silence a failure. A stale test can exist at all because a per-change check scoped to the diff never runs for a change elsewhere, so the integration branch goes red without any pull request going red: M13 asks for an unscoped run of those checks on the integration branch, where a red surfaces on its own. fix-ci runs this triage with its probe; the command per runner is in mappings.

  13. Behaviour pins for dependency workarounds. A workaround for a defect in a dependency (a driver that double-encodes a value, a client that mis-parses a type) compensates for behaviour the dependency has today. When the dependency fixes the defect, the workaround keeps compensating for a problem that is no longer there, and a correct value now goes through a correction meant for a defective one. So every workaround has a behaviour pin: a test that asserts the defective behaviour against the real dependency (not against the workaround, and not against a double of the dependency) and names in its title the workaround whose premise it pins. The pin fails on the release that fixes the defect, and that failure is the signal to retire or adapt the workaround in the same change that upgrades the dependency; the assertion is never updated on its own to make the pin pass again. The pin lives beside the workaround’s code, so the two are found together, and because it needs the real dependency it is an integration-tier test whose job ends with the skip tripwire (piece 11), so it cannot green-skip. The shape per runner is in mappings.

  14. Canary on the next release. An upgrade of the runtime, a driver or a compiler is where behaviour pins and everything else break at once, and the day of the upgrade is the worst day to learn it. So a runtime canary, a scheduled job, runs the most informative suites (the ones with behaviour pins, and the integration tier with its dependencies provisioned so the suites run rather than skip) against the dependency’s next release (its canary, nightly, beta or release-candidate channel) and, where the product ships as a compiled binary, builds the binary with the next release and executes it against its exit-code contract. The canary never blocks: it has no per-change trigger and is no required check, because a red run is a finding to triage before the upgrade, not a reason to stop a merge. It records the exact build it ran (version and revision) in its summary, because next-release builds change daily and a red run must be attributable to one of them. Its pin on the next release is a deliberate exception to M2’s one version source, registered there with its reason. A pin that fails in the canary is triaged as piece 13 says, and the upgrade that retires the workaround is the kind the planned upgrade-deps (ROADMAP item 3) is to drive. templates/runtime-canary.yml is the workflow; the next-release channel per runtime is in mappings.

In your toolsThe same rule, wired into a specific CI provider, hook manager or tracker. Shows only your stack.Open

The module invariant is tool-independent: declared tiers with budgets, honest doubles, an injected clock, polling instead of sleeping, predicates proven where they execute, typed builders, type-checked tests, tests with every change, no real developer state, coverage as a trend, and a tripwire on suites that skipped themselves. This file maps each piece onto concrete languages, test runners and CI providers. Replace <placeholders> with your values. The reference scripts need the pinned Bun runtime; everything else here is a feature of the named tool.

Tiers in CI

A tier is a trigger plus a time budget. The trigger is CI configuration. The budget bounds the whole suite’s elapsed time: a timeout on the command that runs the suite, or a step that measures the run against the budget. The job timeout bounds it too, but M13 sizes it as a generous backstop, about two to three times the slowest healthy run and at most an hour, so it enforces a budget alone only when the budget is that loose; a tighter budget goes on the command or step. A per-test timeout in the runner is useful too, but it bounds one test, not the suite: hundreds of tests each under their limit can still run far past the tier’s budget.

CI providerEvery push / pull requestWhen paths changeNightly and on demandJob timeout (the backstop)
GitHub Actionson: push / on: pull_requesta resolver job that lists changed files and sets outputs the tier’s job reads in if: (a trigger-level paths: filter never starts the workflow, which leaves its required check pending and blocks the merge)on: schedule (cron) and on: workflow_dispatchtimeout-minutes on the job
GitLab CIdefault pipeline on push and merge requestrules: - changes: [<paths>]rules: - if: $CI_PIPELINE_SOURCE == "schedule" plus a pipeline schedule; when: manual for on demandtimeout: on the job
CircleCIdefault workflowthe path-filtering orbscheduled pipelines; an API-triggered pipeline with a parameterthe suite’s command wrapped in timeout <duration> (from coreutils); no_output_timeout on a step bounds only silence, not total time
Jenkinsthe multibranch jobwhen { changeset "<glob>" }triggers { cron('H 2 * * *') }; “Build with parameters”options { timeout(time: 10, unit: 'MINUTES') }

Within a suite, the test runner selects the tier and bounds each test:

RunnerSelect a tierPer-test time limit
Bunseparate directories or file name patterns passed to bun testbun test --timeout <ms>
Vitestprojects (one per tier) or --projecttestTimeout
Jestprojects, or --selectProjectstestTimeout
pytestmarkers (@pytest.mark.integration) selected with -mthe pytest-timeout plugin (--timeout)
Go//go:build integration build tags, or testing.Short() with go test -shortgo test -timeout <duration> (whole binary)
JUnit 5@Tag("integration") with Gradle’s useJUnitPlatform { includeTags(...) } or Maven Surefire groups; Maven Failsafe for *IT classes@Timeout, or junit.jupiter.execution.timeout.default
xUnit / NUnit (.NET)[Trait("Category", "Integration")] / [Category] with dotnet test --filterxUnit [Fact(Timeout = <ms>)] on async tests; NUnit [Timeout] / [CancelAfter]

A budget can also be measured: record the start time, run the suite, and fail the step when it took longer than the tier allows, naming the budget in the error. That catches a suite slowly growing towards the job timeout.

Keeping the full end-to-end sweep off the per-change path. Put a marker comment in each workflow that runs the full sweep (for example # test-tier: end-to-end), and add a grep gate over the CI configuration that fails when a marked file declares a per-change trigger (pull_request, pull_request_target or push in GitHub Actions; a rule without the schedule condition in GitLab CI). Make the gate also fail when a workflow runs the end-to-end command without the marker, so the ban cannot be dodged by leaving it off. M1’s grep-gate convention applies: a self-test with fixtures, run in CI.

Honest doubles

EcosystemTyped against the real contractRejects what the real dependency rejects
TypeScripttype the double as the real interface (const repo: Pick<OrderRepository, "find"> = …, or satisfies OrderRepository); never anyMock Service Worker with onUnhandledRequest: "error" fails a request no handler expects; a fake command checks its arguments (below)
Pythonunittest.mock.create_autospec(Real) or patch(..., autospec=True): a call with the wrong signature raisesresponses raises on a request it was not told about; respx can assert that every request was mocked
Gothe double implements the consumer’s interface, so the compiler checks itgo.uber.org/mock (gomock) fails the test on an unexpected call; httptest.NewServer with a handler that returns an error for unknown paths
JVMMockito mocks of the real type; WireMock stubs from the provider’s contractMockito’s strict stubs (the default with MockitoExtension) report an argument mismatch; WireMock answers an unmatched request with 404
Any HTTP APIa consumer-driven contract (Pact) verified against the providerthe provider verification fails when the consumer expects something the provider does not do

A fake command-line tool (a script put first on PATH to stand in for a vendor CLI) holds, per subcommand, the flags and operands the installed version accepts, written from that tool’s own help or reference rather than from the code under test. It exits non-zero with “unknown flag” for anything else, before it picks a canned response. Prove each new boundary with a mutation check: change a flag at the real call site to a misspelling, run the test, see it fail on the fake’s error, and restore the call site (or run the mutation on a temporary copy).

Injected clock

EcosystemThe clockLint rule that bans reading the wall clockTest side
TypeScript / JavaScriptan interface such as { now(): Date } passed in as a dependency, with one system implementationa Biome GritQL plugin matching Date.now() and a no-argument new Date(); or ESLint no-restricted-syntax with the selectors CallExpression[callee.object.name='Date'][callee.property.name='now'] and NewExpression[callee.name='Date'][arguments.length=0]a fixed or advancing fake; for code not yet migrated, setSystemTime (bun:test), vi.setSystemTime (Vitest), jest.setSystemTime (Jest)
Pythona callable (now: Callable[[], datetime]) or a small protocolRuff flake8-tidy-imports banned-api (rule TID251) on datetime.datetime.now, datetime.datetime.utcnow and time.time; Ruff’s flake8-datetimez (DTZ) rules additionally require time-zone-aware valuesa fake callable; freezegun or time-machine for code not yet migrated
Goa func() time.Time field or a clock interface (k8s.io/utils/clock, github.com/jonboulle/clockwork)golangci-lint forbidigo with the pattern ^time\.Now$the libraries’ fake clocks; testing/synctest runs a test in a bubble with its own fake time
JVMjava.time.Clock injected; Instant.now(clock), LocalDate.now(clock)an ArchUnit rule that no class outside the clock adapter calls Instant.now(), LocalDateTime.now() or System.currentTimeMillis()Clock.fixed(...), Clock.offset(...)
.NETTimeProvider (.NET 8 and later) injectedMicrosoft.CodeAnalysis.BannedApiAnalyzers (rule RS0030) with DateTime.Now, DateTime.UtcNow and DateTimeOffset.UtcNow in BannedSymbols.txtFakeTimeProvider (Microsoft.Extensions.TimeProvider.Testing)

Scope the rule to runtime code and exclude the one system-clock adapter. Arithmetic on a value the clock returned stays allowed: the rule matches the read, not new Date(<value>) or date arithmetic. If the codebase has many existing reads, put the rule at warning level under M1’s ratchet so the count can only fall.

Poll, don’t sleep

EcosystemPolling with a deadlineRule against fixed sleeps
TypeScript (Bun, any runtime)reference/poll-until/reference/fixed-delay/ over test and tooling code: its default texts are Bun.sleep(, setTimeout(, sleep( and time.sleep(, and it accepts a fixed-delay: <reason> comment on the same line or the line above
Vitest / Jestvi.waitFor(fn, { timeout, interval }), expect.poll (Vitest); Testing Library’s waitForthe same gate
Playwrightexpect.poll(fn, { timeout }), expect(fn).toPass(), and auto-waiting assertions such as toBeVisible()eslint-plugin-playwright’s no-wait-for-timeout
Pythontenacity (retry_if_result, stop_after_delay, wait_fixed)reference/fixed-delay/ on the test files with --pattern 'time.sleep(' --pattern 'asyncio.sleep(', which accepts the repository’s own # fixed-delay: <reason> comment (Ruff TID251 can ban it too, but its # noqa is a tool-native escape that M1’s registry leaves out and that needs no reason)
Gotestify’s require.Eventually(t, cond, waitFor, tick); Gomega’s Eventually; wait.PollUntilContextTimeout (k8s.io/apimachinery)golangci-lint forbidigo on ^time\.Sleep$ in _test.go files
JVMAwaitility: await().atMost(Duration.ofSeconds(30)).until(...)ArchUnit rule against Thread.sleep in test classes

Whatever the helper, the failure message names what was awaited, and the fixed-delay token is registered in M1’s suppression-token registry with its consuming gate, its placement and when it is stale (no delay on its line or the line below). The fixed-delay gate has no imports beyond Bun’s and Node’s built-ins, so a repository can copy check-fixed-delay.ts as it is, or run it from a pinned Jig checkout as the tests-with-changes recipe does.

Predicates where they execute

Run the real engine in the test job and seed data the predicate must hide.

NeedTools
A real database per test runTestcontainers (Java, Go, Node, Python, .NET); a database service container in the CI job (GitHub Actions services:, GitLab CI services:)
Tenant scope enforced by the databasePostgreSQL row-level security tested inside a transaction that sets the session’s role and tenant settings (SET LOCAL ROLE, set_config(..., true)) and is rolled back at the end; pgTAP for tests written in SQL
Authorization policiesthe policy engine’s own test runner, such as opa test for Open Policy Agent

Each test seeds at least two tenants (or a live and a soft-deleted record), asserts what the predicate lets through, and asserts what it hides. A test that seeds one tenant passes whether the predicate exists or not.

Typed builders

EcosystemBuildersDeterministic values
TypeScripta plain function with an explicit return type and Partial<T> overrides; fishery (Factory.define<Order>(...))fixed timestamps and identifiers, or faker.seed(<n>) with @faker-js/faker
Pythona function that calls the constructor with every field by name, def an_order(**overrides) -> Order: return dataclasses.replace(Order(id="order-1", status="open"), **overrides), checked by mypy or Pyright; factory_boy and polyfactory generate values at run timefixed values in the builder; factory.random.reseed_random(<seed>) for a generator
Goa function returning the struct, with functional options for overrides; exhaustruct (in golangci-lint) run over the builders, so a field left out of the literal fails the lintfixed values; no time.Now() in defaults
JVMthe test-data builder pattern; Instancio; Kotlin functions with default argumentsInstancio with a fixed seed; fixed values
.NETAutoFixture; Bogus (new Faker<Order>())Randomizer.Seed in Bogus; fixed values

The builder returns the contract type the consumer reads (the response type, the table’s row type), so adding a required field to that type breaks the builder at compile time. That holds only for a builder that builds the value itself, with a typed constructor call or literal: a plain function, the builder pattern, Kotlin default arguments, fishery’s typed define. Go is the exception among those: a keyed struct literal compiles with fields left out and gives them their zero value, so a Go builder gets the same guarantee only from a linter that requires every field in the literal (exhaustruct), run over the builders in the per-change gate. Generators that fill fields by reflection at run time (factory_boy, polyfactory, Instancio, AutoFixture, Bogus) still compile when the type gains a field and fail, or silently fill it, only when they run. Use them for values inside a typed builder, not as the builder.

Tests are code

EcosystemTest files type-checked by
TypeScriptthe type check covering test files: test paths in the tsconfig.json include, or a tsconfig.test.json checked with tsc --noEmit -p (or bun check -p) in CI. A runner that strips types without checking them (Bun, Vitest, babel-jest) does not type-check
Pythonmypy or Pyright with tests/ in its configured paths
Go, JVM, .NETthe compiler: go vet ./... and go test compile test files; mvn test-compile / gradle compileTestJava; dotnet build

To trust a new type check over tests, put a deliberate type error in one test file and see the check report it before relying on a clean run.

Spawned exit codes

An assertion on a spawned process’s exit status prints the child’s captured output when it fails, so a regression is told apart from a process killed under load. The spawn call pipes both streams; a result that captured neither says so rather than leaving the fields out.

EcosystemHelperLint for the bare shape
TypeScript (Bun, Node)lib/test-helpers/expect-spawn-exit.ts: expectSpawnExit(result, code), expectSpawnExitNot(result, code) and expectSpawnKilled(result) take the spawn result with its piped stdout and stderr (null where a run captured none) and throw with both on a mismatch; an in-process runner that returns { exitCode, stdout } passes stderr: nullBiome: a GritQL plugin on expect($result.exitCode).$matcher(...) and its .not form in test files, tools/quality/grit/no-bare-exit-code-assertion.grit, at warn under the ratchet; ESLint: no-restricted-syntax with a selector for a call to expect whose argument is a member named exitCode. Node’s status field is not matched, since HTTP responses share the name: read a Node result into the helper’s shape
Pythonsubprocess.run(..., capture_output=True, text=True) and assert result.returncode == code, result.stdout + result.stderr, or a fixture that wraps the run and the assertiona grep gate over test files for returncode == in an assert without a message
Goout, err := cmd.CombinedOutput(), then t.Fatalf("%v\n%s", err, out) on failure; the code is on exec.ExitErrorreview: go vet has no such rule
JVM, .NETthe assertion’s message argument carries the captured output (assertEquals(0, code, output); a helper that throws with the output around Assert.Equal)review

Tests come with changes

reference/tests-with-changes/ takes the layout as arguments. Typical templates:

Layout--source--test
TypeScript, tests beside the sourcesrc/**/*.ts{dir}/{name}.test.{ext}, {dir}/__tests__/{name}.test.{ext}
Python, mirrored tests/ treesrc/**/*.py{dir:src=tests}/test_{name}.py
Go**/*.go{dir}/{name}_test.go
Maven or Gradle (Java)src/main/java/**/*.java{dir:src/main/java=src/test/java}/{name}Test.java

Run it from a pinned Jig checkout (it imports lib/cli.ts from Jig’s root), with M14 set to the module’s path inside that checkout. Pin Jig to a release that contains M14 (0.27.0 or later) by its full commit hash; the other two actions are pinned as Jig’s own workflow pins them:

yaml
# GitHub Actions
jobs:
  tests-with-changes:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    env:
      M14: .jig/modules/M14-testing-strategy
      BASE: ${{ github.event.pull_request.base.sha }}
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10   # v6
        with: { fetch-depth: 0 }                   # the gate needs the merge base
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10   # v6
        with:
          repository: <jig-repository>             # where you take Jig from
          ref: <full-commit-sha-of-a-jig-release>  # 0.27.0 or later
          path: .jig
      - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6   # v2.2.0
        with:
          bun-version-file: .jig/package.json      # Jig's pinned Bun, not the latest
      - run: bun test "$M14"/reference/tests-with-changes/check-tests-with-changes.test.ts
      - run: >-
          bun "$M14"/reference/tests-with-changes/check-tests-with-changes.ts
          --base "$BASE" --source 'src/**/*.ts'
          --test '{dir}/{name}.test.{ext}' --exemptions .config/test-exemptions.txt

In a pre-push hook (lefthook, husky or pre-commit), pass the branch the change merges into as --base.

No real developer state

Every row runs the code under test in a child process that gets the redirected values, which is what the rule asks for. The in-process helpers some runners offer are named where they exist; they restore the value after the test but still change it for the whole process while it runs, so they do not satisfy the rule.

EcosystemSpawning the code under test with its own home, directory and environment
Bunspawn a child (Bun.spawn([...], { env: { ...env, HOME: fakeHome }, cwd })): Bun’s os.homedir() does not re-read HOME after start-up, so an in-process assignment leaves the code under test on the real home directory. Set the temp directory and the tool’s own configuration in the environment the test command launches bun test with (a wrapper script, or env TMPDIR=… bun test). Not the rule: a test preload ([test] preload in bunfig.toml), which changes them inside the test process
Node.js test runnerschild_process.spawn / execFile with env and cwd options. Not the rule: process.chdir, which moves every test in the worker
pytestsubprocess.run([...], env={**os.environ, "HOME": str(tmp_path)}, cwd=tmp_path), with tmp_path as the fake home. Not the rule: monkeypatch.setenv / monkeypatch.chdir, which are undone after the test but change the whole process meanwhile
Goexec.Command with cmd.Env and cmd.Dir; or re-run the test binary as the child (os.Args[0] with -test.run), the standard library’s own pattern. Not the rule: t.Setenv / t.Chdir (Go 1.24 and later), which are undone after the test but are process-wide while it runs, which is why they refuse parallel tests
JVMProcessBuilder with its environment() and directory(...), or a forked test JVM. Not the rule: System.setProperty, which is global to the JVM

Pair the isolation with a lint or grep gate that rejects the in-process forms in test files (process.env.HOME =, process.chdir(), with the subprocess as the alternative its message names. The audit asks for both: the isolation set before code under test starts, and the lint.

Coverage as a scheduled trend

EcosystemCoverage report
Bunbun test --coverage --coverage-reporter=lcov
Vitest / Jest@vitest/coverage-v8 or @vitest/coverage-istanbul; Jest --coverage (both write lcov and json-summary)
Pythoncoverage.py, or pytest-cov (--cov --cov-report=xml)
Gogo test -coverprofile=cover.out ./..., go tool cover
JVMJaCoCo (jacoco:report, Gradle jacocoTestReport)
.NETcoverlet (dotnet test --collect:"XPlat Code Coverage")

Run the coverage job on a schedule (weekly is usually enough) and on demand, not per change. Publish the numbers even when the run fails a target: a failing step must not skip the publish step. The publisher compares the packages it found reports for with the list it expected and refuses to publish when one is missing or unreadable. Where a package’s report also covers source from other packages, chart each package on its own: summing them counts shared files twice. Hosted services that chart the trend (Codecov, Coveralls) can report a status that never blocks (Codecov’s informational: true); runner settings that block per file (Jest coverageThreshold with path keys, Vitest coverage.thresholds.perFile, JaCoCo check rules per class) are what the module advises against.

Skipped is not passed

reference/tests-executed/ reads the JUnit report (the XML test report every runner below can write) and fails when the test cases that were not skipped number zero. Write the report with the runner’s own flag, then run the check on it in the same job, after the suite. Each row names the flag and how a suite’s self-skip shows in the report, which is what the check counts.

RunnerWrite the reportHow a self-skip appears in it
Bunbun test <paths> --reporter=junit --reporter-outfile=<file>describe.skipIf(...) and test.skipIf(...) cases carry <skipped />; one <testsuite> per file, with one nested per describe
Vitestvitest run --reporter=junit --outputFile=<file>describe.skipIf and test.skip cases carry <skipped/>; one <testsuite> per file
Jestthe jest-junit reporter (--reporters=default --reporters=jest-junit), with JEST_JUNIT_OUTPUT_DIR and JEST_JUNIT_OUTPUT_NAME naming the filedescribe.skip and test.skip cases carry <skipped/>; one <testsuite> per file
Playwrightplaywright test --reporter=junit with PLAYWRIGHT_JUNIT_OUTPUT_NAME=<file>test.skip(condition) cases carry <skipped/>; one <testsuite> per file
pytestpytest --junitxml=<file>pytest.mark.skipif, pytest.skip(allow_module_level=True) and pytest.importorskip cases carry <skipped>; one <testsuite> named pytest for the whole run, so a per-file count means one run per file
Gogotestsum --junitfile <file> ./... (go test alone writes no report)t.Skip and testing.Short() cases carry <skipped>; one <testsuite> per package, without a skipped attribute, which is why the check counts cases rather than attributes
JVM (JUnit 5)Maven Surefire and Failsafe write target/surefire-reports/TEST-*.xml and target/failsafe-reports/TEST-*.xml; Gradle writes build/test-results/test/TEST-*.xml; pass every filea failed assumption (Assumptions.assumeTrue), @EnabledIfEnvironmentVariable and Testcontainers’ disabledWithoutDocker cases carry <skipped>; one file per class, each a root <testsuite>
.NETdotnet test --logger "junit;LogFilePath=<file>" with the JunitXml.TestLogger packagexUnit Skip = and NUnit Assume.That cases carry <skipped/>
Ruby (RSpec)rspec --format RspecJunitFormatter --out <file> (the rspec_junit_formatter gem)skip and pending examples carry <skipped/>
PHPUnitphpunit --log-junit <file>markTestSkipped cases carry <skipped/>

A job that runs several suites which could each skip passes --each-suite, so one suite that ran does not vouch for the others. A job that exists for one file names it with --suite <name>, as the report names it, so a file the runner never discovered is a failure rather than a silence. A runner given a path or shard that matches nothing usually exits 0 and writes no report; the check then reports could not check (exit 2), and the job fails either way.

Run it from a pinned Jig checkout, as the tests-with-changes recipe does, in the job that provisions the dependency:

yaml
# GitHub Actions: the job that provisions the database, after the pinned Jig
# checkout and setup-bun steps of the recipe above
      - name: Run the integration suite with a report
        env:
          DATABASE_URL: postgres://postgres:postgres@localhost:5432/app
        run: bun test src/db --reporter=junit --reporter-outfile=reports/db.xml
      - name: Fail unless the suite executed a test
        if: always()
        run: >-
          bun "$M14"/reference/tests-executed/check-tests-executed.ts
          --each-suite reports/db.xml

The report path the second step names is the one the first wrote; a path the runner did not write fails the step. The same two commands go into a GitLab CI script: list, a Jenkins sh step or a CircleCI run.

Triage before attribution

The fresh-base probe is runner-independent: fix-ci’s probe-base.ts takes the base branch, the failing test’s name (--expect), the JUnit report the command writes (--junit, with the runner’s flag from Skipped is not passed above) and the command that runs the one failing file, fetches the base, runs the command in a throwaway worktree at the commit the fetch returned, removes the worktree, and exits 0 (that test case passed on the base: the failure is the change’s), 1 (it failed there: pre-existing) or 2 (could not decide: the fetch failed, no worktree, the command did not run, or the report has no case by that name, several with different results, or only skipped ones). The verdict reads the case, not the output: a passing test prints its name too, so a name in a failed run’s output says nothing about which test failed. A check with no per-case report (a type check, a lint) is probed without --junit, with the error message as --expect, and counts as pre-existing when it fails on the base showing that message. The worktree starts with nothing installed, so --setup names the repository’s install command, run there first: bun install --frozen-lockfile, npm ci, pnpm install --frozen-lockfile, yarn install --immutable, bundle install, composer install; for Python a fresh virtual environment in the worktree (uv sync, or python -m venv .venv && .venv/bin/pip install -e .), because an editable install into the working checkout’s environment points at that checkout’s sources and the probe would run the change’s code against the base’s test; Go, the JVM and .NET resolve through their build tool’s shared cache and need no step. The setup runs in a shell of its own, so the test command reaches the worktree’s environment directly (uv run pytest, .venv/bin/python -m pytest, bundle exec rspec): a bare pytest resolves from the caller’s PATH, which can be the working checkout’s environment. Without the plugin, five commands do the same: git fetch origin <base>, stopping if it fails; git worktree add --detach <new path> FETCH_HEAD; the install command, then the test command, both run from that path, reading the report for the failing case’s result; git worktree remove --force <path>. The command per runner is the one that runs a single file:

RunnerRun one failing file on the base
Bunbun test <file>
Vitestvitest run <file>
Jestjest <path>
Playwrightplaywright test <file>
pytestuv run pytest <file> or .venv/bin/python -m pytest <file> (<file>::<test> for one case)
Gogo test ./<package> -run '^<TestName>$'
JVMmvn -q test -Dtest=<Class> (Gradle: gradle test --tests <Class>)
.NETdotnet test --filter "FullyQualifiedName~<Class>"
Ruby (RSpec)rspec <file>
PHPUnitphpunit <file>
bash
# From the repository whose check failed, with the plugin's skill directory in SKILL
bun "$SKILL/scripts/probe-base.ts" --base main --setup "bun install --frozen-lockfile" --expect "total rounds to cents" --junit probe.xml -- bun test src/cart/total.test.ts --reporter=junit --reporter-outfile=probe.xml
bun "$SKILL/scripts/probe-base.ts" --base develop --remote upstream --setup "uv sync" --expect test_total_rounds --junit probe.xml -- uv run pytest tests/test_total.py --junitxml=probe.xml

The tracker item that records a deleted stale test is opened with the tracker’s own command-line tool (gh issue create --body-file <notes>, glab issue create, the tracker’s CLI); its body lists the file, the number of cases, the behaviours they asserted, the failing output and why the fix was not cheap, so the coverage is owed, not lost.

A per-change check scoped to the diff (Turborepo --filter=...[<base>], Nx affected, a job-level path condition, a change-area resolver) is what lets a stale test exist; its unscoped run on the integration branch, per CI host, is in M13’s mappings.

Behaviour pins

A pin asserts the dependency’s defective behaviour against the real dependency, so it belongs to the integration tier, skips itself without the dependency, and runs in the job that provisions it, which ends with the skip tripwire. Its title names the workaround, so a failure reads as the signal to retire or adapt that workaround; its header says which release fixes the defect, when that is known, and that the assertion is never updated on its own.

RunnerThe shape of a pin
Bun, Vitest, Jesta <workaround>.pins.integration.test.ts beside the workaround’s file, each describe named for the defect and the workaround file whose premise it pins
Playwrightthe same file beside the client-side workaround, run against the real browser
pytesta test_<workaround>_premise.py beside the workaround, each test’s docstring naming the workaround and the defect
GoTest<Workaround>Premise functions in the workaround’s package, against the real driver
JVM, .NETa test class named for the workaround’s premise in the workaround’s package or project

Canary on the next release

templates/runtime-canary.yml is the workflow. Each row says how the runtime’s next release is installed in a GitHub Actions step and which command prints the build it ran, which the workflow writes to the run summary; the pin the canary holds (canary, nightly, head, a release candidate) is registered as an exception in the repository’s toolchain-pins declaration (M2).

RuntimeThe next release, in a setup stepThe build it ran
Bunoven-sh/setup-bun with bun-version: canarybun --version and bun --revision
Node.jsactions/setup-node with a version-qualified nightly, node-version: <next>-nightly (a release candidate is named exactly, node-version: <next>.0.0-rc.1; there is no bare rc alias)node --version
Denodenoland/setup-deno with deno-version: canarydeno --version
Pythonactions/setup-python with python-version: <next>-dev and allow-prereleases: truepython --version
Gogo install golang.org/dl/gotip@latest && gotip download, then gotip in place of gogotip version
Rustdtolnay/rust-toolchain@beta (or @nightly)rustc --version --verbose, which includes the commit
Rubyruby/setup-ruby with ruby-version: headruby --version, which includes the revision
JVMactions/setup-java with java-version: <next>-eajava -version
.NETactions/setup-dotnet with dotnet-version: <next>.0.x and dotnet-quality: previewdotnet --version
A driver or libraryinstall it at its pre-release tag in the canary job only (npm install <package>@next, pip install --pre <package>), leaving the lockfile as it isthe resolved version in the package manager’s listing

The compiled-binary job uses the same build command and target as the release build (bun build --compile --target=<target>, go build, cargo build --release, dotnet publish), so the canary compiles what production runs, and executes the binary once in a way that must succeed and once in a way that must fail, so the exit-code contract is checked rather than only the start.

Source: modules/M14-testing-strategy/mappings.md

4 · Statuswhat is built, and what is left out on purpose

What the module provides

PieceWhat it is
templates/TESTING.mdA copyable testing strategy: the tier table, the rules, the exemption file and the fixed-delay token
templates/runtime-canary.ymlA scheduled, non-blocking workflow that runs the suites with behaviour pins and the integration tier, then a compiled-binary smoke test, on the runtime’s next release, recording the build it used
reference/tests-with-changes/The gate that fails a changed source file without a test or a registered exemption, and an exemption that matches no file
reference/fixed-delay/The gate that fails a fixed delay without a fixed-delay: <reason> token, a token without a reason, and a token with no delay beside it
reference/poll-until/A polling helper with a hard deadline, a named diagnostic and an injected clock
reference/tests-executed/The skip tripwire: fails a job whose suites executed zero tests, counted from the runner’s report
lib/test-helpers/expect-spawn-exit.tsThe exit-status assertions for a spawned process, which print the child’s output on a mismatch; Jig’s lint rule for the bare shape is tools/quality/grit/no-bare-exit-code-assertion.grit
lib/test-helpers/fake-program.tsA fake gh, git or claude on PATH that works the same way on every platform: the script itself on POSIX, a small executable that runs it under Git Bash on Windows (where a shebang means nothing and a .cmd wrapper is not found by a spawn); with script-argv.ts for running a script, and windows-skip.ts for a skip that names the piece of work lifting it, and a branch inside a test that says why
fix-ci’s fresh-base probeThe runnable form of the triage: reproduces a failing check on a freshly fetched base in a throwaway worktree and says whether the failure is the change’s, pre-existing, or undecidable
mappings.mdPer language and test runner: tier wiring, clock lint rules, polling helpers, builders, type-checked tests, coverage tools, report flags for the skip tripwire, the shape of a behaviour pin, the next-release channel per runtime
maturity criteriaThe criteria the audit skill scores

Each reference piece is a Bun/TypeScript script with a self-test.

Left out by design

  • Live AI-evaluation gates that skip when their secrets are missing. A gate that calls a live model, and exits successfully when the key is not available, reads as a pass on every fork and every misconfigured runner: a false green by construction. An evaluation suite belongs on a schedule with its credentials guaranteed, failing when they are not.
  • Per-file blocking coverage thresholds, for the reasons in core piece 10.
  • A clock lint rule as reference code. The rule depends on the linter (a GritQL plugin, an ESLint selector, a Ruff setting), so mappings.md names the rule per ecosystem instead of shipping one.

Future

  • Flaky-test quarantine: no mechanism for setting a flaky test aside without hiding its failures has been validated yet.
  • A new gate’s first runs repeated before it blocks: a test suite that becomes a gate starts failing changes the moment it runs on every pull request, and a flaky test that never failed in normal use (a race that loses one run in eight) fails someone else’s change. Running the suite several times before the gate is made required would expose those tests while fixing them is still the gate author’s work; no repeat count or procedure has been validated yet.