qfai 1.9.2 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -6
- package/assets/init/.qfai/assistant/README.md +27 -0
- package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/backend-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/completion-reviewer.md +29 -2
- package/assets/init/.qfai/assistant/agents/delivery-planner.md +17 -0
- package/assets/init/.qfai/assistant/agents/frontend-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +17 -0
- package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
- package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +183 -5
- package/assets/init/.qfai/assistant/agents/test-design-analyst.md +22 -3
- package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +2 -2
- package/assets/init/.qfai/assistant/catalog/spec_required_files.json +2 -1
- package/assets/init/.qfai/assistant/catalog/test-layers-ci-lanes.md +60 -0
- package/assets/init/.qfai/assistant/catalog/test-layers.md +430 -13
- package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +165 -0
- package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
- package/assets/init/.qfai/assistant/constitution/constitution.md +1 -1
- package/assets/init/.qfai/assistant/constitution/drift-protocol.md +359 -10
- package/assets/init/.qfai/assistant/constitution/quality.md +35 -5
- package/assets/init/.qfai/assistant/constitution/requirements-decomposition.md +37 -0
- package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +419 -8
- package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +122 -5
- package/assets/init/.qfai/assistant/constitution/workflow.md +53 -7
- package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +439 -946
- package/assets/init/.qfai/assistant/manifest/agent-routing.yml +116 -4
- package/assets/init/.qfai/assistant/manifest/review-profiles.yml +9 -0
- package/assets/init/.qfai/assistant/process/migrations/v1.4.27-atdd-alignment.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +150 -53
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/credential-reuse.md +146 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/red-provenance.md +456 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/review-fix-rounds.md +128 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/scaffolding.md +29 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/shared-test-artifacts.md +96 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/stale-manifest.md +34 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +52 -5
- package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +16 -8
- package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +8 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +2 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +17 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +10 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +5 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +4 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +17 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +11 -3
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +5 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +7 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +14 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +16 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +9 -6
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +2 -0
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +3 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -2
- package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +252 -130
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/change-request-reset.md +93 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +210 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +73 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +291 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +389 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +28 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +49 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/oracle-strength.md +81 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +235 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-admissibility.md +91 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +112 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +87 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +44 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +118 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/selector-granularity.md +24 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/upstream-artifact-ordering.md +33 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +149 -0
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +35 -18
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +106 -7
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +40 -11
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +48 -1
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample +6 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +87 -22
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +148 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +10 -4
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +5 -1
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +4 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +18 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +44 -3
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +60 -7
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +171 -6
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +125 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/db-contract.sample.sql +6 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +92 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/01_Objective.md +27 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/02_Initiative.md +30 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +16 -6
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/06_Glossary.md +19 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/07_Constraints.md +25 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/08_Decisions.md +22 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +37 -10
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +20 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/03_Acceptance-Criteria.md +19 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/04_Business-Rules.md +32 -3
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +56 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/07_Decisions.md +29 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/10_Plan.md +41 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/16_Traceability-ledger.md +58 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +56 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +57 -102
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +24 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/context-load.md +22 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/verify-output-contract.md +48 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/templates/verify-evidence.md +48 -0
- package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +25 -7
- package/assets/init/.qfai/waivers.yml +11 -5
- package/assets/init/root/.github/workflows/qfai-tests.yml +318 -0
- package/assets/init/root/.github/workflows/qfai-validate.yml +327 -24
- package/assets/init/root/DESIGN.md +6 -0
- package/assets/init/root/qfai.config.yaml +15 -12
- package/dist/cli/index.cjs +20646 -13620
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +22101 -15061
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +13954 -8829
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +423 -14
- package/dist/index.d.ts +423 -14
- package/dist/index.mjs +9330 -4224
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -19
|
@@ -17,7 +17,7 @@ roles:
|
|
|
17
17
|
completion-reviewer,
|
|
18
18
|
product-surface-reviewer,
|
|
19
19
|
]
|
|
20
|
-
routing-profile:
|
|
20
|
+
routing-profile: implementation-heavy
|
|
21
21
|
mode: approval-gated
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -31,14 +31,20 @@ QFAI Skill Body (SSOT)
|
|
|
31
31
|
|
|
32
32
|
[DRIFT-PROTOCOL:MANDATORY]
|
|
33
33
|
|
|
34
|
+
## Preconditions
|
|
35
|
+
|
|
36
|
+
- **`.qfai/specs/<spec-id>/tdd/test-list.md` must exist and contain the eight required columns.** It is the ledger every step of this skill reads.
|
|
37
|
+
- **Producer**: `/qfai-sdd` Phase 2b seeds it. Do **not** proceed with an absent ledger and do **not** invent rows that no TC backs.
|
|
38
|
+
- **An empty ledger is a fault only when `06_Test-Cases.md` disagrees.** Never read a header-only table as "nothing to do" on its own. The recovery procedure and the coverage-target test that separates a truthfully empty ledger from an incomplete one are in `references/ledger-preconditions.md`; read it before exiting on an empty ledger.
|
|
39
|
+
|
|
34
40
|
## Spec Auto-Discovery Protocol
|
|
35
41
|
|
|
36
|
-
When no explicit argument is given, detect the candidate
|
|
42
|
+
When no explicit argument is given, detect the candidate specs. Execution is constrained to one spec at a time. Auto-discovery MAY present several specs as a queue to be processed sequentially (see Volume Policy > Multi-spec queue); this protocol does NOT enable multi-spec parallel execution.
|
|
37
43
|
|
|
38
44
|
### User Selection Flow
|
|
39
45
|
|
|
40
46
|
- Single spec: announce the detected spec; ask for confirmation when scope is ambiguous.
|
|
41
|
-
- Multiple specs: display the candidates and require the user to choose one spec.
|
|
47
|
+
- Multiple specs: display the candidates and require the user to choose one spec, or to confirm an ordered queue processed one spec at a time.
|
|
42
48
|
- Zero specs: stop and ask the user to provide the target spec explicitly.
|
|
43
49
|
|
|
44
50
|
## User Questions (AskUserQuestion Protocol)
|
|
@@ -52,15 +58,21 @@ Skill-specific examples:
|
|
|
52
58
|
|
|
53
59
|
## CRITICAL CONSTRAINTS (Read First)
|
|
54
60
|
|
|
55
|
-
- This skill processes **one test at a time** from `test-list.md
|
|
61
|
+
- This skill processes **one test at a time** from `test-list.md`: at most one row is in `red` or `green` at any moment, except under an item-level parallel dispatch authorized by `## Parallelization Policy` below. A T1 row parked in `refactor` waiting for its review group (see Volume Policy) does not violate this.
|
|
56
62
|
- Each item goes through the full TDD micro-cycle: write a **failing test** first, then make it pass, then refactor.
|
|
57
63
|
- The execution ledger is located at `.qfai/specs/<spec-id>/tdd/test-list.md`.
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
+
- Write a `.qfai/steering/<id>.md` work-log entry when this stage hits a condition in the `kind` trigger table of `.qfai/assistant/catalog/worklog-entry.schema.md` — `blocker`, `handoff`, `consultation-needed` and `decision` are the ones it reaches most. `npx qfai validate` polices that surface but nothing else asks for an entry, so an unwritten one is simply lost.
|
|
65
|
+
- Items are processed **serially** by default. Item-level parallel processing inside one spec is allowed only under `## Parallelization Policy` below — both its technical gate and its consent gate must hold, and user approval cannot override a technical DENY. Cross-spec parallelism is never allowed.
|
|
66
|
+
- Status transitions follow a forward-only lifecycle: `todo` -> `red` -> `green` -> `refactor` -> `done`. That spine is not the whole table. `references/execution-ledger.md#allowed-transitions` is the complete and only list; it additionally carries the QA re-entry (`refactor` -> `red`), the resumption (`blocked` -> `todo`), the anomaly exit (`exception` -> `todo`), the reviewer loop (`refactor` -> `review-fix` -> `refactor`) and the approved upstream reset. **Never infer that an edge does not exist from its absence in this summary** — read the reference before writing a `Status` cell.
|
|
67
|
+
- The `exception` status can be reached from any active status when an anomaly is detected, and leaves via `exception` -> `todo` once the anomaly is resolved. That exit needs no Change Request **when the row's approved obligation is unchanged** — nothing upstream moved, so the row simply restarts its cycle, keeping the anomaly's DR-ID, and it is what `TDDLIST_EXCEPTION_PARKED` asks for. **When the investigation finds the obligation itself was wrong**, this exit does not apply: that is an upstream change, and the row re-enters through the approved-Change-Request reset under the Drift Protocol (`references/change-request-reset.md`). Reading this line alone let a row restart on a changed obligation with no approval anywhere.
|
|
68
|
+
- Backward transitions are prohibited (e.g., `green` -> `red` is not allowed). The only exception is an approved Change Request reset (see Status Lifecycle). **"Backward" is the reference's term of art**, not "moves to an earlier status": `blocked` -> `todo`, `exception` -> `todo` and the `qa-gatekeeper` rework edge all return a row to an earlier phase and none of them is backward. `references/execution-ledger.md#allowed-transitions` is the complete list; do not infer an edge's absence from this line.
|
|
69
|
+
- Completed items (`done`) are skipped on re-execution, unless an approved Change Request reset them.
|
|
70
|
+
- When every item is terminal (`done` or a valid `exception`) **and the mandatory Change Request
|
|
71
|
+
preflight (see Required Process) reset nothing**, the per-item work is finished — but the
|
|
72
|
+
**spec-level checkpoint boundary** may still be owed — an interrupted run, or a re-run of an
|
|
73
|
+
already-terminal ledger, leaves it unrecorded. Before reporting "nothing to do" and exiting, confirm fresh spec-level checkpoint verification evidence exists for this ledger state; run the
|
|
74
|
+
per-spec verification first when it is missing or stale (`references/checkpoint-verification.md#spec-level-boundary-on-an-already-complete-ledger`).
|
|
75
|
+
Only then report "nothing to do" for that spec, then advance to the next spec of a confirmed queue; exit when the queue is empty (Volume Policy > Advancing the queue).
|
|
64
76
|
|
|
65
77
|
## Goal
|
|
66
78
|
|
|
@@ -76,78 +88,90 @@ Execute the TDD micro-cycle for each pending item in `test-list.md`, transitioni
|
|
|
76
88
|
|
|
77
89
|
## Non-goals
|
|
78
90
|
|
|
79
|
-
- Writing spec artifacts (use `/qfai-sdd`).
|
|
80
|
-
- Writing acceptance tests (use `/qfai-atdd`).
|
|
91
|
+
- Writing spec artifacts other than this skill's own `tdd/test-list.md` ledger (use `/qfai-sdd`). The ledger's `Status` / `DR-ID` / `Evidence` cells are carved out unconditionally by the Drift Protocol, and its `Test file` / `Selector` cells conditionally — a placeholder may be filled, and a selector that does not resolve against the row's named test file may be repaired, but neither may be rewritten once its condition has ceased to hold, i.e. a `Test file` that names a path and a `Selector` that resolves (`constitution/drift-protocol.md#allowed-exceptions-minimal-whitelist`, which states both conditions); its rows, and the columns carrying their obligation identity, are still upstream. A row whose own test asserts over the CONTENT of an artifact this skill may not write is not implementable here at all, and the three moves available to it all lose: `references/upstream-artifact-ordering.md`.
|
|
92
|
+
- Writing acceptance tests (use `/qfai-atdd`). `Layer = E2E` / `Layer = API` ledger rows are tracked here but their tests are authored there, and the RED provenance those rows carry is defined in `../qfai-atdd/references/red-provenance.md` — this skill writes their `Status` / `DR-ID` / `Evidence` from the evidence that stage produced.
|
|
81
93
|
- Running validation gates (use `/qfai-verify`).
|
|
82
|
-
- Parallel execution across multiple specs simultaneously.
|
|
94
|
+
- Parallel execution across multiple **specs** simultaneously. (Item-level parallelism _within_ one spec is a separate question, governed by `## Parallelization Policy` below.)
|
|
83
95
|
|
|
84
96
|
## Execution Ledger: test-list.md
|
|
85
97
|
|
|
86
|
-
The execution ledger at `.qfai/specs/<spec-id>/tdd/test-list.md`
|
|
87
|
-
|
|
88
|
-
| Column | Description |
|
|
89
|
-
| --------- | -------------------------------------------------------- |
|
|
90
|
-
| TDD-ID | Unique identifier for the TDD item (e.g., TDD-0001) |
|
|
91
|
-
| TC-Refs | References to test cases from `06_Test-Cases.md` |
|
|
92
|
-
| Layer | Test layer (Unit, Integration, etc.) |
|
|
93
|
-
| Test file | Path to the test file |
|
|
94
|
-
| Selector | Test selector/description for targeted execution |
|
|
95
|
-
| Status | Current lifecycle status |
|
|
96
|
-
| DR-ID | Decision Record ID for exception items (blank otherwise) |
|
|
97
|
-
| Evidence | RED/GREEN command+result pairs proving the TDD cycle |
|
|
98
|
-
|
|
99
|
-
### Status Lifecycle
|
|
100
|
-
|
|
101
|
-
Valid status values: `todo`, `red`, `green`, `refactor`, `done`, `exception`.
|
|
102
|
-
|
|
103
|
-
Allowed transitions:
|
|
104
|
-
|
|
105
|
-
- `todo` -> `red` (write a failing test)
|
|
106
|
-
- `red` -> `green` (make the test pass with minimal code)
|
|
107
|
-
- `green` -> `refactor` (improve code quality while keeping tests green)
|
|
108
|
-
- `refactor` -> `done` (item complete)
|
|
109
|
-
- Any active status -> `exception` (anomaly detected; record DR-ID in DR-ID column)
|
|
110
|
-
|
|
111
|
-
Backward transitions are prohibited. Attempting `green` -> `red` must produce:
|
|
112
|
-
`"Backward transition prohibited: green -> red"`.
|
|
98
|
+
The execution ledger at `.qfai/specs/<spec-id>/tdd/test-list.md` is the single record of what this skill has done and may still do. Status values are `todo`, `blocked`, `red`, `green`, `refactor`, `done`, `exception`;
|
|
99
|
+
the lifecycle is forward-only along `todo` -> `red` -> `green` -> `refactor` -> `done` plus the re-entry edges the reference enumerates, an `exception` requires a DR-ID, and a `blocked` row requires a `Blocked-By` and is never selected.
|
|
113
100
|
|
|
114
|
-
|
|
101
|
+
The eight required columns, the allowed transitions and the exception rules are in `references/execution-ledger.md`. Read it before writing to the ledger.
|
|
115
102
|
|
|
116
|
-
|
|
103
|
+
## Required Process
|
|
117
104
|
|
|
118
|
-
|
|
119
|
-
- If the DR-ID column is empty, emit error: `"exception status requires DR-ID in DR-ID column"`.
|
|
105
|
+
### Phase: Stage 0 + Preflight — MANDATORY, runs first
|
|
120
106
|
|
|
121
|
-
|
|
107
|
+
1. Follow `.qfai/assistant/constitution/shared-skill-operating-baseline.md#stage-0---steering-completion-refresh-mandatory`, `#format-ssot-mandatory` and `#delta-rejected-guard-mandatory`, then read `catalog/tech.md` + `catalog/structure.md` and take every Test / Lint / Typecheck / Build command below from `tech.md#standard-commands-copy-paste` rather than inventing one. Refresh both files when the repository contradicts them; do not continue on stale steering. This stage was bound by neither inheritance route while being the one that creates production source trees.
|
|
108
|
+
2. Enumerate the in-scope `.qfai/decisions/CR-*.md` and apply every approved reset per `references/change-request-reset.md` **before** any other ledger judgement — including the all-`done` "nothing to do" exit, which an approved reset invalidates.
|
|
122
109
|
|
|
123
110
|
### Phase: Red (Write Failing Test)
|
|
124
111
|
|
|
125
|
-
1. Read `test-list.md` and select the first
|
|
126
|
-
2. Transition status to `red
|
|
127
|
-
3. Write a **failing test**
|
|
128
|
-
|
|
129
|
-
5.
|
|
112
|
+
1. Read `test-list.md`. **A named row wins**: when the invocation names one or more `TDD-ID`s — `/qfai-atdd` stage gate P1c hands over by id — process exactly those, in the order given, and select nothing else. Row order in the ledger is not a priority: a branch-2 row sitting above the named one would otherwise be picked up first, and its checkpoint runs the full suite against a tree that still holds the named row's deliberate RED, so it fails and lands at `refactor`, which this step does not re-select. Otherwise, **rework first**: if any row is at `review-fix`, select the first such row and resume its rework (`references/round-evidence.md`) before any `todo` row — one left by an interrupted session is otherwise never picked up. Otherwise select the first row with `Status = todo`, skipping any `blocked` row — it cannot be started, and re-issuing it is what made the determination get re-derived every pass (`references/execution-ledger.md#blocked-rows`). **A mutation-only request wins over even that, and moves no row.** `/qfai-atdd` sends one when a stage that owns no ledger row has edited a shared test artifact a completed row reads (`../qfai-atdd/references/shared-test-artifacts.md`): it names, per affected row, that row's spec and `TDD-ID`, the mutation its `Oracle proof` plan or `Satisfied-by` names, and the selector to run under the changed artifact. Apply the mutation, run the selector, capture the failure, **revert in the same step**, re-run for the restored GREEN, and return both. **Write nothing to `test-list.md` and nothing to that row's evidence**: the row stays `done`, no round block opens, and the returned pair is recorded by the requesting stage in its own `## Shared-artifact re-verify` block. This is the only entry that takes a row already at a terminal status, and it takes it read-only — every path below selects `todo`, a named row or `review-fix`, none of which a `done` row can be, so without this the request had no receiver and the requesting stage could never complete.
|
|
113
|
+
2. Transition status to `red` — **only for a `todo` row**, and **not yet for an `E2E` / `API` / `Integration` row**: that row's transition is decided by step 3b, after its handover has been verified, so a missing or malformed one leaves it at `todo` instead of parking a `red` row with no RED behind it. A `review-fix` row **stays at `review-fix`** for the whole rework: it runs steps 3-5 and the Green phase in place, and `review-fix -> red` is not an allowed transition.
|
|
114
|
+
3. Write a **failing test** from the row's obligation column, selected by `Layer`: `TC-Refs` for `Unit` / `Component` / `Integration`, `US-Refs` for `E2E`, `CON-API-Refs` for `API`. An `E2E` or `API` row's test is authored by `/qfai-atdd` (Non-goals); this skill only drives that row's status and evidence once the acceptance test exists, and stops with a handoff note if it does not.
|
|
115
|
+
3a. Create the **minimal seam** the test needs to reach its assertion, with no behaviour behind it. This is not Phase Green's production code: it implements no predicate. Without it, the first failure of any new-symbol row is a resolution error by construction. What the seam is depends on how the test reaches the surface: a **module, export or signature** for a test that imports one, and for an HTTP test a **registered route** — the 404 an unregistered route returns is a resolution error by the same rule, and `/qfai-atdd` hands such a row here for exactly this reason (`../qfai-atdd/references/red-provenance.md#the-three-branches-must`). **Register it with a status the row does not contract for.** When the row's predicate _is_ the status — `201` on create, `204` on delete, `403` on a refusal — a handler that already returns it passes on the first run and the RED is gone; a sentinel the contract does not name (`501`, or `200` where the row owns `201`) resolves the route and still fails the assertion. **A seam-only invocation stops here.** When `/qfai-atdd` calls this skill for the seam alone — the row has no RED yet, which is why it needs one — build the seam, leave the row at `todo`, and return. Do **not** continue to step 3b, and do **not** route `qa-gatekeeper`: there is no assertion failure for it to judge, so a blocking verdict at this point can only be REVISE, and step 3b would read the row's entry as malformed for lacking the RED this trip exists to make possible. The blocking gate applies to the handoff that follows, once that stage has taken the RED against the seam.
|
|
116
|
+
3b. **A `todo` `E2E` / `API` / `Integration` row consumes the provenance `/qfai-atdd` recorded; steps 4 and 5 do not apply to it.** A `review-fix` row does **not** come here — a reviewer's REVISE needs a fresh round, not the original handoff replayed, and its status is neither `todo` nor transitionable to one. Run it through `references/round-evidence.md`, **and hand the acceptance test back to `/qfai-atdd` first when the REVISE asks for a change to it**: this skill does not author those tests (Non-goals) and its `red` phase has no `acceptance-test-engineer`, so a rework that needs the test edited has nobody here to do it — the row would sit at `review-fix` or a production agent would edit a test it does not own. That stage returns the corrected test and its new RED; the production fix and the re-review happen here. **A handback naming a new `Selector` or `Test file` is written to both the ledger and the entry's identity copy before the re-review** — updating one alone leaves gate item 10 comparing a changed value with an unchanged one, which it fails by construction. **A returned proof marked `stale — test replaced` is re-taken here too**, before the re-review: the corrected test passed on the first run, so what is owed is not a RED but the evidence that it still fails when its predicate is broken. **Which field names that predicate depends on the row's branch** — `Satisfied-by` on a `falsifiability` row, the `Oracle proof` plan on an `observed-red` one, which has no `Satisfied-by` at all. Reading `Satisfied-by` unconditionally left a branch-1 row with nothing to re-run and stranded it at `review-fix`. Re-run that mutation under the corrected selector, **write the re-taken proof and, in `Replacement proof revision`, the tree it ran against — the field arrives marked `test-only replacement` and empty, because that stage owns no mutation and could not have taken it. Leave `RED revision` alone**: on an `observed-red` row it addresses the natural RED the round block still describes, and overwriting it hashed two trees as one observation — route `qa-gatekeeper` on it as step 3c does, then revert and re-run for the GREEN. That stage marks the proof rather than re-taking it because the mutation is production work it owns no agent for. For a `todo` row, verify its entry in `.qfai/evidence/atdd-<spec-id>.md` **first**, then write the status the verified branch calls for, per `../qfai-atdd/references/red-provenance.md#handover-to-qfai-implement`: `observed-red` and `falsifiability` write `todo -> red` and continue at Phase Green; `exception` writes `todo -> exception` with the recorded `DR-*` **and only when the entry carries the `qa-gatekeeper` PASS P1d took on that `DR-*`** — this path skips steps 4 and 5, so nothing here judges the claim and a row with no verdict would reach a terminal status unexamined; an entry without it goes back with a handoff note. It **does not** enter Phase Green; a `falsifiability` entry whose branch is named but whose evidence is not complete goes to **step 3c** — and **complete means the trio _and_ the recorded `qa-gatekeeper` PASS on it**, not the trio alone. Step 3c writes the trio and only then routes the gatekeeper, so an interrupted run, or one that ended at REVISE, leaves a trio with no verdict; reading the trio alone as verified sent the row to `todo -> red` on mutation evidence no gate had judged, and step 3c is the only place that submits it. A trio with no PASS re-enters step 3c at the point the verdict is taken: re-apply the mutation, re-run the selector, **write the re-taken trio, `RED test hash`, manifest and `Falsifiability revision` over the recorded ones**, and only then route the gatekeeper. The same "entry complete before the gate sees it" rule as the first pass, and for the same reason: after a REVISE the mutation or the test has usually changed, so a gatekeeper reading the current tree while hashing the previous entry either repeats the REVISE or records a PASS that describes neither run; an entry that is absent, names no branch, or is malformed in any other way leaves the row at `todo` and stops with a handoff note. Steps 4 and 5 are skipped because re-running the test here passes — an `observed-red` row's surface is built in Phase Green, a `falsifiability` row's already exists — and treating that as step 5's unexpected pass is what sent correctly evidenced rows to `exception`.
|
|
117
|
+
3c. **A `falsifiability` entry with no evidence yet: take it here.** The mutation rewrites a production predicate, which `/qfai-atdd` owns no agent for — so it names the predicate to break and hands the row over rather than running it (`../qfai-atdd/references/red-provenance.md#the-three-branches-must`). Delegate it in this phase, which is why the production owners are routed here. **In this order**, because the gatekeeper's ownership check reads the mutated tree: apply the mutation, run **each entry of** this row's `Selector` separately and capture each failure — a `Selector` may legally hold a comma-separated list or a glob, and one aggregate run shows the first entry failing while the rest are unobserved, which is the same rule step 4 applies to a RED and which `qa-gatekeeper` enforces on both. Record the trio per entry, or split the row before the handoff, and **write the entry complete before the gate sees it** — `Round 1: Satisfied-by`, `Round 1: Falsifiability command`, `Round 1: Falsifiability result` — the trio takes the RED pair's place inside the round block, so it takes the prefix too (`references/round-evidence.md`) — and the `RED failure mode: falsifiability`, and — as `Round N:` fields of the round this mutation belongs to, never row-level, because a blocking REVISE opens a round on its own tree and one field cannot hold two of them (`references/round-evidence.md` decides this and nothing else restates it) — `RED test hash` and its manifest, and `Falsifiability revision` — **the mutated tree's address, taken here because the revert destroys it** — in that row's entry in `.qfai/evidence/atdd-<spec-id>.md`. **Then route `qa-gatekeeper` on that mutation run.** The gatekeeper hashes the phase-authored entry for its `Audited evidence hash`, and every one of those fields is inside that subject, so writing any of them afterwards made a correct PASS stale the moment it was recorded. **Revert and re-run for the GREEN once the gatekeeper has answered — whatever it answered.** `Round 1: Revision` is written from **that** run, not from the mutated tree: it is the address items 5, 7 and 8 share, the revert moves it by construction on an uncommitted tree, and recording it before made every correct branch-2 row stale on arrival. The mutated tree has its own field. A REVISE left the deliberately broken predicate in the working tree, and step 3b readmits such a row and re-applies the mutation, so the next run either broke an already-broken tree or carried the damage into whatever came next. The revert is cleanup, not a reward for PASS. Reverting first left it nothing to inspect but the restored tree, so it could not confirm that what was broken is the predicate `Satisfied-by` names — the one check that distinguishes a falsifiability trio from a test that would pass against anything. Record the `RED test hash` and its manifest here too, over the same inputs a handed-over RED hashes: this run is where this skill first executes the row's selector, and the completion gate recomputes the hash for **every** handed-over `E2E` / `API` / `Integration` row. **And `Falsifiability revision`, taken before the revert** by the procedure in `references/evidence-revision.md` — it addresses the mutated tree, which stops existing at the revert, so this is the only moment it can be taken and gate item 10 requires it on every `falsifiability` row. Steps 4 and 5 are skipped for this row and step 4 is the only place that submits a RED, so without this the branch advanced the ledger with no observation verdict at all — and the gatekeeper is conditional in this phase, so nothing selected it by default. On PASS write `todo -> red` from the mutation run; and continue at Phase Green with the restored run as its GREEN — Phase Green step 2a does **not** repeat it, because this mutation _is_ the row's `Oracle proof`. Deferring the row instead is what left nobody able to perform the first mutation: this step waits for evidence 3b would only accept after it existed. **Reached from step 3b, never before it.** Listed ahead of 3a/3b, an ordered read ran the production mutation and wrote `todo -> red` before 3b had checked the entry's branch, its selector and its missing fields — advancing the ledger on provenance nobody had verified.
|
|
118
|
+
4. Run the test and **watch it fail**. Admissible only when an assertion — or an expected-exception check — inside this row's `Selector` raised the failure and its message names the predicate the row owns; a collection / import / syntax / fixture error, or an unasserted throw, is a **missing seam**, not a RED (`references/red-admissibility.md`). Observe each `Selector` entry's failure separately; one aggregate run is not a valid RED observation. Submit that run to `qa-gatekeeper` and obtain confirmation **before** any production code exists — routing phase `red`.
|
|
119
|
+
5. If the test unexpectedly passes, classify **why** before doing anything else. An obligation
|
|
120
|
+
already satisfied by a sibling row is **not an anomaly** and does **not** go to `exception`;
|
|
121
|
+
anything else transitions to `exception` and records the anomaly as `.qfai/decisions/DR-<id>-<slug>.md` — never in
|
|
122
|
+
`07_Decisions.md` / `09_delta.md`, which are upstream SSOT this skill may not patch. Never weaken a correct
|
|
123
|
+
test until it fails in order to manufacture a RED. See `references/red-not-observable.md`.
|
|
124
|
+
> **RED observation is only as good as the selector's granularity.** A single test function can fail
|
|
125
|
+
> only once, so if one selector entry carries an entire obligation matrix, "the expected reason" is
|
|
126
|
+
> whichever assert happens to execute first — every assertion after it is unobserved on every RED
|
|
127
|
+
> run, and a non-deterministic assertion placed early silently disables everything below it. A TDD
|
|
128
|
+
> row whose selector accumulates unrelated boundaries therefore **invalidates its own RED
|
|
129
|
+
> observation**. Split the row per `#selector-granularity-must` before continuing; do not proceed to
|
|
130
|
+
> Green.
|
|
130
131
|
|
|
131
132
|
### Phase: Green (Make It Pass)
|
|
132
133
|
|
|
133
|
-
1. Write the **minimum production code** to make the failing test pass.
|
|
134
|
-
2. Run the test and **watch it pass**.
|
|
135
|
-
|
|
134
|
+
1. Write the **minimum production code** to make the failing test pass. On the _RED not observable_ path there is none to write — the `Satisfied-by` row already implements the predicate — so go straight to step 2.
|
|
135
|
+
2. Run the test and **watch it pass**. Do not submit it yet: `qa-gatekeeper` requires an `Oracle proof` on every item, so a GREEN submitted before step 2a has produced one is a REVISE by construction — and the `build` phase is blocking, so that REVISE is what blocks the step meant to produce the proof. Take the proof first (2a), then submit the pass and the proof together for the GREEN confirmation — routing phase `build`, which is blocking for the same reason `red` is.
|
|
136
|
+
2a. **Run the `Oracle proof` and record it here, before the submission in step 2.** Apply the named production mutation, run this row's selector, capture the failing output verbatim, then **revert the mutation immediately** and re-run to confirm the tree is green again — that restored run is the GREEN the gatekeeper is given. Completion item 5 and `references/oracle-strength.md` require the command and its real failing output, not an intention — an `observed-red` row handed over by `/qfai-atdd` arrives with the mutation _planned_ and nothing run, because there was no production code to mutate until this phase built it. A row on the _RED not observable_ path already has one: its falsifiability run **is** the Oracle proof, and must not be repeated. Record `equivalent-mutant` instead only when no mutation can distinguish the behaviour, with the weaker contract clause named.
|
|
137
|
+
3. Transition status to `green` — **only for a row that entered from `todo`**. A `review-fix` row stays at `review-fix` here too; `review-fix -> green` is not an allowed transition and must not be written to the ledger.
|
|
136
138
|
4. If the test still fails after implementation, investigate and fix. Do not skip to refactor.
|
|
137
139
|
|
|
138
140
|
### Phase: Refactor
|
|
139
141
|
|
|
140
|
-
1. Improve code quality (naming, structure, duplication removal) while keeping all tests green.
|
|
141
|
-
2. Run the
|
|
142
|
+
1. Improve code quality (naming, structure, duplication removal) while keeping all tests green. **Before editing a production file**, check whether another spec's `tdd/test-list.md` names it in `Test file`; if so the edit is cross-spec — record it in this item's evidence and re-run `completion-reviewer` against that spec's obligations too (`references/cross-spec-ownership.md`).
|
|
143
|
+
2. Run the **relevant test suite** to confirm nothing broke. "Relevant" means the
|
|
144
|
+
smallest selector that covers the module you touched **plus its reverse
|
|
145
|
+
dependency closure** — walk the production import graph backwards, not just the
|
|
146
|
+
test files that import the module directly. Fall back to the package containing
|
|
147
|
+
the touched module whenever that walk cannot be completed; never "every test in
|
|
148
|
+
the repository" at this step. Cadence: **narrow suite per item, full suite at
|
|
149
|
+
each checkpoint boundary**, because a full run per item is quadratic in ledger
|
|
150
|
+
size. Full rules, the fallback triggers and the boundary list:
|
|
151
|
+
`references/relevant-test-suite.md`.
|
|
142
152
|
3. Transition status to `refactor`.
|
|
143
|
-
4. Submit for completion review (`completion-reviewer`) and code quality review
|
|
144
|
-
|
|
153
|
+
4. Submit for completion review (`completion-reviewer`) and code quality review
|
|
154
|
+
(`implementation-reviewer`). A T1 row submits with its coherent group and stays in
|
|
155
|
+
`refactor` until the group closes (Volume Policy > Group formation).
|
|
156
|
+
5. After all routed blocking reviewers return PASS, run checkpoint verification
|
|
157
|
+
**while the item is still `refactor`** (see `#checkpoint-verification`). On a
|
|
158
|
+
checkpoint boundary that means the full suite. Off a boundary it is already
|
|
159
|
+
satisfied by step 2's narrow suite — nothing is re-run. Transition to `done`
|
|
160
|
+
only on PASS; on failure transition to `exception` with a DR-ID (legal from
|
|
161
|
+
`refactor`, whereas re-opening a `done` row is not). For a T1 group every member
|
|
162
|
+
transitions in the same ledger write.
|
|
145
163
|
|
|
146
164
|
### Completion
|
|
147
165
|
|
|
148
|
-
1. After processing all items, update `test-list.md` with final
|
|
166
|
+
1. After processing all items, update `test-list.md` with final Status, DR-ID and Evidence values — the three cells the Drift Protocol carve-out covers unconditionally, and the ones gate item 10 reads. `Test file` and `Selector` are covered too, but only while their stated condition still holds, so fill a placeholder or repair an unresolvable selector when you reach it rather than at the end.
|
|
149
167
|
2. If all items are `done`, report "All items complete".
|
|
150
|
-
3. If some items are `exception`, report them
|
|
168
|
+
3. If some items are `exception`, report them as **blocking output**, not as an
|
|
169
|
+
informational list: for each, the `TDD-ID`, the `DR-ID`, and whether that DR
|
|
170
|
+
is a user-approved accepted-risk waiver. Completion cannot be declared while
|
|
171
|
+
any `exception` row lacks such a waiver.
|
|
172
|
+
4. If a multi-spec queue was confirmed, announce the next queued spec and restart at
|
|
173
|
+
Phase: Red with its ledger; exit only after the last entry (Volume Policy >
|
|
174
|
+
Advancing the queue).
|
|
151
175
|
|
|
152
176
|
## Sub-agent Delegation (MANDATORY)
|
|
153
177
|
|
|
@@ -158,18 +182,21 @@ Follow `.qfai/assistant/constitution/shared-skill-delegation-baseline.md`.
|
|
|
158
182
|
- Orchestrator MUST NOT write test or production code directly; delegate every TDD phase to the routed implementation agents.
|
|
159
183
|
- Additional implement-specific overrides:
|
|
160
184
|
- read `test-list.md`, determine the next pending item, and delegate each TDD phase;
|
|
161
|
-
- update `test-list.md`
|
|
185
|
+
- update `test-list.md` **Status and Evidence** after each phase completes, recording the delegated agent's one-word RED/GREEN outcome plus the anchor into the evidence file the row's `Layer` owns — `.qfai/evidence/implement-<spec-id>.md`, or `.qfai/evidence/atdd-<spec-id>.md` for an `E2E` / `API` row, whose RED was produced by the stage that authored its test (gate item 10) — and that agent's command+result verbatim in the evidence file itself — a GFM cell cannot hold either a newline or a bare `|` (`references/execution-ledger.md#evidence-cell-contract`). Gate item 10 requires both columns, the protocol permits both, and the orchestrator is the only role permitted to write this file (`references/parallelization-policy.md#ledger-ownership`).
|
|
162
186
|
|
|
163
187
|
### Formal Sub-agent Roster
|
|
164
188
|
|
|
165
|
-
This skill delegates through the centralized routing policy in `.qfai/assistant/manifest/agent-routing.yml`.
|
|
189
|
+
This skill delegates through the centralized routing policy in `.qfai/assistant/manifest/agent-routing.yml`. Its `red`, `build`, `test` and `review` phases carry `iteration: per-ledger-item` — they run once **per row**, not once per invocation, which is what puts `qa-gatekeeper` in a phase where a RED state still exists to observe.
|
|
166
190
|
|
|
167
191
|
- `delivery-planner`
|
|
168
|
-
- reads `test-list.md`, selects the next pending item,
|
|
192
|
+
- reads `test-list.md`, selects the next pending item, and is the sole authority for **item selection and item scope** — whether this row's selector is a sufficient slice of the obligation its `Layer` names — `TC-Refs` for `Unit` / `Component` / `Integration`, `US-Refs` for `E2E`, `CON-API-Refs` for `API`
|
|
193
|
+
- enforces Red-Green-Refactor **ordering** (which phase may run next), not the RED/GREEN observation itself
|
|
194
|
+
- is the sole authority for parallel dispatch decisions
|
|
169
195
|
- `frontend-engineer` / `backend-engineer`
|
|
170
196
|
- implement the selected item only, write the failing test first, write minimal passing code, and refactor without unrelated changes
|
|
171
197
|
- `qa-gatekeeper`
|
|
172
|
-
- is the sole authority for validating RED/GREEN observation evidence and completion gate evidence
|
|
198
|
+
- is the sole authority for validating **RED/GREEN observation evidence** — did the test fail (or pass) for the expected reason — and completion gate evidence. Routed per row in `red` (before production code) and `build` (after), not only in `review`
|
|
199
|
+
- does not adjudicate item scope; a scope objection is `delivery-planner`'s call
|
|
173
200
|
- `implementation-reviewer`
|
|
174
201
|
- reviews code quality, maintainability, backend correctness, and hidden coupling
|
|
175
202
|
- `completion-reviewer`
|
|
@@ -177,16 +204,42 @@ This skill delegates through the centralized routing policy in `.qfai/assistant/
|
|
|
177
204
|
- `product-surface-reviewer`
|
|
178
205
|
- reviews UI-affecting implementation when the item changes surface behavior
|
|
179
206
|
|
|
207
|
+
## Volume Policy (MUST)
|
|
208
|
+
|
|
209
|
+
Scale the ceremony to the ledger: derive a **risk tier** per row, **batch** T1 gatekeeping and
|
|
210
|
+
reviews per coherent BR/AC group, process multiple specs as a **sequential queue**, state the
|
|
211
|
+
implied **cost** before starting. The tier scales how **often** a gate runs, never **whether** it
|
|
212
|
+
runs: `agent-routing.yml` keeps `qa-gatekeeper`, `completion-reviewer` and
|
|
213
|
+
`implementation-reviewer` all mandatory (only the first two are in `blocking_agents`, but item 8 of
|
|
214
|
+
the 11-point gate makes an `implementation-reviewer` REVISE block `done` anyway), and criticality
|
|
215
|
+
(authz, crypto, money, data integrity) forces T2 regardless of layer. Why this exists, the tier
|
|
216
|
+
table, the group-formation transitions and the queue-advance steps: `references/volume-policy.md`.
|
|
217
|
+
|
|
180
218
|
### Handoff Contracts
|
|
181
219
|
|
|
182
220
|
All agent-to-agent transitions follow these contracts:
|
|
183
221
|
|
|
184
222
|
1. `delivery-planner` selects the next item and assigns it to the appropriate implementation agent.
|
|
185
|
-
2. Implementation agent submits RED
|
|
186
|
-
3. `qa-gatekeeper` confirms or rejects
|
|
187
|
-
4. After
|
|
223
|
+
2. Implementation agent submits the RED run to `qa-gatekeeper` **while no production code exists** (routing phase `red`), then the GREEN run after it (routing phase `build`). One combined post-hoc submission is not a substitute: RED is unrecoverable once Green begins, so it leaves nothing but the implementer's own account of a destroyed state — the self-attestation this gate exists to prevent. It **returns it to the orchestrator in the per-item evidence contract's form** so it can be written to the ledger. The implementation agent never writes `test-list.md` itself.
|
|
224
|
+
3. `qa-gatekeeper` confirms or rejects each observation. A RED rejection stops the row before Green; it does not wait for the `review` phase.
|
|
225
|
+
4. After the item reaches `refactor`, implementation agent submits it to `completion-reviewer` for spec alignment and to `implementation-reviewer` for code quality review. Review is requested from `refactor`, never from `green`, so a `REVISE` always lands on the one status with an outbound `review-fix` edge.
|
|
188
226
|
5. `product-surface-reviewer` is added when the item affects UI behavior or rendered output.
|
|
189
|
-
6. Only after
|
|
227
|
+
6. Only after every required reviewer passes may the item transition to `done`. "Required" is wider than `blocking_agents`: `implementation-reviewer` is mandatory and its `REVISE` blocks `done` independently of that list, and `product-surface-reviewer` joins for UI-affecting items. The authority for an item transition is `#item-completion-checklist-12-point-gate`, not the routing list, which governs phase progression (`references/volume-policy.md#routing-is-unchanged`).
|
|
228
|
+
7. For T1 rows the submitted unit in steps 2-4 is the coherent group, not the row; every required reviewer still runs, once per group. T2/T3 rows submit alone.
|
|
229
|
+
|
|
230
|
+
#### Precedence between `delivery-planner` and `qa-gatekeeper`
|
|
231
|
+
|
|
232
|
+
The two roles answer different questions and are ordered, not concurrent:
|
|
233
|
+
|
|
234
|
+
- `delivery-planner` answers _is this item's scope sufficient to be the whole of its `TC-*` obligation_.
|
|
235
|
+
- `qa-gatekeeper` answers _did the test fail (or pass) for the expected reason_.
|
|
236
|
+
|
|
237
|
+
Precedence rules:
|
|
238
|
+
|
|
239
|
+
- A `delivery-planner` REVISE on item scope MUST be resolved **before** RED evidence is submitted to `qa-gatekeeper` (step 2). Do not run step 2 while a scope REVISE is open.
|
|
240
|
+
- Once `qa-gatekeeper` PASSes the observation for a RED round, item scope MUST NOT be re-litigated for that round. A newly discovered scope gap opens a **new** `test-list.md` row rather than reopening the passed one.
|
|
241
|
+
- If a scope objection nonetheless arrives after step 3, it is treated as a new-row request; the existing PASS stands and is not discarded.
|
|
242
|
+
- Neither role may overrule the other inside the other's domain: a `qa-gatekeeper` PASS never widens item scope, and a `delivery-planner` verdict never substitutes for RED/GREEN observation evidence.
|
|
190
243
|
|
|
191
244
|
### Capability Probe (MUST)
|
|
192
245
|
|
|
@@ -195,11 +248,11 @@ All agent-to-agent transitions follow these contracts:
|
|
|
195
248
|
### Delegation Failure (Hard Stop)
|
|
196
249
|
|
|
197
250
|
- No additional overrides.
|
|
198
|
-
- Do not simulate roles.
|
|
251
|
+
- Do not simulate roles. Classify the failure per the baseline taxonomy first: `unavailable` stops the stage with a remediation report; `saturated` uses the bounded retry branch and keeps the stage open.
|
|
199
252
|
|
|
200
253
|
## Work Orders Summary
|
|
201
254
|
|
|
202
|
-
Use the shared schema (per-row `Status (PASS/REVISE)` column, reviewer response `Result: PASS | REVISE`).
|
|
255
|
+
Use the shared schema (per-row `Status (PASS/REVISE/PENDING)` column, reviewer response `Result: PASS | REVISE`).
|
|
203
256
|
|
|
204
257
|
### Reviewer Gate (MUST)
|
|
205
258
|
|
|
@@ -209,34 +262,42 @@ Use the shared schema (per-row `Status (PASS/REVISE)` column, reviewer response
|
|
|
209
262
|
- Test volume floors/ratios are not gates; they are signals.
|
|
210
263
|
- Do not declare DONE until Reviewer returns `PASS`; otherwise apply `REVISE`.
|
|
211
264
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- **Default**: Serial execution. Items are processed one test at a time in `test-list.md` order.
|
|
215
|
-
- **Exception**: When items target completely independent SUT modules with no shared state, parallel processing may be used with explicit user approval.
|
|
216
|
-
- Serial execution ensures that each test is written and verified in isolation before moving to the next.
|
|
217
|
-
- `delivery-planner` is the sole authority for authorizing parallel dispatch.
|
|
265
|
+
#### Blocking vs advisory findings
|
|
218
266
|
|
|
219
|
-
|
|
267
|
+
Follow `shared-skill-delegation-baseline.md#finding-provenance-must`.
|
|
220
268
|
|
|
221
|
-
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
|
|
269
|
+
- Only **blocking** findings force `REVISE` and hold an item out of `done`. An **advisory**
|
|
270
|
+
finding (`Traces to: none`) MUST NOT be implemented as production code or pinned as a test
|
|
271
|
+
assertion; route it per `drift-protocol.md#reviewer-originated-obligations`.
|
|
272
|
+
- Do **not** edit `08_Open-questions.md` here — it is upstream SSOT under the Drift Protocol and
|
|
273
|
+
creating spec artifacts is a non-goal of this skill; the owner phase (`/qfai-sdd`) records and
|
|
274
|
+
adjudicates it.
|
|
275
|
+
- What each class cites, when an advisory takes the Change Request path, and why an advisory-only
|
|
276
|
+
review still returns `PASS`: `references/finding-classification.md`.
|
|
227
277
|
|
|
228
|
-
|
|
278
|
+
## Parallelization Policy
|
|
229
279
|
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
-
|
|
233
|
-
|
|
234
|
-
|
|
280
|
+
- **Cross-spec parallelism is barred.** One spec per invocation, always. This
|
|
281
|
+
is the Non-goal above and it is not approvable.
|
|
282
|
+
- **Item-level parallelism inside one spec** may be authorized. Two gates apply
|
|
283
|
+
and **both must hold**: a technical gate adjudicated by `delivery-planner`
|
|
284
|
+
(the sole authority), and explicit user approval. **User approval cannot
|
|
285
|
+
override a technical DENY.**
|
|
286
|
+
- **Default**: Serial execution, one test at a time in `test-list.md` order.
|
|
287
|
+
- The allow/deny conditions are stated as **concurrent write conflicts** —
|
|
288
|
+
including one item writing a module another item's test or implementation
|
|
289
|
+
reads — not as the existence of shared things, and authorized parallel runs
|
|
290
|
+
use the coordinated mode in which the orchestrator owns every `test-list.md`
|
|
291
|
+
write. Under RED-first the source modules do not exist when `delivery-planner` must judge, so the conditions are evaluated over each row's declared `Owning module` (`references/execution-ledger.md`); a ledger without that column supports parallel dispatch only for seams that already exist. Full rules: `references/parallelization-policy.md`.
|
|
292
|
+
- `parallel_groups: []` in `agent-routing.yml` describes **role fan-out within
|
|
293
|
+
a phase**, not item dispatch.
|
|
235
294
|
|
|
236
295
|
### Post-parallel integration verify
|
|
237
296
|
|
|
297
|
+
- **Reconcile the ledger first.** Under worktree separation each worker holds a private copy of `test-list.md`, so the merged trunk carries none of their transitions. Write Status + Evidence for every merged item from the worker reports **before** integration verify, and fail the verify if any merged item's row is still `todo` — an unreconciled ledger reports finished work as unstarted (`references/parallelization-policy.md#ledger-ownership`).
|
|
238
298
|
- After parallel slices complete and merge, run integration verify on the merged result
|
|
239
|
-
-
|
|
299
|
+
- Then reconcile the seams: diff each slice's touched `src/` paths against its declared `Owning module` and report undeclared or overlapping paths as a deny-condition breach — **independently of whether the merged suite is green** (`references/parallelization-policy.md#seam-reconciliation-after-a-parallel-run`)
|
|
300
|
+
- If integration verify fails, re-run it once with no intervening change before acting. A failure that does **not** reproduce is an `environment/tooling` finding (`shared-skill-operating-baseline.md#nondeterministic-gates`), reported with every run — not a rollback trigger. For a reproducible failure, **classify before acting** per `shared-skill-operating-baseline.md#gate-failure-autorepair-protocol`, attributing it to one slice, to the merge resolution, or to code outside every slice. Remedies by class: `references/parallelization-policy.md#failed-integration-verify`. Unconditional rollback is not one of them — the protocol classifies this as a local, non-destructive defect to fix and re-run, and reserves stopping for destructive changes. Only a **reproducible** failure flags all slices for re-examination and rolls back the merge, and only where the classification calls for it
|
|
240
301
|
- If integration verify passes, state transitions back to `delivery-planner` for sequential flow
|
|
241
302
|
|
|
242
303
|
## Completion Contract (Shared)
|
|
@@ -244,91 +305,152 @@ Use the shared schema (per-row `Status (PASS/REVISE)` column, reviewer response
|
|
|
244
305
|
Follow `.qfai/assistant/constitution/shared-skill-operating-baseline.md#completion-contract-shared`.
|
|
245
306
|
Follow `.qfai/assistant/constitution/shared-skill-operating-baseline.md#gate-failure-autorepair-protocol` for validate, doctor, and quality-gate failures.
|
|
246
307
|
|
|
247
|
-
### Item completion checklist (
|
|
308
|
+
### Item completion checklist (12-point gate)
|
|
248
309
|
|
|
249
|
-
An item in `test-list.md` may transition to `done` only when ALL of the following are satisfied
|
|
310
|
+
An item in `test-list.md` may transition to `done` only when ALL of the following are satisfied. For T1 rows, items 3, 5, 7 and 8 are satisfied by the confirmation covering the row's coherent group; they are never waived.
|
|
250
311
|
|
|
251
312
|
1. Corresponding `TDD-ID` has been selected and is in progress
|
|
252
|
-
2. A failing test was added first (test-first)
|
|
253
|
-
3. RED was observed — `qa-gatekeeper` confirmed
|
|
254
|
-
4. Minimal production code was written to make the test pass
|
|
255
|
-
5. GREEN was observed — `qa-gatekeeper` confirmed the test passes after implementation (watch it pass)
|
|
313
|
+
2. A failing test was added first (test-first) — **or**, on the _RED not observable_ path, the correct test was added first and proven falsifiable by mutation instead of by a natural failure
|
|
314
|
+
3. RED was observed — `qa-gatekeeper` confirmed an **admissible** failure: an assertion or expected-exception check inside the row's `Selector`, not a load or fixture error (`references/red-admissibility.md`), **or** the row carries falsifiability evidence per _RED not observable_
|
|
315
|
+
4. Minimal production code was written to make the test pass — **waived** on the _RED not observable_ path, where the `Satisfied-by` row already implements the predicate; do not manufacture a change to satisfy this item
|
|
316
|
+
5. GREEN was observed — `qa-gatekeeper` confirmed the test passes after implementation (watch it pass) **and** that the pass depends on this item's behaviour: `Oracle proof` records a production mutation that made the test fail again, or `equivalent-mutant` naming the weaker contract clause (`references/oracle-strength.md`). Exit code 0 alone does not distinguish a discriminating test from one that cannot fail
|
|
256
317
|
6. Refactor was performed and GREEN was re-confirmed after refactor
|
|
257
318
|
7. `completion-reviewer` returned PASS (spec / completion review gate)
|
|
258
319
|
8. `implementation-reviewer` returned PASS (code quality review gate)
|
|
259
320
|
9. UI-affecting items have prototype parity PASS from `product-surface-reviewer`
|
|
260
|
-
10. `test-list.md` Status and Evidence
|
|
261
|
-
11.
|
|
321
|
+
10. `test-list.md` Status is current and its Evidence cell's anchor resolves to a fresh per-item entry in the evidence file its `Layer` owns — `.qfai/evidence/implement-<spec-id>.md`, or `.qfai/evidence/atdd-<spec-id>.md` for an `E2E` / `API` / `Integration` row, whose RED provenance was produced by the stage that authored its test — `/qfai-atdd` owns all three, because `QFAI-ATDD-112` puts every `L3` and undeclared-`Level` TC in `tests/integration/**` and its P4 writes those tests (`references/execution-ledger.md#atdd-owned-rows`). **Compatibility:** an `E2E` / `API` row that reached `done` or `review-fix` before this split has its evidence and anchor in `implement-<spec-id>.md`, which was the contract at the time. **Identify it by a marker, not by its status**: the row carries `Pre-split-evidence: implement` in its `Evidence` cell. **Write it once, from the history**: for **every** `E2E` / `API` row past `todo` — `red` and `green` and `refactor` as much as `done` and `review-fix` — check whether its `Evidence` anchor pointed at `implement-<spec-id>.md` in the commit that last advanced it. A row interrupted mid-cycle by the upgrade has legitimately stored evidence there too, and skipping it left that row unable to finish: unmarked, it is judged by the current rule whatever its status, so the evidence it lawfully wrote was rejected at item 10. Find that commit from the row's **patch history**, not with `git log -S`: the id is on both sides of a status-only change, and `-S` matches a filepair only when one side contains the string, so it walks back to the commit that _added_ the row instead. `git log -p -- <test-list.md>` and take the newest commit whose hunk changes that `TDD-ID`'s line (`git log -L` on the row also works where the line is stable). If its anchor named the implement file, append the marker. A row advanced after the split has an ATDD anchor there and gets none. Run it as part of taking this version; until it has run, those rows are judged by the current rule, which is the safe direction: they are reported, not silently accepted. Status and anchor alone cannot tell a legacy row from a new `E2E` / `API` row written to the wrong file — which would let a row that never produced its ATDD handoff be accepted as complete. **A row with no marker is judged by the current rule whatever its status**, which for an `E2E` / `API` row means the ATDD file: status and anchor alone cannot tell a legacy row from one written to the wrong file after the split, and accepting the implement anchor without the marker let a row that never produced an ATDD handoff pass the gate as complete. **A row that carries the marker** is the legacy case, and its implement anchor is accepted — it has no ATDD entry to produce, and a `done` row has no legal transition that would let it re-observe a RED, so requiring the new location would make an already-complete row permanently ungateable. Until the marker pass has run, unmarked legacy rows are reported rather than accepted; that is the safe direction, and running it is what clears them. A row advanced after the split writes to the file its `Layer` owns. The cell is a pointer, not the payload (`references/execution-ledger.md#evidence-cell-contract`). `Review pack seal` is recomputed here from the `review-<timestamp>/` directory it names, and a mismatch means the pack was edited after the round closed. Each reviewer verdict's `Audited evidence hash` is **recomputed** here over the entry's phase-authored fields: the revision excludes `.qfai/evidence/**`, so this is the only thing that tells a verdict passed on the evidence as read from one passed on evidence edited afterwards. The item's four sub-agent observations (items 3, 5, 7, 8) all name the **same** revision (`references/evidence-revision.md`) — **except item 3**, which cannot be taken against the final tree on any row: a RED precedes the code that makes it pass, and a `falsifiability` row's mutation run is taken against a tree reverted before the GREEN. It names its own field (`RED revision`, or `Falsifiability revision` in its place); items 5, 7 and 8 share `Revision`. That is the property that RED is worth having, not a defect in it; demanding one revision across all four made an `observed-red` E2E/API row unable to reach `done` however correct its evidence was. Such a row's RED names the revision it was observed at, items 5, 7 and 8 agree among themselves, and the reviewer checks that the handed-over RED names this row's selector and the predicate it owns rather than that it matches the final tree
|
|
322
|
+
11. The item's evidence file (item 10) is appended with both reviewer verdicts after items 7-8 returned PASS — this skill runs those reviewers for every row it advances, including the ones whose RED came from `/qfai-atdd`
|
|
323
|
+
12. Checkpoint verification passed (see `#checkpoint-verification`), and its `Checkpoint verification seal` is **recomputed** here over the recorded command, result and revision — a mismatch means the checkpoint record was edited after the run, and nothing else in the entry would have moved. The **full** suite is required here only when the item sits on a checkpoint boundary; a row between boundaries satisfies this with the narrow relevant suite from Phase: Refactor step 2, which is also what items 6, 7 and 8 are evaluated against.
|
|
324
|
+
|
|
325
|
+
Sequencing note: the phase-authored part of the evidence file **item 10's `Layer` rule selects** is
|
|
326
|
+
written **before** items 7-8, because it is what the reviewers audit — naming only
|
|
327
|
+
`implement-<spec-id>.md` here split an `E2E` row in two. The verdict fields are appended **after** items 7-8, and a phase-authored evidence file
|
|
328
|
+
whose only gap is those fields is NOT a blocking finding at review time (`Per-item evidence contract`).
|
|
329
|
+
|
|
330
|
+
### Review artifact layout (MUST)
|
|
331
|
+
|
|
332
|
+
Gate items 7-9 are evidence-bearing: reviewer verdicts must be written to a review pack, not left in
|
|
333
|
+
conversation. There is exactly **one** `.qfai/review/**` layout — `review-<17-digit-timestamp>/`
|
|
334
|
+
holding `review_request.md`, `R01_<reviewer-id>.md` (at least one) and `summary.json`. Do not nest
|
|
335
|
+
`<scope>/<layer>/attempt-NN/` directories: packs written there are invisible to `npx qfai validate`.
|
|
336
|
+
Each review round creates a new pack. Full schema and the `REVISE` -> `status: "FAIL"` mapping:
|
|
337
|
+
`references/review-artifact-layout.md`.
|
|
262
338
|
|
|
263
339
|
### Spec completion conditions
|
|
264
340
|
|
|
265
341
|
The skill may declare "this spec's implementation is complete" only when:
|
|
266
342
|
|
|
267
|
-
- All TC-\* from `06_Test-Cases.md` with applicable layer are present in `test-list.md`
|
|
343
|
+
- All TC-\* from `06_Test-Cases.md` with applicable layer are present in `test-list.md`. "Applicable layer" is decided by `.qfai/assistant/catalog/test-layers.md#layer-derivation-procedure-normative`
|
|
344
|
+
- `QFAI-ATDD-111` and `QFAI-ATDD-113` are clean for this spec — every declared `US-*` and
|
|
345
|
+
`CON-API-*` is traced by an annotation in the test tree, and where `06_Test-Cases.md` declares an
|
|
346
|
+
E2E coverage-target TC, by a `Layer = E2E` row naming it. **Not** "every `US-*` has an `E2E` row":
|
|
347
|
+
those rows have no producer (`../qfai-atdd/references/red-provenance.md#a-spec-with-no-atdd-owned-rows`)
|
|
268
348
|
- Each item reached `done` or valid `exception` (with DR-ID)
|
|
269
349
|
- 0 blocking reviewer issues remain
|
|
270
|
-
- Checkpoint verification passed
|
|
271
|
-
- No unresolved Change Request or waiver dependency exists
|
|
350
|
+
- Checkpoint verification passed at the spec-level boundary (see `#checkpoint-verification`), and its `Checkpoint verification seal` is **recomputed** here over the recorded command, result and revision. That boundary has no row, so gate item 12 never runs for it — without this recomputation the full-suite result on a terminal ledger could be edited from FAIL to PASS afterwards with no revision, no `Audited evidence hash` and no pack seal moving
|
|
351
|
+
- No unresolved Change Request or waiver dependency exists. The gate covers only the
|
|
352
|
+
`.qfai/decisions/CR-*.md` **in scope for this spec**; a CR confined to another spec never blocks
|
|
353
|
+
this one. An in-scope CR is **resolved** only when every condition in
|
|
354
|
+
`references/change-request-reset.md#when-an-in-scope-cr-counts-as-resolved` holds — `Status` is
|
|
355
|
+
`approved`, `rejected` or `superseded` (never `open`), the approval fields are populated,
|
|
356
|
+
`Resolution` records what was done, and when `Status` is `approved`, `Applied at` is populated —
|
|
357
|
+
approval alone does not release the gate. A CR failing any one of them, a half-filled record
|
|
358
|
+
included, is **unresolved** and blocks completion.
|
|
272
359
|
|
|
273
360
|
### Completion prohibition conditions
|
|
274
361
|
|
|
275
362
|
Completion MUST NOT be declared when any of the following are true:
|
|
276
363
|
|
|
277
|
-
- No RED fresh evidence exists for the item
|
|
364
|
+
- No RED fresh evidence exists for the item, and no falsifiability evidence replaces it
|
|
278
365
|
- No GREEN fresh evidence exists for the item
|
|
279
|
-
- Either reviewer (`completion-reviewer` or `implementation-reviewer`) has not been run or returned
|
|
280
|
-
-
|
|
366
|
+
- Either reviewer (`completion-reviewer` or `implementation-reviewer`) has not been run or returned REVISE
|
|
367
|
+
- The item's evidence file (item 10) does not exist, or does not record both reviewer verdicts for the item (this is the single blocking statement about the evidence file; its absence of _verdicts_ is never blocking before items 7-8)
|
|
368
|
+
- A `## Cross-spec obligations` entry in this spec's evidence file is still open — the change it names has not landed, or the blocked spec's obligation is still untested. A clean completion here would certify an obligation this run knowingly left unmet (`references/cross-spec-ownership.md`)
|
|
369
|
+
- Items with `todo`, `red`, `green`, `refactor`, or `review-fix` status still exist (for spec-level completion)
|
|
370
|
+
- Items with `exception` status still exist, **unless** the row's `DR-ID` names
|
|
371
|
+
a Decision Record explicitly recorded as a **user-approved accepted-risk
|
|
372
|
+
waiver** (a `TDDLIST-001` entry in `.qfai/waivers.yml`). An `exception` whose
|
|
373
|
+
DR only describes the anomaly is a parked defect, not a completed item.
|
|
281
374
|
- Parallel slices were used but integration verify has not been run post-merge
|
|
282
|
-
-
|
|
375
|
+
- A checkpoint boundary was reached (see `#checkpoint-verification`) but the verification command set was not executed, or any command in it exited non-zero — the last row a run completes is always a boundary, not the physical last row of the file, which is often already `done` and skipped, so every spec runs the full suite at least once
|
|
283
376
|
- `it.todo(...)` / `test.todo(...)` / `describe.todo(...)` stubs remain in any file covered by `validation.traceability.testFileGlobs` (`QFAI-TEST-001`). Implement the body or delete the stub — an opt-out via `validation.testStrategy.forbidTestTodoStubs: false` is permitted only with an accompanying waiver DR-ID.
|
|
284
377
|
|
|
285
378
|
## Evidence (MANDATORY)
|
|
286
379
|
|
|
287
|
-
Create/update: `.qfai/evidence/implement-<spec-id>.md`
|
|
380
|
+
Create/update the evidence file the row's `Layer` owns: `.qfai/evidence/implement-<spec-id>.md` for the rows this skill runs end to end, and `.qfai/evidence/atdd-<spec-id>.md` for an `E2E` / `API` / `Integration` row, whose RED provenance was produced by the stage that authored its test — all three, so the GREEN, the refactor-verify pair and the review verdicts land in the same file as the provenance and item 10 reads one complete entry rather than half of one from each. This is the file gate item 10 resolves the `Evidence` anchor against, so the whole per-item record — RED, GREEN, Refactor, `Oracle proof` and both reviewer verdicts — belongs in the **one** file, appended to the `## Ledger rows advanced` entry `/qfai-atdd` opened. Splitting a row across both leaves the file the gate reads incomplete.
|
|
288
381
|
|
|
289
382
|
Required sections:
|
|
290
383
|
|
|
291
384
|
- Objective
|
|
292
385
|
- Items processed (TDD-ID, TC-Refs, final status)
|
|
386
|
+
- **Per item, one `### TDD-NNNN` section** carrying the contract below — the single home for that item's RED/GREEN commands and output, in whichever of the two files the row's `Layer` names. The ledger's `Evidence` cell anchors here and holds only the one-word outcomes, because a GFM cell cannot hold a newline or a bare `|` (`references/execution-ledger.md#evidence-cell-contract`)
|
|
293
387
|
- Test results summary
|
|
294
388
|
- Exception items (if any) with DR-IDs
|
|
389
|
+
- `## Cross-spec obligations` (if any): per affected spec, the TDD-ID that forced the change, the blocked spec and its TDD-IDs, the file, the change required, the obligation left unverified, and the resolution (`re-reviewed` or a `CR-*`). Fields and the rule: `references/cross-spec-ownership.md`
|
|
295
390
|
- Commands executed
|
|
296
391
|
|
|
297
392
|
### Per-item evidence contract (fresh evidence required)
|
|
298
393
|
|
|
299
|
-
Each TDD item MUST have fresh evidence containing at minimum
|
|
394
|
+
Each TDD item MUST have fresh evidence containing at minimum the fields below. The contract has two
|
|
395
|
+
parts with different write points; the fields are the same, the sequencing is not.
|
|
396
|
+
|
|
397
|
+
**Phase-authored (written before the reviewer gate, items 7-8):**
|
|
300
398
|
|
|
301
|
-
- `TDD-ID` — the item
|
|
302
|
-
- `TC-ref` — reference to the test case(s)
|
|
399
|
+
- `TDD-ID`, `Layer`, `Test file`, `Selector` — the row identity, copied from `test-list.md`. The reviewers hash these and gate item 10 checks the copy against the ledger, so a row recorded without them has no identity record to hash and cannot pass that check (`constitution/shared-skill-delegation-baseline.md#reviewer-response-template`)
|
|
400
|
+
- `TC-ref` — reference to the test case(s). On a `Layer = E2E` row read `US-ref` (the row's `US-Refs`) instead, and on a `Layer = API` row read `CON-API-ref` (the row's `CON-API-Refs`): exactly one obligation reference is required, the one the row's `Layer` selects
|
|
401
|
+
- `Revision` — the state the observation was made against: `git rev-parse HEAD`, or `working-tree+<content hash>` for an uncommitted tree.
|
|
402
|
+
- `RED test hash` — **required on a handed-over `E2E` / `API` / `Integration` row**, and checked, not just read. On an `observed-red` row the producer records it with the RED; on a `falsifiability` row — which has no RED pair, so nothing was hashed at handoff — **Phase Red step 3c records it against the mutation run**, which is the run this gate is about for that branch. Phase Green rewrites the production tree, so the working-tree hash cannot be recomputed from the final one and `Revision` alone cannot tell "only production changed" from "the acceptance test was edited after the handoff". Recompute it over the **same inputs the producer hashed** — the row's `Test file` column _and_ the acceptance-test-owned artifacts it names, in the manifest order `../qfai-atdd/references/red-provenance.md` defines. The producer records that manifest beside the hash for exactly this reason: recomputing over `Test file` alone yields a different value for every row that reads a fixture or a snapshot, so an unchanged row failed the gate and was sent back to `/qfai-atdd` on every pass. Recompute before GREEN is submitted and before the reviews: it is unchanged by Phase Green, so a mismatch means the test moved under the RED and the row goes back to `/qfai-atdd` for a fresh one — **unless a `Shared-artifact re-verify` entry names this row — its spec and `TDD-ID` together — and carries its re-run, re-taken proof and the artifact's new manifest and hash. Two places hold such an entry and both clear it**: a later row's evidence, and the `## Shared-artifact re-verify` block in the stage evidence file of a stage that moved the artifact. Naming only the later row left a spec with no ATDD-owned rows — the ordinary case for a fresh spec that edits a shared fixture — with nowhere its re-verify would be read, so a correctly re-verified consumer stayed stale for ever. A shared fixture edited by a later row moves this hash by construction, and a `done` row cannot take a fresh RED, so that entry is what clears it (`../qfai-atdd/references/red-provenance.md#a-shared-test-artifact-outlives-the-row-that-recorded-it`). Without this the stale RED passes gate item 10 exactly as a fresh one does. Where it lives is `references/round-evidence.md`'s list, and that list is the only statement of it — recorded at the handoff for an `observed-red` row's first round, at step 3c for a `falsifiability` one, and again by each fresh RED a REVISE opens. `Revision` is the field that is per round block and once more for the refactor-verify pair (`references/evidence-revision.md`)
|
|
403
|
+
- `Falsifiability revision` — **required on a `falsifiability` row**, and distinct from `Revision` by construction. The gate now reads the mutated tree before the revert (Phase Red step 3c), so item 3's observation is made against a tree that is deliberately thrown away, while the GREEN and both reviews see the restored one. Requiring one revision across all four made every correct branch-2 row permanently stale — the same shape as the handed-over RED below, for the same reason: the observation that proves the test discriminates cannot be taken against the tree the reviewers judge. Record the mutated tree's address here; items 5, 7 and 8 agree among themselves on `Revision`
|
|
404
|
+
- `Round N: RED revision` — **required in every round block with a RED pair**, not only a handed-over one, and per round because each round's RED is observed on its own tree: a RED is observed before the code that makes it pass exists, so on an uncommitted tree Phase Green moves the content address by construction and one shared `Revision` made an ordinary cycle stale at GREEN. A row whose proof was re-taken after a test-only replacement also carries `Replacement proof revision` — the tree that proof ran against — and `RED revision` keeps the tree the original RED was observed on (`../qfai-atdd/references/review-fix-rounds.md`). That RED was observed before the production code existed, so its revision is earlier than `Revision` by construction; recording both in one field made the row permanently stale (`references/evidence-revision.md`)
|
|
303
405
|
- `RED command` — the exact command executed to observe failure
|
|
304
|
-
- `RED result` — the failure output
|
|
406
|
+
- `RED result` — the failure output. Truncation is acceptable for the stack tail, never for the assertion message and its location: that is what demonstrates admissibility
|
|
407
|
+
- `RED failure mode` — `assertion` | `expected-error` | `falsifiability`. There is no admissible value for a load error (`references/red-admissibility.md`)
|
|
408
|
+
- **Exclusive alternative to the RED pair**: a row on the _RED not observable_ path carries `Satisfied-by`, `Falsifiability command` and `Falsifiability result` in place of the two RED fields above. Exactly one of the two forms must be present — never both, never neither (`references/red-not-observable.md`).
|
|
305
409
|
- `GREEN command` — the exact command executed to observe success
|
|
306
410
|
- `GREEN result` — the success output
|
|
307
|
-
- `
|
|
308
|
-
- `Refactor verify
|
|
309
|
-
- `
|
|
310
|
-
- `
|
|
411
|
+
- Each RED/GREEN cycle is one **round block**. Which fields carry a `Round N:` prefix is `references/round-evidence.md`'s list and only that; do not re-derive it here. The **row-level** fields do not: `TDD-ID` and `TC-ref` are recorded once for the row. `RED test hash`, `RED revision` and `Falsifiability revision` were listed here as row-level while that reference put them in each round's block, and a blocking REVISE that opens Round 2 makes the two irreconcilable — one instruction overwrites Round 1's address, the other reuses it for a RED it was not taken on. Numbering, cardinality and the two rework paths are that reference's alone
|
|
412
|
+
- `Refactor verify command` — the exact command re-executed after refactor. Written once for the item as a whole, so it takes no `Round N:` prefix
|
|
413
|
+
- `Refactor verify result` — the output confirming GREEN is maintained (likewise once per item)
|
|
414
|
+
- `Oracle proof` — the smallest production change that makes this item's test fail again, its command and its failing output, reverted immediately; or `equivalent-mutant` naming the contract clause weaker than the obligation. A row on the _RED not observable_ path satisfies this with its falsifiability fields (`references/oracle-strength.md`)
|
|
415
|
+
|
|
416
|
+
These exist _for_ the reviewers: they are the evidence items 7-8 audit. They MUST be present when a
|
|
417
|
+
review is requested.
|
|
418
|
+
|
|
419
|
+
**Gate-completed (appended after items 7-8 return PASS):**
|
|
420
|
+
|
|
421
|
+
- `Spec review` — completion-reviewer result (PASS or REVISE) with its `Reviewed revision` and `Audited evidence hash` (`references/evidence-revision.md`)
|
|
422
|
+
- `Code quality review` — implementation-reviewer result (PASS or REVISE) with its `Reviewed revision` and `Audited evidence hash`
|
|
311
423
|
- `Prototype parity` — product-surface-reviewer result for UI-affecting items (PASS or REVISE)
|
|
424
|
+
- `Checkpoint verification command` — the exact command set executed at the checkpoint boundary
|
|
425
|
+
- `Checkpoint verification result` — the outcome of that command set (PASS only when every command exits 0) — and `Checkpoint verification seal`, the audit hash over these two fields together with the `Revision` the checkpoint ran against, taken by whoever ran it the moment the run ends. The three are appended after every reviewer has hashed, so they are in no audit subject by construction; the revision excludes `.qfai/evidence/**`, and the review pack seal covers only the pack. Without a seal of their own, a row already at `done` could have its checkpoint result edited from FAIL to PASS with no revision, no `Audited evidence hash` and no pack seal moving, and item 12 would accept it
|
|
426
|
+
|
|
427
|
+
These record verdicts that do not exist until the reviews have run. A reviewer MUST NOT treat their
|
|
428
|
+
absence as a blocking gap during review — an evidence file complete in its phase-authored part and
|
|
429
|
+
missing only the verdict fields is the expected state at review time. It becomes blocking only at
|
|
430
|
+
the completion gate (see `Completion prohibition conditions`).
|
|
312
431
|
|
|
313
432
|
### Evidence hard rules
|
|
314
433
|
|
|
315
|
-
- Status-only evidence (e.g., "Status: PASS" with no command) is invalid and MUST be rejected
|
|
316
|
-
-
|
|
317
|
-
- Stale evidence from a previous run MUST NOT be reused to claim completion for a new cycle
|
|
318
|
-
-
|
|
434
|
+
- Status-only evidence (e.g., "Status: PASS" with no command) is invalid and MUST be rejected; both command and result are required, and "should pass" or "looks good" alone is not acceptable — `TDDLIST_EVIDENCE_STATUS_ONLY` (warning, waivable as `TDDLIST-004`: ledgers predating the check carry prose verdicts)
|
|
435
|
+
- Empty evidence entries are rejected: minimum evidence per TDD item must be met — `TDDLIST_EVIDENCE_EMPTY` (error)
|
|
436
|
+
- Stale evidence from a previous run MUST NOT be reused to claim completion for a new cycle. **Stale is mechanical**: evidence whose named `Revision` differs from the revision the item finally landed at (`references/evidence-revision.md`). **Reviewer obligation, not a machine gate** — why, and the full rules: `references/execution-ledger.md`.
|
|
437
|
+
- **Selective reporting of repeated runs of the same gate is invalid.** When a gate was run more than once, report every run in order — a clean rerun after a red one is an `environment/tooling` finding, not a pass (`.qfai/assistant/constitution/shared-skill-operating-baseline.md#nondeterministic-gates`)
|
|
438
|
+
|
|
439
|
+
## Checkpoint Verification
|
|
440
|
+
|
|
441
|
+
"Checkpoint verification" is the whole-repository regression check run at a checkpoint boundary. It
|
|
442
|
+
is what item 12 of the 12-point gate refers to and the only thing it refers to. A boundary is
|
|
443
|
+
reached **per item** (after all routed blocking reviewers return PASS, before `refactor` -> `done`)
|
|
444
|
+
and **per spec** (after the last ledger row is terminal). There is no "every N items" rule.
|
|
445
|
+
|
|
446
|
+
It PASSES only when **every** command in the verification command set exits 0; a partial run is not
|
|
447
|
+
a pass. The boundary definition, command set, pass criteria and evidence fields are in
|
|
448
|
+
`references/checkpoint-verification.md`.
|
|
319
449
|
|
|
320
450
|
## FINAL CHECKLIST (Check Last)
|
|
321
451
|
|
|
322
|
-
-
|
|
323
|
-
|
|
324
|
-
- [ ] Red phase: test was written and confirmed to fail.
|
|
325
|
-
- [ ] Green phase: minimal code was written and test confirmed to pass.
|
|
326
|
-
- [ ] Refactor phase: code improved with tests still passing.
|
|
327
|
-
- [ ] `test-list.md` statuses are accurate.
|
|
328
|
-
- [ ] No backward transitions occurred.
|
|
329
|
-
- [ ] Exception items have DR-IDs recorded.
|
|
330
|
-
- [ ] All tests pass.
|
|
331
|
-
- [ ] `qfai validate --profile tdd --fail-on error` passes with zero `QFAI-TEST-001` findings (no `it.todo` / `test.todo` / `describe.todo` stubs remain).
|
|
452
|
+
Work through `references/final-checklist.md` immediately before the completion message. Every box
|
|
453
|
+
must be ticked; a box that cannot be ticked is a reason not to declare completion.
|
|
332
454
|
|
|
333
455
|
## Completion Checklist (MUST)
|
|
334
456
|
|
|
@@ -343,7 +465,7 @@ Each TDD item MUST have fresh evidence containing at minimum:
|
|
|
343
465
|
When this skill is complete, provide a final user-facing completion message and enumerate all actionable next steps.
|
|
344
466
|
|
|
345
467
|
- Verify gates: `/qfai-verify`.
|
|
346
|
-
Action: run `qfai validate --profile tdd --fail-on error
|
|
468
|
+
Action: run `npx qfai validate --profile tdd --fail-on error --spec <spec-id>` for this skill, then `/qfai-verify` for full-scan approval.
|
|
347
469
|
- Spec updates needed: `/qfai-sdd`.
|
|
348
470
|
Action: update spec artifacts if implementation revealed scope changes.
|
|
349
471
|
- Acceptance tests: `/qfai-atdd`.
|
|
@@ -372,6 +494,6 @@ A skill MAY narrow the auto-decide bucket (drop entries) but MUST NOT widen it.
|
|
|
372
494
|
|
|
373
495
|
project_memory:
|
|
374
496
|
|
|
375
|
-
- One TDD item at a time from test-list.md; status lifecycle is forward-only
|
|
376
|
-
- Fresh RED + GREEN command/result evidence is mandatory per item; status-only evidence (e.g. "Status: PASS") is rejected.
|
|
497
|
+
- One TDD item at a time from test-list.md by default; item-level parallelism inside one spec only when the Parallelization Policy technical gate and user consent both pass; status lifecycle is forward-only along todo → red → green → refactor → done, plus re-entry edges (refactor → red on a qa-gatekeeper REVISE, blocked → todo, exception → todo, refactor → review-fix → refactor, approved upstream reset) enumerated only in `references/execution-ledger.md#allowed-transitions` — never conclude an edge is illegal from this line alone; exception requires DR-ID.
|
|
498
|
+
- Fresh RED + GREEN command/result evidence is mandatory per item, except on the _RED not observable_ path where `Satisfied-by` + falsifiability command/result replace the RED pair (exclusive alternative, never both); status-only evidence (e.g. "Status: PASS") is rejected.
|
|
377
499
|
- UI-affecting items require product-surface-reviewer prototype-parity PASS before the item can transition to done.
|