verification-workflow
Use when a change of a Rust service must be proven by the repository's gates before it is called complete, or when a gate stage fails and its owning skill must be found - runs the six CI stage targets
SKILL.mdplugins/rust-backend-sdlc/skills/verification-workflow/SKILL.md
GitHubVerification Workflow
Profile keys consumed
make.ci_list— the read-only target that prints the ordered gate targets, one per line; it runs in the foreground, and null falls back to the repository's documented verification list (step 4).make.ci_preflight— the first stage target; it reads the base ref and runs the configuration check, so it always receivesbase_ref=<sha> CONFIG_CHANGE_APPROVED=.make.ci_static_analysis— the second stage target; it receives no variable but the container suffix.make.ci_tests— the third stage target; it uses the shared test database.make.ci_contracts— the fourth stage target; it reads the base ref, so it always receivesbase_ref=<sha>.make.ci_mutation— the fifth stage target; it uses the shared test database and reads the base ref, so it always receivesbase_ref=<sha>.make.ci_delivery— the sixth stage target; the implementation and review stages record itnot run (deferred to PR CI).make.doctor— the foreground host-prerequisite report attached to everynot run (no Docker)classification.capabilities.run_in_container— true selects container mode (suffix variable, container precondition, container route); false runs every call on the host.make.check_commit_message— the foreground commit-subject check that the background sentence names.make.install_hooks— the foreground hook activation that the background sentence names.make.start— the target the container precondition starts in the background when theappservice is not running.
Repository precedence
Read .claude/skills/verification-workflow/SKILL.md and AGENTS.md first; they win. This skill adds only profile resolution, the evidence format, the bounded loop, the escalation block and the verdict line.
The repository skill names the owning skill of every gate and says what a documentation-only change runs; follow it, and route by its owner list before the table in step 7. Where it asks for the aggregate make ci before completion, run the same stages one per call in the same order instead: the aggregate target only runs the doctor and then loops over those stages, but as one call it can outlive the 600-second foreground limit and hides which stage failed. Write that substitution, and any other difference, into the precedence: line of the evidence. When the repository skill is absent, the Steps apply in full and the evidence records source: plugin instead of source: repo+plugin.
Context
- The gate order belongs to the repository. The target mapped by
make.ci_listprints it at runtime; the stage a gate belongs to is read from the Makefile'sCI_*_TARGETSvariables. Neither list is restated here except as the sourced example in step 4. - The gates run stage by stage, never
make ciin one call. The six stage keys run in the order listed above. The aggregate target also runs a seventh stage, the Makefile's own tests; it has no key in this skill, the plugin never runs it, and its PR check is judged by the finish-pr stage. - A foreground tool call is capped at 600 seconds, and any stage can exceed that on a cold
target/directory, so every stage runs in the background and is polled. - GNU make exits 2 for every failing recipe, so a Docker-less target is recognised by the template's message, never by the exit code.
- The tests and mutation stages share the one compose test database with every other database-backed target (see testing-workflow); stages run one at a time, which keeps that rule.
Task
Prove the current tree by running the repository's gate stages one per call through the profile's stage targets, in the order the repository prints, each backgrounded, logged and polled, in container mode when the profile asks for it. Route each failing gate to the skill that owns its root cause and re-run within a bounded loop; classify a Docker-less target not run (no Docker) with the doctor output instead of remediating it; and report the targets-run list, the evidence block and the verdict line.
Success criteria
- The aggregate
make ciwas never invoked; each non-null stage target ran in its own call, in order, after the gate order was read and quoted. - Every
makecall outside the foreground allowlist ran through the Bash tool withrun_in_background: true, with its log undertarget/rust-sdlc/logs/, and was waited for through the completion notice orcommon.sh wait_log; no trailing&, nonohupand no baresleepappear in the run. - In container mode the container precondition held before the first
maketarget, and everymakecall carried the suffixRUN_IN_CONTAINER=1. - Each stage has one row
<stage target>: passed | failed | not run (<reason>); a Docker-less stage isnot run (no Docker)with the doctor output attached, neverfailed. - Every stage that reads the base ref received
base_ref=<sha>explicitly, and the first stage alsoCONFIG_CHANGE_APPROVED=with an empty value. - No protected file, profile value or gate flag changed to obtain a pass, and no target is reported passed that did not run.
- The evidence block and the verdict line are printed.
Steps
1. Resolve the profile and the base
- Read the twelve keys above from
.claude/rust-sdlc.yml. A missing or unreadable profile stops with the escalation block andrecommended_action: run /rs-sdlc-setup on the default branch and commit the result. - Branch on
capabilities.run_in_container: true selects container mode (step 3, then the suffixRUN_IN_CONTAINER=1on everymakecall); false selects host mode, wherecommand -v cargomust succeed. In host mode with nocargoonPATH, record every stagenot run (no toolchain)(degrade D3) and endESCALATED. - A stage key that is null records that stage
not run (capability absent)(degrade D1); never substitute another target or a raw command for it. - Take the base from the invoking stage: the merge-base sha it computed, or
HEADafter its D24 fallback. Used directly, compute it once withgit merge-base HEAD origin/<default branch>.
2. Run every call outside the foreground allowlist in the background
Every make call except the foreground allowlist make.ci_list, make help, make.check_commit_message, make.doctor, make.install_hooks, and every git commit / git push and bmalph run, runs through the Bash tool with run_in_background: true (never a trailing &), logs to target/rust-sdlc/logs/<stage>-<UTC>.log and is polled with common.sh wait_log at most every 30 s.
- Create the log directory once, in the foreground:
mkdir -p target/rust-sdlc/logs. - Take the UTC stamp in the foreground with
date -u +%Y%m%dT%H%M%SZ;<stage>is the invoking stage id (implement,review,new-context, ...). - Start the call with
run_in_background: trueas the wrapper{ <command>; echo "RUST_SDLC_EXIT=$?"; } > target/rust-sdlc/logs/<stage>-<UTC>.log 2>&1. - Wait for the background-task completion notice. When none arrives (headless runs) and for progress reads, run
common.sh wait_log target/rust-sdlc/logs/<stage>-<UTC>.log(the plugin library's dispatcher). It checks the last line every 30 s for at most 110 s per call, prints the last 40 lines and then eitherRUST_SDLC_EXIT=<n>(exit 0) orWAITING: <log> (<elapsed>s)(exit 1). OnWAITING:call it again at once; it does the waiting itself. - Stop waiting when the invoking stage's time budget is spent: record the stage
failed, quote the log tail and endESCALATED. A poll never outlives the budget. - When the runtime prompts for the wrapper, issue the same call as
<command> > target/rust-sdlc/logs/<stage>-<UTC>.log 2>&1in the background and take the exit status from the completion notice instead of theRUST_SDLC_EXIT=line.
The foreground allowlist and the branch for each key when it is null:
| Foreground call | Used for | When the key is null |
|---|---|---|
make <make.ci_list> |
reading the gate order (step 4) | read the Verification section of AGENTS.md; record the read not run (capability absent) |
make help |
listing the targets when a profile value must be checked against the Makefile | — |
make <make.check_commit_message> COMMIT_TITLE='<subject>' |
the plugin commands' pre-validation of a commit or PR title without a space-hyphen sequence | the commands validate with common.sh is_commit_subject '<subject>' |
make <make.doctor> |
the host-prerequisite report attached to a Docker-less classification (step 5) | the evidence records doctor: not available (capability absent) |
make <make.install_hooks> |
activating the hooks when common.sh hooks_active prints HOOKS: unset |
record not run (capability absent); a stage that must commit then escalates with the hook state |
A stage call as it is issued at the reference template:
mkdir -p target/rust-sdlc/logs
date -u +%Y%m%dT%H%M%SZ
{ make ci-static-analysis RUN_IN_CONTAINER=1; echo "RUST_SDLC_EXIT=$?"; } > target/rust-sdlc/logs/review-20261112T101500Z.log 2>&1
3. Container mode
In container mode, before the first make target, raw container-route call or hooked git call, check docker compose ps --status running --quiet app; empty output starts make.start in the background (≤ 900 s, one restart attempt); docker info failing or the stack not starting is D25.
capabilities.run_in_containertrue:- Probe
docker infoin the foreground. A failing probe is D25: record every stagenot run (no Docker), attach the doctor output of step 5 and endESCALATED. - Check
docker compose ps --status running --quiet app. Non-empty output meansappruns; go on. - Empty output: run
make <make.start> RUN_IN_CONTAINER=1in the background (step 2) and wait at most 900 s. When it exits non-zero, or the check still prints nothing, run it once more (the one restart attempt). A second failure, or a nullmake.start, is D25: every stagenot run (no Docker), the doctor output attached,ESCALATED. - Append
RUN_IN_CONTAINER=1after the target of everymakecall; the prefix form is for hooked git calls only (RUN_IN_CONTAINER=1 git commit -F <file>,RUN_IN_CONTAINER=1 git push -u origin HEAD), which the plugin commands own and this skill never issues. - A raw call of the plugin's short exception list (for example the single raw test call of testing-workflow) goes through the container route
docker compose exec -T --user <uid>:<gid> app <command>, with the uid and gid resolved once byid -uandid -gand written as literals. - An exec that fails because
appstopped mid-run gets the same single restart attempt; a second failure is D25.
- Probe
capabilities.run_in_containerfalse: no suffix and no precondition; the stages run on the host toolchain, and the Docker probe of step 5 still applies.
4. Read the gate order
make.ci_listnon-null: runmake <make.ci_list>in the foreground (with the container suffix in container mode). It prints the ordered gate targets, one per line; quote them in the evidence.make.ci_listnull: read the ordered list from the Verification section of the repository'sAGENTS.mdand record the readnot run (capability absent).Read which gate belongs to which stage from the Makefile, so that a failing gate can be named and routed:
grep -hE '^CI_[A-Z_]+_TARGETS[[:space:]]*:?=' Makefile make/*.mk
The stage membership at the reference template, quoted from its Makefile (re-read the live file, never this block; the last line is the seventh stage, which the plugin never runs):
CI_PREFLIGHT_TARGETS := validate-configuration validate-invariants secrets-scan lint-repo lint-load-tests validate-architecture-model
CI_STATIC_ANALYSIS_TARGETS := format-check validate-manifest check-crate-isolation static-analysis complexity architecture check-security unused-dependencies check-requirements docs-check
CI_TESTS_TARGETS := setup-test-db validate-sqlx-metadata tests-with-coverage doc-tests e2e-tests
CI_CONTRACTS_TARGETS := validate-contract-snapshots validate-openapi-spec openapi-diff graphql-diff
CI_MUTATION_TARGETS := mutation-tests-diff
CI_DELIVERY_TARGETS := build-prod-image image-scan schemathesis-validate smoke-load-tests
CI_CLI_TARGETS := bats
5. Classify a Docker-less target
- In host mode, probe
docker infoin the foreground before the first stage. A failing probe means the Docker-dependent gates cannot run: record every stagenot run (no Docker), run no stage, and go to item 3. - During a stage, the template's message
This target needs a reachable container engine (docker).in the log marks that stagenot run (no Docker), neverfailed, whatever the exit code; the stages after it are recordednot run (no Docker)as well and are not started. - Run
make <make.doctor>in the foreground (with the container suffix in container mode) and attach its output to the evidence and toblocking_finding; a nullmake.doctorrecordsdoctor: not available (capability absent). - A Docker-less classification is degrade D2 (D25 in container mode): the skill ends
ESCALATED. It is never fed to a fix, never retried in a loop and never counted as an iteration.
6. Run the stages one per call
For each stage key in order (make.ci_preflight, make.ci_static_analysis, make.ci_tests, make.ci_contracts, make.ci_mutation, make.ci_delivery):
- Null key: the row is
not run (capability absent); continue with the next stage. make.ci_deliverywhen the invoking stage is the implementation or the review stage: the row isnot run (deferred to PR CI); the finish-pr stage judges those checks on the pull request.- Build the call with no make option and only these suffix variables:
make <make.ci_preflight> base_ref=<sha> CONFIG_CHANGE_APPROVED=(the approval variable always empty);make <make.ci_contracts> base_ref=<sha>andmake <make.ci_mutation> base_ref=<sha>;make <make.ci_static_analysis>,make <make.ci_tests>andmake <make.ci_delivery>with no variable;- plus
RUN_IN_CONTAINER=1on each of them in container mode.
- Run the call in the background (step 2) and wait for its exit line before starting the next stage; never two stages at once.
- Classify:
RUST_SDLC_EXIT=0ispassed; the template's Docker message is step 5; any other non-zero exit isfailed. A stage stops at its first failing gate. The first*** [line of the log names that gate, or the prerequisite inside it that failed (make[1]: *** [<file>:<line>: <gate>] Error <n>); the failing tool's own output sits right above that line. - A
failedstage goes to step 7 before the next stage starts.
The six calls at the reference template, host mode (container mode appends RUN_IN_CONTAINER=1 to each line):
make ci-preflight base_ref=<merge-base sha> CONFIG_CHANGE_APPROVED=
make ci-static-analysis
make ci-tests
make ci-contracts base_ref=<merge-base sha>
make ci-mutation base_ref=<merge-base sha>
make ci-delivery
7. Fix a failing gate within the bound
Route the failing gate to its owner: first by the repository skill's owner list, else by this table.
Failing gate (what it checks) Owner configuration guard (a protected file or directory differs from the base) nobody may fix it in the loop: end ESCALATEDwithrecommended_action: approved-config-change label and a session restarted with ALLOW_PROTECTED_CONFIG_EDIT=1repository invariants, repository lint, documentation drift documentation-sync secrets scan, production-image build and scan security-audit architecture model architecture-model-sync load-script lint, smoke load budget load-testing formatting and strict lint apply the repository's formatter for formatting; lint diagnostics with rust-error-handling or async-runtime-safety complexity complexity-management layer rules, crate isolation architecture-boundary-fixer lockfile against manifests, dependency policy, unused dependencies dependency-policy service configuration check configuration-management test-database setup and migrations, offline query metadata database-migrations unit, documentation, integration and end-to-end tests, coverage, mutation testing-workflow contract snapshots, OpenAPI lint, breaking-change diffs, conformance api-contract-development Fix the root cause with the owning skill; never change the gate, its configuration or the profile.
One iteration is one fix followed by a re-run of the failed stage and then of the stages after it. Log
verification iteration <n>/5: <stage target> (<gate>) -> <result>. The budget is 5 iterations; inside a stage command it is that stage'sMAX_ITERATIONS=5, and the counter is never reset.A fix changes the tree, so once every stage has passed, run once more each stage that passed before the last fix (a confirmation round). A failure in that round starts the next iteration.
A stage still failing after iteration 5/5 ends
ESCALATEDwith the escalation block,blocking_finding: <stage target> -> <gate> (exit <n>), log <path>.
8. Record the result
- Write one row per stage key:
<stage target>: passed | failed | not run (<reason>), the reason from the closed setcapability absent,no Docker,ask rule,no toolchain,skipped by triage,not changed,deferred to PR CI. A call refused by a permission ask rule isnot run (ask rule)and endsESCALATED. - Close out as the repository asks: the targets that ran with their result, the targets that did not run with the reason, and every gate that stayed red with its cause. Never report a target as passed that did not run.
- Print the evidence block and the verdict line of the Verification section.
Constraints
- Never run the aggregate
make ciin one call, and never run two stage targets in one call or at the same time. - Never put a make option before or after the target, and never pass a variable other than
RUN_IN_CONTAINER=1,base_ref=<sha>and the emptyCONFIG_CHANGE_APPROVED=; the approval variable is never given a value. - Never append
&to a make, git or bmalph call, never usenohup, and never wait with a baresleep; wait only through the completion notice orcommon.sh wait_log. - Never run a
makecall outside the five-call foreground allowlist in the foreground. - Never record a Docker-less target as
failed, never remediate it and never retry it in a loop. - Never edit a protected file (the list printed by
cargo xtask config-guard --list), a gate flag or the profile to obtain a pass; a needed protected change endsESCALATED. - Never restate the gate order or the stage membership outside a
# profile-examplefence; read both at runtime.
Verification
Each call left a log with its exit line, and no stage target appears twice in one log (each command prints one line per call):
grep -H '^RUST_SDLC_EXIT=' target/rust-sdlc/logs/<stage>-*.logThe gate order quoted in the evidence equals the current output of the target mapped by
make.ci_list(or theAGENTS.mdlist when that key is null).Nothing protected changed:
git status --porcelainlists no path fromcargo xtask config-guard --list.
Evidence block, printed once at the end:
skill: verification-workflow
source: repo+plugin | plugin
precedence: <repository rule followed instead of a step of this skill | none>
mode: host | container
gate order: <targets in printed order | read from AGENTS.md>
base_ref: <merge-base sha | HEAD (D24)>
targets run:
- <stage target>: passed | failed | not run (<reason>)
failing gate: <gate> -> <owning skill> | none
doctor: <doctor output summary | not run | not available (capability absent)>
logs: <one log path per call>
degrade notes: <one per line | none>
iteration: <n>/5
verification-workflow: SUCCESS | SUCCESS-WITH-REPORT | ESCALATED
The verdict is SUCCESS when every stage the invoking stage runs passed (a delivery row not run (deferred to PR CI) in the implementation or review stage is the designed path, not a note), SUCCESS-WITH-REPORT when the only notes are absent capabilities (not run (capability absent)), and ESCALATED otherwise. A resolved example from a review run:
- ci-preflight: passed
- ci-static-analysis: passed
- ci-tests: passed
- ci-contracts: passed
- ci-mutation: passed
- ci-delivery: not run (deferred to PR CI)
verification-workflow: SUCCESS
When the verdict is ESCALATED, print the canonical block with the invoking stage's id and exit string:
=== SDLC ESCALATION ===
stage: <stage-id of the invoking command>
iteration: <n>/5
exit_condition: <exit string of the invoking stage, verbatim>
status: NOT MET
blocking_finding: <stage target -> gate (exit n), log path | not run (no Docker) with the doctor output>
iteration_log: <one line per iteration: "<n>: <what ran> -> <result>">
recommended_action: <the human action: start Docker, an approved-config-change label, a fix the owning skill could not make>
=== END ===