--- name: delivery-test-first description: > Use when a delivery ticket's acceptance criteria must become Acceptance checks before any implementation exists, or a disputed check or review finding must be judged. Not interactive red-green-refactor -> `tdd`. compatibility: Requires git with push access to the work branch, and a consuming repo carrying docs/agents/delivery.md. Running the new tests needs the repo's test runner on PATH. allowed-tools: Read Write Edit Bash metadata: category: delivery version: "0.2.0" --- ## Gotchas - A new test that passes before the change is vacuous; one that fails on a syntax or import error proves nothing unless the missing import is the change itself. Otherwise only an assertion failure counts as red. - Test what the criterion names, observable from outside. A test pinned to a private name or call sequence becomes a dispute the moment the implementer picks another design. ## Common gates Apply on every flow: - Never read secret material: vault files, vault password files, private keys, `.tfstate`, Secret objects. An Ansible check runs with a placeholder vault password only. - Write only under the repo's test paths. A test outside them is never frozen, so do not write it there — report it under Open questions instead. - Never `--no-verify`, never `SKIP=`. A failing hook is fixed in the commit, not bypassed. - A stop skips Step 3: go straight to Step 4 with the reason quoted; the caller runs `delivery-handoff`'s Stop. Do not label or comment on the tracker yourself. ## Step 1 — Read the repo's delivery doc Read `docs/agents/delivery.md` at the consuming repo's root. Its format is owned by `delivery-repo-doc`'s `references/format.md`; you parse only two sections, items one per line: - `## Contents → skills` — `` - ``: ``, `` `` or `- none`. - `## Test paths` — either the single item `` - globs file: `` `` (read the globs, one per line, from that repo file) or one `` - `` `` per line. File missing, or either section missing or unparseable → stop: "`docs/agents/delivery.md` ". Test paths `- none` → stop: "no test paths in `docs/agents/delivery.md`". ## Step 2 — Dispatch | Condition | Flow | Reference | |---|---|---| | Caller passed a ticket and no dispute | First run | `references/first-run.md` | | Caller passed an implementer's dispute of named tests, or a review round's `[test-author]` findings | Dispute run | `references/dispute.md` | Read only the matched flow's reference — each is self-contained. ## Step 3 — Commit and push Stage only files under the test paths, then check the staged set before committing: ```bash git diff --cached --name-only # bare: the path list is parsed (ADR-0023) ``` Any path outside the test paths → unstage it. Commit exactly once per run, with a Conventional Commits subject and the trailer, then push the work branch you were given: ```bash rtk git commit -m "test: " --trailer "Delivery-Stage: test-author" rtk git push ``` Nothing staged — only post-merge assertions, or every disputed item upheld — → still commit, with `--allow-empty`. CI's test-path check takes the newest trailer commit as the freeze boundary and passes at once when there is none, so a skipped commit leaves the tests unfrozen. A pre-commit hook you cannot satisfy by fixing the test → stop with its output quoted. ## Step 4 — Report Read `references/output-template.md` and return its output to your caller, filled for the flow you ran.