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
|
@@ -4,9 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
`.qfai/prototypes/iter-<final>/index.html` — the final accepted
|
|
6
6
|
iteration HTML. The "final" iter is whichever iteration was the latest
|
|
7
|
-
when `qfai prototyping iterate` returned exit 64 (convergence) or 65
|
|
7
|
+
when `npx qfai prototyping iterate` returned exit 64 (convergence) or 65
|
|
8
8
|
(max-iterations).
|
|
9
9
|
|
|
10
|
+
This is the **authoring** artifact — one self-contained file with one
|
|
11
|
+
client-side route per declared screen, written by the generator. It is
|
|
12
|
+
a distinct tree from the **capture** artifacts at
|
|
13
|
+
`.qfai/evidence/prototyping/iter-<final>/<screenId>.{html,png}`, which
|
|
14
|
+
`npx qfai prototyping iterate --capture` fans out one pair per declared
|
|
15
|
+
screen. Handoff mirrors the authoring artifact; `npx qfai prototyping
|
|
16
|
+
certify` gates on the capture artifacts and never opens the
|
|
17
|
+
`prototypes/` tree. Both must exist before handoff can complete: see
|
|
18
|
+
"Output layout" in `references/generator-prompt.md`.
|
|
19
|
+
|
|
10
20
|
`DESIGN.md` (root) and `.qfai/contracts/design/DESIGN.md.lock.yaml`
|
|
11
21
|
remain the brand SSOT through handoff.
|
|
12
22
|
|
|
@@ -57,16 +67,35 @@ the SSOT for brand identity. There is no preserve / adapt / copy split.
|
|
|
57
67
|
|
|
58
68
|
## Cert
|
|
59
69
|
|
|
60
|
-
Order is load-bearing: `qfai prototyping certify` requires
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
Order is load-bearing: `npx qfai prototyping certify` requires the configured
|
|
71
|
+
validate report (with `counts.error === 0`) and `.qfai/report/verify.json`
|
|
72
|
+
(with `status === "PASS"`) to be present on disk before it will seal the
|
|
73
|
+
certificate.
|
|
74
|
+
|
|
75
|
+
The two reads are not the same shape. The **validate** report is read from
|
|
76
|
+
whatever `output.validateJsonPath` names — one location, no fallback. Only
|
|
77
|
+
**`verify.json`** is canonical-first: it falls back to the legacy
|
|
78
|
+
`.qfai/output/verify.json` and prints a migration note when it does. That
|
|
79
|
+
fallback fires only when the canonical file is **absent** — a canonical file
|
|
80
|
+
that exists but is unparseable, non-object, or unreadable aborts certify with a
|
|
81
|
+
non-zero exit instead, so a leftover legacy `status: "PASS"` can never certify a
|
|
82
|
+
run whose real gate result was never readable. A canonical file that is missing
|
|
83
|
+
in both locations is reported as missing, not as a failing status.
|
|
84
|
+
|
|
85
|
+
Run the gates in this order, every time:
|
|
86
|
+
|
|
87
|
+
1. `npx qfai validate --profile prototyping --fail-on error` — writes the path
|
|
88
|
+
configured at `output.validateJsonPath` (default
|
|
89
|
+
`.qfai/report/validate.json`), not a fixed `.qfai/output/` literal.
|
|
90
|
+
2. `/qfai-verify` — writes `.qfai/report/verify.json` with
|
|
91
|
+
`status: "PASS"` and `scope: "prototyping"`. Certify accepts no
|
|
92
|
+
other scope: `atdd` / `implement` / `full` are refused by the
|
|
93
|
+
option-B phase-isolation contract, and a `full` run at this point
|
|
94
|
+
necessarily fails the stage-5 ATDD traceability rules
|
|
95
|
+
(`QFAI-ATDD-111/112/113`). The field list and the `scope` enum are
|
|
96
|
+
specified under "Verify Output Contract" in
|
|
97
|
+
`.qfai/assistant/skills/qfai-verify/SKILL.md`.
|
|
98
|
+
3. `npx qfai prototyping certify` — produces
|
|
70
99
|
`.qfai/evidence/prototyping/completion-certificate.json`. The
|
|
71
100
|
certificate includes `designMdPath` + `designMdSha256` for the
|
|
72
101
|
locked brand identity. Use `certify --check` to verify digests
|
|
@@ -21,7 +21,7 @@ one-line summary at each iter's end.
|
|
|
21
21
|
|
|
22
22
|
## Stop conditions (deterministic)
|
|
23
23
|
|
|
24
|
-
Exit codes for `qfai prototyping iterate --cycle <n+1>`:
|
|
24
|
+
Exit codes for `npx qfai prototyping iterate --cycle <n+1>`:
|
|
25
25
|
|
|
26
26
|
- `0` — continue.
|
|
27
27
|
- `64` — convergence: latest iter has all 4 UX axes
|
|
@@ -73,3 +73,50 @@ proceed unless the two match; the lock value is then cached into
|
|
|
73
73
|
diverging exits with `2`. To change brand identity mid-project, edit
|
|
74
74
|
`DESIGN.md`, rerun `/qfai-sdd` Phase 0 to refreeze the lock, and
|
|
75
75
|
start `/qfai-prototyping` from cycle 0.
|
|
76
|
+
|
|
77
|
+
## Sealed loop
|
|
78
|
+
|
|
79
|
+
A loop is **sealed** once `prototyping.json` records
|
|
80
|
+
`stopReason: "axes-exceptional"` together with an `acceptedIterationIndex`.
|
|
81
|
+
That is the converged state — the only one `--check-convergence` reports as
|
|
82
|
+
converged and the only one `npx qfai prototyping certify` will seal. On a sealed
|
|
83
|
+
loop `npx qfai prototyping iterate --cycle N` refuses with exit `2` for any `N`
|
|
84
|
+
greater than the accepted index, and writes nothing — no `iter-NN/` directory
|
|
85
|
+
is created. That refusal is deliberate: such a directory is stale by
|
|
86
|
+
construction, and the stale-iteration-directory check in
|
|
87
|
+
`npx qfai prototyping certify` hard-fails on it.
|
|
88
|
+
|
|
89
|
+
`license-verify-fail` and `input-error` do **not** seal the loop. They are
|
|
90
|
+
states you are expected to fix and retry, so the same cycle can be re-run and
|
|
91
|
+
the fix verified.
|
|
92
|
+
|
|
93
|
+
`max-iterations` does not seal the loop either, but it is **not** retryable in
|
|
94
|
+
the same way: the recorded `iter-09` remains the last iteration, so
|
|
95
|
+
`shouldStop()` returns `max-iterations` again and every `--cycle N >= 1` exits
|
|
96
|
+
`65` before any path is assigned. Its only recovery is the cycle-0 reset
|
|
97
|
+
below.
|
|
98
|
+
|
|
99
|
+
Two paths remain open on a sealed loop:
|
|
100
|
+
|
|
101
|
+
- **Seal it** — run `npx qfai prototyping certify`. This is the normal
|
|
102
|
+
next step after convergence.
|
|
103
|
+
- **Start over** — run `npx qfai prototyping iterate --cycle 0
|
|
104
|
+
--target-url <url> --force`. Cycle 0 is a hard reset and is never
|
|
105
|
+
refused by the sealed-loop guard; it also deletes stale `iter-NN`
|
|
106
|
+
directories. `--force` is required, not optional: a converged loop
|
|
107
|
+
always has an `iter-00`, and the cycle-0 destructive-rerun gate
|
|
108
|
+
refuses to overwrite it without the flag. With it, `iter-00` is moved
|
|
109
|
+
to `iter-00.backup-<ISO>` before the reset, so the prior loop is
|
|
110
|
+
recoverable.
|
|
111
|
+
|
|
112
|
+
Re-running the accepted cycle itself (`--cycle <acceptedIterationIndex>`)
|
|
113
|
+
is not refused by the sealed-loop guard — that would be a redo of recorded
|
|
114
|
+
work, not an extension past the seal — but it does not re-run the cycle
|
|
115
|
+
either: the convergence gate reads the same recorded iteration, reports
|
|
116
|
+
`axes-exceptional` and exits `64` without assigning paths or writing
|
|
117
|
+
anything. Treat it as a state read, and prefer
|
|
118
|
+
`npx qfai prototyping iterate --check-convergence`, which reports the recorded
|
|
119
|
+
`stopReason` / `acceptedIterationIndex` without the exit-code ambiguity.
|
|
120
|
+
|
|
121
|
+
If an `iter-NN` directory was created that should not have been, delete
|
|
122
|
+
it before running certify; there is no reserved quarantine name.
|
|
@@ -43,6 +43,12 @@ accessibility:
|
|
|
43
43
|
motion: "respect-reduced-motion"
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
+
<!-- QFAI-SAMPLE-DESIGN-MD: this is the qfai sample brand, NOT your product's brand.
|
|
47
|
+
Replace the front-matter and the body below with this product's own brand SSOT
|
|
48
|
+
(`/qfai-discussion` emits the draft), then DELETE this comment. While this comment
|
|
49
|
+
is present `qfai validate` reports QFAI-DCON-034 and /qfai-sdd Phase 0 refuses to
|
|
50
|
+
freeze the file's sha256 as the project's brand contract. -->
|
|
51
|
+
|
|
46
52
|
# Brand Philosophy
|
|
47
53
|
|
|
48
54
|
Acme Ledger is a calm, confident financial comparison surface. The interface
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: qfai-sdd
|
|
3
3
|
title: QFAI SDD Unified (Triage/Outline/Slice/Plan/Delta)
|
|
4
4
|
description: "Triage incoming requirements against existing specs, then create or update layered SDD artifacts (_policies + spec-*) in one workflow."
|
|
5
|
-
argument-hint: "[<spec-id-or-name>] [--auto]"
|
|
5
|
+
argument-hint: "[<spec-id-or-name>] [--contract <CON-ID>] [--auto]"
|
|
6
6
|
allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
|
|
7
7
|
roles:
|
|
8
8
|
[
|
|
@@ -37,6 +37,8 @@ QFAI Skill Body (SSOT)
|
|
|
37
37
|
```
|
|
38
38
|
Stage 0 Preflight -> Stage 1 Triage -> Phase 0 Contracts-first
|
|
39
39
|
-> Phase 1 Outline -> Phase 2 Slice (per spec)
|
|
40
|
+
-> Phase 2b Seed tdd/test-list.md (per spec)
|
|
41
|
+
-> Phase 2c Obligation reconciliation (per spec)
|
|
40
42
|
-> Phase 3 Plan finalize -> Phase 4 Delta update
|
|
41
43
|
```
|
|
42
44
|
|
|
@@ -114,7 +116,7 @@ Follow `.qfai/assistant/constitution/shared-skill-delegation-baseline.md`.
|
|
|
114
116
|
|
|
115
117
|
### Delegation Failure (Hard Stop)
|
|
116
118
|
|
|
117
|
-
- Do not simulate roles.
|
|
119
|
+
- 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.
|
|
118
120
|
|
|
119
121
|
Stage minimum roles:
|
|
120
122
|
|
|
@@ -123,7 +125,13 @@ Stage minimum roles:
|
|
|
123
125
|
- `test-design-analyst` drafts traceability, examples, and test-design.
|
|
124
126
|
- `product-experience-architect` is added when the target is UI-bearing.
|
|
125
127
|
- `orchestrator` integrates outputs and presents for confirmation; never drafts the primary artifact and never self-approves.
|
|
126
|
-
- `completion-reviewer` is delegated independently. Required field: `Status (PASS/REVISE)`.
|
|
128
|
+
- `completion-reviewer` is delegated independently. Required field: `Status (PASS/REVISE/PENDING)`; `PENDING` marks an unrun gate and never counts as `PASS`.
|
|
129
|
+
|
|
130
|
+
Author↔reviewer separation (MUST): drafting roles and reviewing roles above are routed from one
|
|
131
|
+
list, but no sub-agent may review an artifact it drafted or edited in this run. `independent` is
|
|
132
|
+
defined normatively in
|
|
133
|
+
`.qfai/assistant/constitution/shared-skill-delegation-baseline.md#definition-independent-reviewer-normative`,
|
|
134
|
+
and every reviewer response must carry its `Authored/edited under review:` attestation.
|
|
127
135
|
|
|
128
136
|
Reviewer routing is fixed by `.qfai/assistant/manifest/agent-routing.yml` and `.qfai/assistant/manifest/review-profiles.yml`.
|
|
129
137
|
|
|
@@ -132,7 +140,7 @@ Reviewer routing is fixed by `.qfai/assistant/manifest/agent-routing.yml` and `.
|
|
|
132
140
|
- Default: `completion-reviewer`.
|
|
133
141
|
- Conditional: `architecture-reviewer` (structural / contract / CLI), `product-surface-reviewer` (UI-bearing), `qa-gatekeeper` (validate / coverage / runtime / prototyping evidence affected).
|
|
134
142
|
- Drift Protocol compliance is mandatory; reviewers MUST verify no rejected option was reintroduced and no drift from prior decisions.
|
|
135
|
-
- Test-layer policy is checked against `.qfai/assistant/catalog/test-layers.md`;
|
|
143
|
+
- Test-layer policy is checked against `.qfai/assistant/catalog/test-layers.md`; annotation routing is enforced by `.qfai/assistant/catalog/test-layers.md#annotation-routing`, which owns the US / TC / CON-API mapping. A `TC-*`'s `Level` is **not** a constant: derive it per TC with `.qfai/assistant/catalog/test-layers.md#layer-derivation-procedure-normative`, keeping the row inside L1–L3 and defaulting to Integration only when the derivation is genuinely indeterminate. A missing `tests/integration/**` trace never rewrites a derived `Level`.
|
|
136
144
|
- Coverage floors / ratios are planning signals, not gates; reviewers must not block on them.
|
|
137
145
|
- Do not declare DONE until all routed blocking reviewers return `PASS`.
|
|
138
146
|
|
|
@@ -141,6 +149,10 @@ Reviewer routing is fixed by `.qfai/assistant/manifest/agent-routing.yml` and `.
|
|
|
141
149
|
- Without argument: target all capabilities in `_policies/03_Capabilities.md`.
|
|
142
150
|
- Run Contracts-first and Outline once per batch.
|
|
143
151
|
- Delegate Slice in parallel per spec.
|
|
152
|
+
- Parallel delegation here is bound by the stage-independent Concurrency rules in
|
|
153
|
+
`.qfai/assistant/constitution/workflow.md#concurrency-stage-independent-mandatory`:
|
|
154
|
+
worktree separation, or the declared degraded mode, plus mandatory commit
|
|
155
|
+
scoping (`git add <paths>`; never `git add -A` / `git add .` / `git commit -a`).
|
|
144
156
|
- Validate gate and Review gate run once at batch tail after all target specs are integrated.
|
|
145
157
|
|
|
146
158
|
## Work Orders Summary
|
|
@@ -151,7 +163,7 @@ Per-spec evidence at `.qfai/evidence/sdd-<spec-id>.md` is mandatory and MUST inc
|
|
|
151
163
|
|
|
152
164
|
- Follow `references/review-cycle-playbook.md`.
|
|
153
165
|
- Footer SSOT: `references/rcp_footer.md`.
|
|
154
|
-
- Allowed reviewer verdicts: `PASS` and `FAIL
|
|
166
|
+
- Allowed in-flight reviewer verdicts: `PASS` and `REVISE` (`REVISE` serializes to `status: "FAIL"` in the pack summary).
|
|
155
167
|
|
|
156
168
|
## Workflow Convention
|
|
157
169
|
|
|
@@ -175,36 +187,70 @@ Follow `.qfai/assistant/constitution/shared-skill-operating-baseline.md#delta-re
|
|
|
175
187
|
|
|
176
188
|
- With argument (`/qfai-sdd <spec-id-or-name> [--auto]`): update only the matched single spec target.
|
|
177
189
|
- Without argument (`/qfai-sdd`): target all capabilities listed in `_policies/03_Capabilities.md`.
|
|
190
|
+
- Contract-scoped (`/qfai-sdd --contract <CON-ID>`): run Stage 0 + Phase 0 (Contracts-first) + Phase 4 (Delta update) only, against the named contract and the specs that reference it. This is the invocation `constitution/drift-protocol.md#when-drift-is-detected` step 4 names for a contract-class upstream artifact; without it, a contract-only Change Request had no rerun narrower than the whole spec.
|
|
178
191
|
- Reordering capability-to-spec mapping is a Change Request decision and must not be done implicitly.
|
|
179
192
|
|
|
180
193
|
## Critical Constraints
|
|
181
194
|
|
|
182
|
-
1. Use only
|
|
195
|
+
1. Use only templates under `.qfai/assistant/skills/qfai-sdd/templates/` — the whole directory, not an enumerated subset, so a new template directory is covered on the day it ships.
|
|
196
|
+
- Named cross-skill exception: `.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample` (Phase 0 DESIGN.md Freeze). It is an exception, not a licence to read other skills' templates.
|
|
197
|
+
- Never invent a layout for an artifact a template already covers.
|
|
183
198
|
2. Always write `.qfai/report/preflight_summary.md` before generating shared/spec artifacts.
|
|
184
199
|
3. Contracts-first is mandatory; UI-bearing targets must be normalized into `.qfai/contracts/design/**` and `.qfai/contracts/ui/**` per `references/ui-design-contract-normalization.md`. UI-bearing targets MUST also validate the consuming-project root `DESIGN.md` and freeze its sha256 into `.qfai/contracts/design/DESIGN.md.lock.yaml` (see Phase 0 DESIGN.md Freeze below).
|
|
185
200
|
4. `_policies/05_Contracts.md` must include a Contract Index aligned with `.qfai/contracts/**`.
|
|
201
|
+
- Phase 0 must also reconcile paired contracts against each other, not only validate each file: every terminal state, status enum value, and error code an API contract mandates must be representable in the paired DB contract. See `references/contract-artifact-rules.md#cross-contract-reconciliation-must`. The reviewer gate checks the pairing before sign-off.
|
|
186
202
|
5. `_policies/04_Business-Flow.md` must be Markdown with Mermaid `flowchart` or `sequenceDiagram`.
|
|
187
203
|
6. `05_Examples.md` must include `EX-ID` and `BR-Ref` mappings.
|
|
188
|
-
7. `06_Test-Cases.md` must include `TC-ID`, `EX-Ref`, `AC-Refs`, and `Type`, with normal-path plus error/boundary coverage.
|
|
189
|
-
8.
|
|
204
|
+
7. `06_Test-Cases.md` must include `TC-ID`, `Level`, `EX-Ref`, `AC-Refs`, and `Type`, with normal-path plus error/boundary coverage. `Level` gates `TDDLIST_TC_NOT_COVERED` at `error`, so it is required, not optional.
|
|
205
|
+
8. A `TC` whose assertion reads the **content** of an upstream artifact — a decision record in
|
|
206
|
+
`07_Decisions.md`, a contract, another spec file — must not be written before that artifact
|
|
207
|
+
exists. `/qfai-implement` may not write upstream SSOT, so a row routed to it first has no
|
|
208
|
+
lawful move, and the agent that meets it must choose between three prohibited things. Produce
|
|
209
|
+
the artifact in this stage, or do not write the case yet.
|
|
210
|
+
9. Stop only when `npx qfai validate --profile sdd --fail-on error --format github` exits with `error=0`.
|
|
190
211
|
|
|
191
212
|
## Required Process
|
|
192
213
|
|
|
193
214
|
1. Stage 0: Preflight (stop on blockers).
|
|
194
215
|
2. Stage 1: Triage (classify + approve + persist Triage table).
|
|
195
216
|
3. Write `.qfai/report/preflight_summary.md`.
|
|
196
|
-
4. Phase 0: Contracts-first (UI-bearing targets normalize in this phase, and freeze root `DESIGN.md` per the Phase 0 DESIGN.md Freeze step below).
|
|
217
|
+
4. Phase 0: Contracts-first (UI-bearing targets normalize in this phase, and freeze root `DESIGN.md` per the Phase 0 DESIGN.md Freeze step below). Close Phase 0 with the cross-contract reconciliation step in `references/contract-artifact-rules.md#cross-contract-reconciliation-must`.
|
|
197
218
|
5. Phase 1: Outline (`_policies/01..11`).
|
|
198
|
-
6. Phase 2: Slice (per spec, gate each).
|
|
199
|
-
7. Phase
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
219
|
+
6. Phase 2: Slice (per spec, gate each with `npx qfai validate --profile sdd --fail-on error --spec <spec-id>` so a parallel worker gates on its own spec only and does not import a sibling agent's in-flight failures). A `--spec` run writes `<report>/validate.spec-<id>.json` and never the shared `validate.json` / `validate-<profile>.json`, so parallel workers cannot race on one file; an unknown or unparseable `--spec` value fails the run (`QFAI-SCOPE-001` / `QFAI-SCOPE-002`) instead of silently widening to the whole repo.
|
|
220
|
+
7. Phase 2b: Seed each target spec's `tdd/test-list.md` from `06_Test-Cases.md`
|
|
221
|
+
— one row per coverage-target TC, `Status = todo`; copy
|
|
222
|
+
`templates/specs/spec/tdd/test-list.md` when absent. Without it
|
|
223
|
+
`/qfai-implement` starts with zero selectable items. **Seeding is a delta,
|
|
224
|
+
not a regeneration, in both directions**: unchanged rows keep their state,
|
|
225
|
+
new TCs append at `todo`, and changed / removed TCs are reset or retired
|
|
226
|
+
under the upstream-reset rule (`references/sdd-phase-checklists.md`).
|
|
227
|
+
8. Phase 2c: Obligation reconciliation (per spec). Re-read `.qfai/contracts/**`
|
|
228
|
+
against the `BR` / `AC` Phase 2 produced: name the realizing contract for
|
|
229
|
+
each, and resolve every persisted attribute it names to a column, field or
|
|
230
|
+
enum member there — directly or by a stated join. Phase 0 froze the contracts
|
|
231
|
+
before these obligations existed, so this is the only step that checks they
|
|
232
|
+
are realizable. See
|
|
233
|
+
`references/contract-artifact-rules.md#obligation-reconciliation-must--phase-2c`.
|
|
234
|
+
Fix the contract or the obligation here; both are owned by this skill, and a
|
|
235
|
+
mismatch carried downstream reaches an implementer who can fix neither.
|
|
236
|
+
9. Phase 3: Plan finalize (after at least one slice gate passes).
|
|
237
|
+
10. Phase 4: Delta update.
|
|
238
|
+
11. Run validate; fix source-layer artifacts and rerun until `error=0`.
|
|
239
|
+
12. Triage density-smell warnings in `.qfai/report/specs-coverage/spec-*.md`.
|
|
240
|
+
|
|
241
|
+
## Work-log entries
|
|
242
|
+
|
|
243
|
+
Write a `.qfai/steering/<id>.md` entry when this stage hits one of the conditions in the `kind` trigger table of `.qfai/assistant/catalog/worklog-entry.schema.md` — `blocker`, `handoff`, `consultation-needed` and `decision` are the ones this stage reaches most. `npx qfai validate` polices the surface but nothing else asks for an entry, so an unwritten one is simply lost.
|
|
203
244
|
|
|
204
245
|
## Mandatory Outputs
|
|
205
246
|
|
|
206
247
|
- Shared `_policies/01..11` files
|
|
207
248
|
- Target `spec-*/01..10` files (with valid `Status:` bullet)
|
|
249
|
+
- `spec-*/16_Traceability-ledger.md` when the spec's `BR-*` / `AC-*` are linked to implementation
|
|
250
|
+
files (optional artifact; create or refresh it in the same change as the BR/AC it links, from
|
|
251
|
+
`templates/specs/spec/16_Traceability-ledger.md`). Without it `QFAI-TRACE-002` is emitted and the
|
|
252
|
+
BR/AC ↔ implementation integrity check (`QFAI-TRACE-001`) is skipped for that spec. See
|
|
253
|
+
`references/spec-traceability-rules.md#traceability-ledger-16_traceability-ledgermd`.
|
|
208
254
|
- Triage section in every changed `09_delta.md` (per-spec) or `_policies/10_delta.md` (cross-spec)
|
|
209
255
|
- Updated contracts under `.qfai/contracts/**`; UI-bearing targets normalize design/ui contracts
|
|
210
256
|
- `.qfai/report/preflight_summary.md`
|
|
@@ -220,16 +266,25 @@ When the target spec is UI-bearing, Phase 0 MUST freeze the brand SSOT:
|
|
|
220
266
|
missing, stop and ask the user to run `/qfai-discussion` (which
|
|
221
267
|
emits the draft) or to author it manually using the sample at
|
|
222
268
|
`.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample`.
|
|
223
|
-
2. Call `
|
|
269
|
+
2. Call `isUnreplacedDesignMdSample(text)`. If it returns `true`, the file
|
|
270
|
+
is still a qfai sample brand and MUST NOT be frozen: stop and ask the
|
|
271
|
+
user to author this product's own brand SSOT, deleting the
|
|
272
|
+
`QFAI-SAMPLE-DESIGN-MD` marker comment if present (samples from
|
|
273
|
+
releases older than the marker are recognised by content instead).
|
|
274
|
+
`npx qfai init` seeds the sample into the project root and never overwrites
|
|
275
|
+
it, so step 1's missing-file check cannot catch this — an unreplaced
|
|
276
|
+
sample parses and validates by construction, and freezing it binds
|
|
277
|
+
`/qfai-prototyping` and the reviewer lock rule to a fictional brand.
|
|
278
|
+
3. Call `parseDesignMd(text)`. If the result is `{ error: ParseError }`,
|
|
224
279
|
stop and report `path` / `code` / `message` for the parse error.
|
|
225
280
|
Otherwise the result is `{ data: DesignMd; body: string }`; pass
|
|
226
281
|
`data` to `validateDesignMd(data)`. If that issue list is
|
|
227
282
|
non-empty, stop and report each issue. Both functions, together with
|
|
228
283
|
`hashDesignMd` and the `DesignMd` / `ParseError` / `ParseResult` /
|
|
229
284
|
`ValidationIssue` types, are re-exported from the public `qfai`
|
|
230
|
-
package entry (`import { parseDesignMd, validateDesignMd, hashDesignMd } from "qfai"`).
|
|
231
|
-
|
|
232
|
-
|
|
285
|
+
package entry (`import { parseDesignMd, validateDesignMd, hashDesignMd, isUnreplacedDesignMdSample } from "qfai"`).
|
|
286
|
+
4. Call `hashDesignMd(text)` to compute sha256 over the raw bytes.
|
|
287
|
+
5. Write `.qfai/contracts/design/DESIGN.md.lock.yaml` from the
|
|
233
288
|
template at
|
|
234
289
|
`templates/contracts/design-md-lock.sample.yaml` with these fields:
|
|
235
290
|
- `designMdPath: "DESIGN.md"`
|
|
@@ -237,7 +292,7 @@ When the target spec is UI-bearing, Phase 0 MUST freeze the brand SSOT:
|
|
|
237
292
|
- `frozenAt: <UTC ISO-8601>`
|
|
238
293
|
- `schemaTokens.colors`, `fontFamilies`, `radii`, `shadows`
|
|
239
294
|
enumerated per the sample.
|
|
240
|
-
|
|
295
|
+
6. Record the freeze in `_policies/05_Contracts.md` under the Contract
|
|
241
296
|
Index. The lock yaml plus root `DESIGN.md` are the only brand
|
|
242
297
|
contract; per-aspect brand yaml contracts have been removed.
|
|
243
298
|
|
|
@@ -250,7 +305,14 @@ Run the full checklist from `references/sdd-quality-gate.md`. The gate also cove
|
|
|
250
305
|
|
|
251
306
|
## Evidence
|
|
252
307
|
|
|
253
|
-
Create `.qfai/evidence/sdd-<spec-id>.md`
|
|
308
|
+
Create `.qfai/evidence/sdd-<spec-id>.md` from `templates/evidence/sdd-spec.md`. That template is the
|
|
309
|
+
canonical layout for this artifact — copy it, keep every `##` heading in order, and fill it in.
|
|
310
|
+
|
|
311
|
+
Required sections, in order (the template is authoritative if the two ever disagree): Objective,
|
|
312
|
+
Inputs reviewed, Preflight summary path, Triage decisions (op + approver per row), Open questions,
|
|
313
|
+
Decisions made, Work performed, Commands executed, Validate evidence paths, Work Orders Summary,
|
|
314
|
+
Gaps / Open risks, Final status. Work Orders Summary uses the fixed 6-column schema from
|
|
315
|
+
`shared-skill-delegation-baseline.md`; its `Status` and `Final status` accept only `PASS` or `REVISE`.
|
|
254
316
|
|
|
255
317
|
## Done Declaration
|
|
256
318
|
|
|
@@ -270,7 +332,8 @@ When this skill completes, provide a final user-facing message enumerating next
|
|
|
270
332
|
- Proceed (recommended): `/qfai-prototyping`.
|
|
271
333
|
- Test-first path: `/qfai-atdd`.
|
|
272
334
|
- Spec pack needs correction: rerun `/qfai-sdd` and regenerate evidence.
|
|
273
|
-
- Confirm contracts referenced by `_policies/05_Contracts.md` exist under `.qfai/contracts
|
|
335
|
+
- Confirm contracts referenced by `_policies/05_Contracts.md` exist under `.qfai/contracts/**`,
|
|
336
|
+
and that Phase 2c reconciled every `BR` / `AC` against them — existence is not realizability.
|
|
274
337
|
|
|
275
338
|
## Default Autopilot Policy
|
|
276
339
|
|
|
@@ -295,6 +358,8 @@ A skill MAY narrow the auto-decide bucket (drop entries) but MUST NOT widen it.
|
|
|
295
358
|
|
|
296
359
|
project_memory:
|
|
297
360
|
|
|
298
|
-
- Phase order is fixed: Stage 0 Preflight → Stage 1 Triage → Phase 0 Contracts-first → Phase 1 Outline → Phase 2 Slice → Phase 3 Plan finalize → Phase 4 Delta update; do not reorder.
|
|
361
|
+
- Phase order is fixed: Stage 0 Preflight → Stage 1 Triage → Phase 0 Contracts-first → Phase 1 Outline → Phase 2 Slice → Phase 2b Seed tdd/test-list.md → Phase 2c Obligation reconciliation → Phase 3 Plan finalize → Phase 4 Delta update; do not reorder.
|
|
362
|
+
- Phase 2c reconciles contracts against the BR/AC written after them: Contracts-first freezes the contract before its obligations exist, and Phase 2c is the only step that checks they are realizable.
|
|
363
|
+
- Phase 2b seeds each target spec's tdd/test-list.md from 06_Test-Cases.md (one row per coverage-target TC, Status = todo) and is a delta: existing rows keep their TDD-ID, Status, Test file, Selector, DR-ID and Evidence.
|
|
299
364
|
- Append-first is the Stage 1 default: UPDATE on an active spec whose subject tokens overlap; CREATE only when there is zero overlap AND the REQ adds a new CAP-NNNN, registered before the CREATE row.
|
|
300
365
|
- Phase 0 DESIGN.md Freeze is mandatory for UI-bearing targets; .qfai/contracts/design/DESIGN.md.lock.yaml is the brand-lock SSOT.
|
|
@@ -20,11 +20,159 @@ Discussion UI/UX files are upstream discovery artifacts. `/qfai-sdd` normalizes
|
|
|
20
20
|
- `api/`, `db/`, and `ui/` contracts must declare `QFAI-CONTRACT-ID` at the top.
|
|
21
21
|
- Use prefixes `CON-API-*`, `CON-DB-*`, and `CON-UI-*`.
|
|
22
22
|
- `design/` files do not require `QFAI-CONTRACT-ID`, but they are execution-time SSOT for UI-bearing work.
|
|
23
|
+
- **Declare apply-order dependencies.** `QFAI-CONTRACT-011` makes a second
|
|
24
|
+
`QFAI-CONTRACT-ID` in one file a hard `error`, so any schema larger than one
|
|
25
|
+
table necessarily becomes N cross-referencing files. State the resulting
|
|
26
|
+
composition rather than leaving every consumer to reconstruct it from the DDL:
|
|
27
|
+
- `db/`: a comment line `-- Depends on: CON-DB-0002, CON-DB-0003` (or `-`)
|
|
28
|
+
- `api/` / `ui/`: `x-qfai-depends-on: [CON-API-0002]`, flow or block form
|
|
29
|
+
- Mirror the same list in `_policies/05_Contracts.md`'s `Depends On` column.
|
|
30
|
+
- **Apply order only.** A reference resolved at run time — a deferred foreign
|
|
31
|
+
key, an endpoint another calls during a request — is not an apply-order
|
|
32
|
+
dependency and must not be listed. The apply graph is acyclic by
|
|
33
|
+
construction; the runtime graph legitimately is not, and conflating them
|
|
34
|
+
makes the declaration unusable for ordering.
|
|
35
|
+
- `QFAI-CONTRACT-014` (error) reports a declared dependency naming a contract
|
|
36
|
+
that does not exist. Getting the set wrong is otherwise silent: the wrong
|
|
37
|
+
subset still applies cleanly and the tests still pass, against a schema
|
|
38
|
+
missing the tables under test.
|
|
39
|
+
- **Target schema is the applier's, not the contract's.** A `db/` contract
|
|
40
|
+
declares unqualified object names and is applied into whatever schema the
|
|
41
|
+
runner selects (`SET search_path`, `USE`, the connection's default). Do not
|
|
42
|
+
hard-code a schema qualifier: a contract that names one cannot be applied into
|
|
43
|
+
a per-test or per-tenant schema, which is what the integration layer needs.
|
|
23
44
|
- Breaking changes require delta notes.
|
|
24
45
|
- `_policies/05_Contracts.md` is the contract index; it must align with `.qfai/contracts/**` and must not become behavior SSOT.
|
|
25
46
|
|
|
47
|
+
## What validation checks in a `.sql` contract
|
|
48
|
+
|
|
49
|
+
Scope is **apply-ability, not semantic correctness**. `.sql` used to be the only
|
|
50
|
+
contract kind the validator never parsed — the "this contract does not parse" check
|
|
51
|
+
guarding UI and API files was unreachable for it — so a DB contract that cannot
|
|
52
|
+
run passed `npx qfai validate --profile sdd --fail-on error`. It now has a structural lane:
|
|
53
|
+
|
|
54
|
+
| Finding | Fires when | Severity |
|
|
55
|
+
| ------------------- | ----------------------------------------------------------------------------- | -------- |
|
|
56
|
+
| `QFAI-CONTRACT-021` | an unterminated string, comment or dollar-quoted body, or unbalanced `(` | error |
|
|
57
|
+
| `QFAI-DB-002` | one file creates the same object twice — only the last definition is in force | error |
|
|
58
|
+
|
|
59
|
+
`QFAI-DB-002` covers tables, views, indexes, functions, procedures, types and
|
|
60
|
+
domains. **Triggers are excluded**: a trigger name is unique per table, not per
|
|
61
|
+
schema, so two same-named triggers on different tables are correct SQL and
|
|
62
|
+
reporting them would be a false positive on valid input.
|
|
63
|
+
| `QFAI-DB-001` | a dangerous statement (`DROP TABLE`, `TRUNCATE`, …) | warning |
|
|
64
|
+
|
|
65
|
+
The statement splitter honours SQL quoting, so a `;` inside a literal, a
|
|
66
|
+
comment, a `$$ … $$` body or parentheses does not end a statement.
|
|
67
|
+
|
|
68
|
+
**Not checked**: nothing here type-checks a query, resolves a column, or
|
|
69
|
+
verifies the schema against the API contract. A green run means the file could
|
|
70
|
+
be handed to a database and does not contradict itself about what it defines —
|
|
71
|
+
it does not mean the schema is right. Cross-contract agreement remains the
|
|
72
|
+
authoring obligation below.
|
|
73
|
+
|
|
74
|
+
## Cross-contract Reconciliation (MUST)
|
|
75
|
+
|
|
76
|
+
Contracts are validated per file; agreement _between_ contracts is an authoring obligation.
|
|
77
|
+
|
|
78
|
+
- Every terminal state, status enum value, and error code an API contract mandates MUST have a
|
|
79
|
+
representable counterpart in the paired DB contract. An outcome the API requires but the DB
|
|
80
|
+
domain (`CHECK (... IN (...))`, `CREATE TYPE ... AS ENUM`, inline `ENUM(...)`) cannot store is a
|
|
81
|
+
contradiction, not an implementation detail.
|
|
82
|
+
- Failure and rejection paths count. If the API consumes a transaction on a validation failure,
|
|
83
|
+
the DB must have an honest terminal value for that failure — do not reuse a success state whose
|
|
84
|
+
own preconditions cannot hold on failure, and do not relabel a rejection as an expiry.
|
|
85
|
+
- Resolve the contradiction in the contracts, in Phase 0. Never resolve it downstream by
|
|
86
|
+
fabricating values that satisfy both.
|
|
87
|
+
- Record the pairing you reconciled in `_policies/05_Contracts.md` so the scope is declared rather
|
|
88
|
+
than guessed.
|
|
89
|
+
|
|
90
|
+
`QFAI-CONTRACT-040` mechanizes the state/status-domain part of this rule at `warning` severity. It
|
|
91
|
+
is a partial check: error codes, response-status sets, and non-enum domains are still reconciled by
|
|
92
|
+
the author and the reviewer gate.
|
|
93
|
+
|
|
94
|
+
## Executability (MUST)
|
|
95
|
+
|
|
96
|
+
A contract this file calls "downstream execution truth" has to have been
|
|
97
|
+
executed. Everything else qfai asserts about a `db/` contract — one
|
|
98
|
+
correctly-prefixed unique ID, four dangerous-SQL patterns at `warning` — is
|
|
99
|
+
satisfied by a file that cannot run.
|
|
100
|
+
|
|
101
|
+
- **Apply every `db/` contract to a scratch database.** Applying cleanly is the
|
|
102
|
+
floor, not the gate: contracts that apply without a single error still fail at
|
|
103
|
+
runtime, because the failure is a resolution error inside a PL/pgSQL body,
|
|
104
|
+
not a syntax error.
|
|
105
|
+
- **Drive every declared write path at least twice.** The second traversal is
|
|
106
|
+
what exercises head-advance and expected-version guards; a single pass proves
|
|
107
|
+
the first insert and nothing after it. Defects that appear only on traversal
|
|
108
|
+
two are a normal share of the total, not an exotic case.
|
|
109
|
+
- **Record it** in `.qfai/evidence/sdd-<spec-id>.md` as a line of the form:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
- Executability: CON-DB-NNNN — applied to scratch DB; every declared write path driven twice; <command> / <result>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`QFAI-CONTRACT-031` (`warning`) reports a `db/` contract with no such line. It
|
|
116
|
+
is a **presence check**: it does not execute SQL and makes no claim about
|
|
117
|
+
correctness. Neither a syntax-level parse nor a structural comparison would
|
|
118
|
+
have caught the observed defects, so a cheap record of "this was actually
|
|
119
|
+
driven" is what the omission needs.
|
|
120
|
+
|
|
121
|
+
The cost of skipping this is not paid in Phase 0. It is paid inside a TDD
|
|
122
|
+
micro-cycle, by an implementer who is forbidden from fixing the contract and has
|
|
123
|
+
to stop the batch.
|
|
124
|
+
|
|
125
|
+
## Obligation Reconciliation (MUST) — Phase 2c
|
|
126
|
+
|
|
127
|
+
Cross-contract reconciliation above compares contracts to each other. This
|
|
128
|
+
compares contracts to the **obligations written after them**.
|
|
129
|
+
|
|
130
|
+
Phase 0 authors contracts. `BR` / `AC` / `TC` are written in Phase 2. The
|
|
131
|
+
contract is therefore frozen before the obligations that must ride on it exist,
|
|
132
|
+
and "Contracts-first" is only defensible if something later checks that the
|
|
133
|
+
obligations are realizable. That check is this one, and it runs in **Phase 2c**,
|
|
134
|
+
after Phase 2b and before Phase 3 Plan finalize — early enough that a contract
|
|
135
|
+
change still flows into the plan and the delta.
|
|
136
|
+
|
|
137
|
+
For every `BR` / `AC` produced in Phase 2:
|
|
138
|
+
|
|
139
|
+
- **Name the contract that realizes it.** An obligation whose realizing
|
|
140
|
+
contract cannot be named is not reconciled; it is unowned.
|
|
141
|
+
- **Resolve every persisted attribute the obligation names to a concrete column,
|
|
142
|
+
field or enum member in that contract.** "Attribute" means anything the
|
|
143
|
+
obligation requires the system to store, distinguish or report on — an axis of
|
|
144
|
+
attribution, a status the obligation branches on, a value it aggregates by.
|
|
145
|
+
- **Reachability counts, not adjacency.** When the attribute lives in a
|
|
146
|
+
different relation, state the join that reaches it. If no join reaches it, the
|
|
147
|
+
obligation is unrealizable however valid both contracts are.
|
|
148
|
+
- **Vocabulary mixing is the usual cause, and it does not look like a typo.**
|
|
149
|
+
An obligation that mixes the vocabulary of two contracts designed for
|
|
150
|
+
different purposes — an operational ledger and an evidentiary one — reads
|
|
151
|
+
perfectly and cannot be satisfied by either. Two internally valid, mutually
|
|
152
|
+
consistent contracts is exactly the state in which this defect survives.
|
|
153
|
+
- Record the outcome per obligation, not per spec: which contract, which
|
|
154
|
+
columns/fields, and the join when one is needed.
|
|
155
|
+
|
|
156
|
+
**A failure here is resolved in the contract or in the obligation, in this
|
|
157
|
+
phase.** Both are owned by `/qfai-sdd`, so amending either is not drift — but
|
|
158
|
+
carrying the mismatch downstream is, because the implementer who eventually
|
|
159
|
+
meets it cannot fix either side.
|
|
160
|
+
|
|
161
|
+
Execution-based checking does not substitute for this. An obligation whose
|
|
162
|
+
attributes are missing produces a declared path that **succeeds** when driven:
|
|
163
|
+
the query returns rows, the endpoint answers, the suite is green. Failure
|
|
164
|
+
surfaces defects; this class is concealed by success, and only a reading of the
|
|
165
|
+
obligation against the contract finds it.
|
|
166
|
+
|
|
26
167
|
## Checklist
|
|
27
168
|
|
|
28
169
|
- Contract IDs exist and are unique.
|
|
29
170
|
- Specs reference only existing contract IDs.
|
|
30
171
|
- Design contracts are sufficient for prototyping, ATDD, and implementation without discussion-pack fallback.
|
|
172
|
+
- Every `db/` contract has been applied to a scratch database and every declared write path driven
|
|
173
|
+
**at least twice**, with the command and result recorded in `.qfai/evidence/sdd-<spec-id>.md`
|
|
174
|
+
(`QFAI-CONTRACT-031`).
|
|
175
|
+
- Every API-mandated terminal state / status value / error code is representable in the paired DB contract.
|
|
176
|
+
- Every `BR` / `AC` names a realizing contract, and every persisted attribute it names resolves to a
|
|
177
|
+
column, field or enum member there — reachable directly or by a stated join (Phase 2c).
|
|
178
|
+
- `QFAI-CONTRACT-040` findings are resolved or explicitly triaged, not carried forward.
|
|
@@ -24,15 +24,21 @@
|
|
|
24
24
|
- `architecture-reviewer`
|
|
25
25
|
- `product-surface-reviewer`
|
|
26
26
|
- `qa-gatekeeper`
|
|
27
|
-
- 各レビューは `PASS` / `
|
|
28
|
-
-
|
|
27
|
+
- 各レビューは `PASS` / `REVISE` を返す(in-flight のレビュアー応答の語彙。SSOT は
|
|
28
|
+
`.qfai/assistant/constitution/shared-skill-delegation-baseline.md` の `## Reviewer response template`)
|
|
29
|
+
- `REVISE` は review pack の `summary.json` を書き出す際に `status: "FAIL"` へ対応付けられる(同ファイルの
|
|
30
|
+
`### Verdict vocabulary` を参照)。第3の判定値を作らないこと
|
|
31
|
+
- `REVISE` が出たら、失敗 reviewer と修正影響を受ける reviewer のみ再実行する
|
|
29
32
|
|
|
30
33
|
---
|
|
31
34
|
|
|
32
35
|
## Validate Hard Gate(必須)
|
|
33
36
|
|
|
34
|
-
- 各 review cycle で `qfai validate --profile sdd --fail-on error --format github` を実行していること
|
|
35
|
-
- `.qfai/report/validate.log
|
|
37
|
+
- 各 review cycle で `npx qfai validate --profile sdd --fail-on error --format github` を実行していること
|
|
38
|
+
- `<paths.outDir>/validate.log`(既定 `.qfai/report/validate.log`)が存在し、最新の成果物に対応していること
|
|
39
|
+
- このファイルは `npx qfai validate` が実行のたびに自動で書き出す。`| tee` などのシェルリダイレクトは不要(PowerShell では動作しないため使用しない)
|
|
40
|
+
- `<paths.outDir>` は `qfai.config.yaml` の `paths.outDir`。既定以外に変更したプロジェクトでは `<paths.outDir>/validate.log` と `<paths.outDir>/run-*/` を見ること
|
|
41
|
+
- 最新性は `validate.log` の `run_log:` 行が最新の `run-*/` を指しているかで確認する
|
|
36
42
|
|
|
37
43
|
---
|
|
38
44
|
|
|
@@ -14,7 +14,7 @@ Use this file when you need the detailed review-cycle mechanics for `/qfai-sdd`.
|
|
|
14
14
|
2. Build one review pack for the current cycle only.
|
|
15
15
|
3. Apply the footer SSOT without rewriting it locally.
|
|
16
16
|
4. Collect verdicts.
|
|
17
|
-
5. If any blocking reviewer returns `
|
|
17
|
+
5. If any blocking reviewer returns `REVISE`, fix only the affected scope and rerun that reviewer plus any reviewer whose scope changed. `REVISE` is the in-flight verdict (`.qfai/assistant/constitution/shared-skill-delegation-baseline.md#reviewer-response-template`); it becomes `status: "FAIL"` only when the pack's `summary.json` is written.
|
|
18
18
|
6. Mark the cycle fixed only when all routed blocking reviewers return `PASS`.
|
|
19
19
|
|
|
20
20
|
## Required Outputs
|
|
@@ -27,6 +27,10 @@ Use this file when you need the detailed review-cycle mechanics for `/qfai-sdd`.
|
|
|
27
27
|
|
|
28
28
|
- `target.kind` must be `"spec"` for SDD review packs.
|
|
29
29
|
- Accepted serialized reviewer statuses are `PASS`, `FAIL`, and `NA`.
|
|
30
|
+
- `revision_form: "content-hash"` and `revision` are written like every other pack producer does:
|
|
31
|
+
the state these verdicts describe, as a git rev or `working-tree+<content hash>`
|
|
32
|
+
(`../../qfai-implement/references/evidence-revision.md`). A pack written without them fails the
|
|
33
|
+
repo-wide `/qfai-verify --fail-on error` even where the per-item profile passed.
|
|
30
34
|
|
|
31
35
|
## Guardrails
|
|
32
36
|
|
|
@@ -9,8 +9,10 @@ Use this file for the detailed sequencing rules behind `/qfai-sdd`.
|
|
|
9
9
|
3. **Phase 0 - Contracts-first**
|
|
10
10
|
4. **Phase 1 - Outline**
|
|
11
11
|
5. **Phase 2 - Slice** (per spec)
|
|
12
|
-
6. **Phase
|
|
13
|
-
7. **Phase
|
|
12
|
+
6. **Phase 2b - Seed `tdd/test-list.md`** (per spec)
|
|
13
|
+
7. **Phase 2c - Obligation reconciliation** (per spec)
|
|
14
|
+
8. **Phase 3 - Plan finalize** (per spec)
|
|
15
|
+
9. **Phase 4 - Delta update** (per spec)
|
|
14
16
|
|
|
15
17
|
## Stage 0: Preflight
|
|
16
18
|
|
|
@@ -40,6 +40,24 @@ Use these checklists as the detailed operational guide for `/qfai-sdd`.
|
|
|
40
40
|
- Ensure `01_Spec.md` remains the execution Primary SSOT.
|
|
41
41
|
- Stop if slice gate fails.
|
|
42
42
|
|
|
43
|
+
## Phase 2b: Seed `tdd/test-list.md`
|
|
44
|
+
|
|
45
|
+
- Copy `templates/specs/spec/tdd/test-list.md` when `<spec-id>/tdd/test-list.md` does not exist.
|
|
46
|
+
- Add one row per coverage-target TC from `06_Test-Cases.md`, `Status = todo`.
|
|
47
|
+
- Delta only: an unchanged TC's row keeps its `TDD-ID`, `Status`, `Test file`, `Selector`, `DR-ID` and `Evidence`.
|
|
48
|
+
- Reconcile changed and removed TCs: return a changed TC's row to `todo` under the upstream-reset rule (driving `CR-*` / `DR-*` in `DR-ID`), and retire the row of a TC deleted upstream or no longer a coverage target. Never leave a stale `done` row nor a selectable row for a TC that no longer exists.
|
|
49
|
+
- Keep the ledger table the first markdown table in the file.
|
|
50
|
+
- An empty table is a valid outcome when the spec declares no coverage-target TC.
|
|
51
|
+
|
|
52
|
+
## Phase 2c: Obligation reconciliation
|
|
53
|
+
|
|
54
|
+
- For every `BR` / `AC` this run produced, name the contract under `.qfai/contracts/**` that realizes it.
|
|
55
|
+
- Resolve every persisted attribute the obligation names to a column, field or enum member in that contract.
|
|
56
|
+
- When the attribute lives in another relation, state the join that reaches it. No join reaching it means the obligation is unrealizable, however valid both contracts are.
|
|
57
|
+
- Fix the contract or the obligation in this phase — both are owned by `/qfai-sdd`, and a mismatch carried downstream reaches an implementer who can fix neither.
|
|
58
|
+
- Record the outcome per obligation, not per spec.
|
|
59
|
+
- Full rule: `contract-artifact-rules.md#obligation-reconciliation-must--phase-2c`.
|
|
60
|
+
|
|
43
61
|
## Phase 3: Plan finalize
|
|
44
62
|
|
|
45
63
|
- Create or update `<spec-id>/10_Plan.md`.
|