its-magic 0.1.2-55 → 0.1.2

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/scripts/check_intake_template_parity.py +96 -0
  3. package/template/.cursor/commands/architecture.md +4 -0
  4. package/template/.cursor/commands/auto.md +110 -15
  5. package/template/.cursor/commands/discovery.md +4 -0
  6. package/template/.cursor/commands/execute.md +343 -291
  7. package/template/.cursor/commands/intake.md +4 -0
  8. package/template/.cursor/commands/map-codebase.md +4 -0
  9. package/template/.cursor/commands/memory-audit.md +4 -0
  10. package/template/.cursor/commands/milestone-complete.md +4 -0
  11. package/template/.cursor/commands/milestone-start.md +4 -0
  12. package/template/.cursor/commands/pause.md +4 -0
  13. package/template/.cursor/commands/phase-context.md +4 -0
  14. package/template/.cursor/commands/plan-verify.md +4 -0
  15. package/template/.cursor/commands/qa.md +226 -222
  16. package/template/.cursor/commands/quick.md +13 -0
  17. package/template/.cursor/commands/refresh-context.md +4 -0
  18. package/template/.cursor/commands/release.md +505 -487
  19. package/template/.cursor/commands/research.md +4 -0
  20. package/template/.cursor/commands/resume.md +4 -0
  21. package/template/.cursor/commands/security-review.md +4 -0
  22. package/template/.cursor/commands/sprint-plan.md +4 -0
  23. package/template/.cursor/commands/status-reconcile.md +4 -0
  24. package/template/.cursor/commands/verify-work.md +4 -0
  25. package/template/.cursor/dev-environment.json.example +22 -0
  26. package/template/.cursor/scratchpad.local.example.md +40 -3
  27. package/template/.cursor/scratchpad.md +324 -262
  28. package/template/.cursorignore +1 -0
  29. package/template/docs/engineering/auto-orchestration-reference.md +121 -14
  30. package/template/docs/engineering/context/installer-owned-paths.manifest +4 -1
  31. package/template/docs/engineering/runbook.md +207 -4
  32. package/template/scripts/check_intake_template_parity.py +96 -0
  33. package/template/scripts/dev_environment_lib.py +463 -0
  34. package/template/scripts/pack_json_validate.py +130 -0
  35. package/template/scripts/project_readme_coverage_lib.py +417 -0
  36. package/template/scripts/readme_feature_coverage_lib.py +2 -2
  37. package/template/scripts/validate_project_readme_coverage.py +151 -0
@@ -1,487 +1,505 @@
1
- ---
2
- description: "its-magic release: prepare release notes and runbook updates."
3
- ---
4
-
5
- # /release
6
-
7
- ## Subagents
8
- - release
9
-
10
- ## Execution model
11
- - Run `/release` in a fresh Release subagent context.
12
- - After writing outputs, stop and optionally hand off to `/refresh-context` in a
13
- new subagent/chat.
14
-
15
- ## Isolation evidence write requirement (US-0048 / DEC-0029)
16
-
17
- At the end of `/release`, append an isolation evidence entry to
18
- `docs/engineering/state.md`:
19
-
20
- - `phase_id=release`
21
- - `role=release`
22
- - `fresh_context_marker=<new marker for this subagent>`
23
- - `timestamp=<ISO UTC>`
24
- - `evidence_ref=<primary output ref>` (recommended: `sprints/Sxxxx/release-findings.md` and `handoffs/releases/Sxxxx-release-notes.md`)
25
-
26
- ## Inputs
27
- - `sprints/Sxxxx/summary.md` (target sprint)
28
- - `sprints/Sxxxx/qa-findings.md` (target sprint)
29
- - `sprints/Sxxxx/release-findings.md` (target sprint; create/update during release gate evaluation)
30
- - `sprints/Sxxxx/uat.json`
31
- - `sprints/Sxxxx/uat.md`
32
- - `docs/engineering/runbook.md`
33
- - `docs/engineering/state.md`
34
- - `handoffs/release_notes.md` (legacy compatibility pointer)
35
- - `handoffs/release_queue.md` (canonical queue tracker)
36
-
37
- ## Outputs (artifacts)
38
- - `handoffs/releases/Sxxxx-release-notes.md` (canonical per-sprint notes)
39
- - `handoffs/release_queue.md` (canonical queue state)
40
- - `handoffs/release_notes.md`
41
- - `sprints/Sxxxx/release-findings.md` (canonical post-QA release issue log)
42
- - `handoffs/release_to_dev.md` (if release gate blocks and remediation is needed)
43
- - `docs/engineering/runbook.md`
44
- - `docs/engineering/state.md`
45
-
46
- ## Stop conditions
47
- - Deploy command missing for requested environment
48
- - Decision gate triggered
49
- - Sprint identity unresolved
50
- - Queue/notes mismatch detected with no safe auto-remediation
51
-
52
- ## Canonical release artifacts (US-0040 / DEC-0020)
53
-
54
- - Canonical release history is sprint-scoped:
55
- `handoffs/releases/Sxxxx-release-notes.md`.
56
- - Canonical release state tracker is `handoffs/release_queue.md`.
57
- - Legacy compatibility file `handoffs/release_notes.md` remains supported as a
58
- latest-release pointer/summary (not canonical history storage).
59
- - Never overwrite release notes for non-target sprints.
60
-
61
- ## Release queue schema contract
62
-
63
- Each queue row must include at minimum:
64
- - `sprint_id`
65
- - `story_refs`
66
- - `status` (`planned|ready|unreleased|released|blocked`)
67
- - `last_updated` (ISO timestamp)
68
- - `release_notes_ref` (`handoffs/releases/Sxxxx-release-notes.md`)
69
- - `gate_snapshot` (gate summary or deterministic reason code)
70
- - `release_version` (optional until finalization)
71
-
72
- ## Deterministic target-sprint-only transition rules
73
-
74
- Allowed transitions per target sprint:
75
- - `planned -> ready -> unreleased -> released`
76
- - `blocked` may be set for deterministic failure conditions.
77
-
78
- Strict mutation semantics:
79
- - During one `/release` run, only the target sprint row may be created/updated.
80
- - Do not mutate unrelated sprint rows in `handoffs/release_queue.md`.
81
- - Do not write/update `handoffs/releases/Syyyy-release-notes.md` when target is
82
- `Sxxxx`.
83
-
84
- ## Release gate chain (US-0039 / DEC-0019)
85
-
86
- Mandatory gate order (strict, deterministic). No step may be skipped or reordered:
87
-
88
- 1. **Check-in test gate** Verify latest `TEST_COMMAND` result is passing; block on missing, stale, or failing evidence. When `TEST_COMMAND` runs the consolidated repo runner (`tests/run-tests.*`), passing results must include **US-0071** user-visible metadata guard coverage (positive, leak detection, idempotence); otherwise treat as incomplete release evidence for this repository (`METADATA_SANITIZATION_POLICY_MISSING` / missing regression row).
89
- 2. **QA completion gate** — Require no unresolved blocking findings in current sprint context before proceeding.
90
- 3. **UAT completion gate** Require UAT artifacts populated and verified; block on placeholder, incomplete, or unresolved-fail state.
91
- 4. **Isolation compliance gate** — Require valid per-phase isolation evidence (US-0048 / DEC-0029); block on missing/invalid/stale evidence or violation.
92
- 4b. **Strict runtime proof gate** — Require valid strict runtime attestation tuples (US-0056 / DEC-0038); block on missing/invalid/reused/stale/ambiguous proof linkage.
93
- 5. **Release finalization** — Only after gates 1–4 pass: write release notes, update queue, reconcile backlog/runbook/state.
94
-
95
- Optional runbook keys (`LINT_COMMAND`, `TYPECHECK_COMMAND`) are not mandatory release gates. When blank, they must not cause release to fail; report as `skipped`. Mandatory gates remain check-in test + QA + UAT + isolation only (US-0039 AC-10, US-0048).
96
-
97
- Default: no bypass. Override only via explicit decision gate with documented rationale and evidence (see Override evidence contract below).
98
-
99
- ## No-bypass default (US-0039)
100
-
101
- Release gates are mandatory by default. Bypass is not allowed unless an
102
- explicit decision gate is approved and evidence is recorded.
103
-
104
- Check-in test evidence: canonical source `tests/report.md`; valid = present + fresh + passing. Fail reasons: `RELEASE_TEST_EVIDENCE_MISSING`, `RELEASE_TEST_STALE`, `RELEASE_TEST_FAILED`. QA gate: no unresolved blocking findings; `RELEASE_QA_BLOCKERS_OPEN`, `RELEASE_QA_EVIDENCE_MISSING`. UAT gate: no placeholder/incomplete/unresolved-fail; `RELEASE_UAT_INCOMPLETE`, `RELEASE_UAT_FAILED`. Override evidence: decision record, rationale, approver, risk acceptance; `RELEASE_GATE_OVERRIDE_APPROVED`.
105
-
106
- ## QA completion evidence gate (US-0039)
107
-
108
- Release may not proceed until QA completion evidence shows no unresolved blocking findings for the target sprint.
109
-
110
- - **Evidence source**: `sprints/Sxxxx/qa-findings.md` (and optionally `handoffs/qa_to_dev.md` for handoff context).
111
- - **Pass condition**: No unresolved blocking or critical findings; QA phase has been run and findings recorded.
112
- - **Fail condition**: Unresolved blocking findings exist, or QA evidence is missing for target sprint — block with `RELEASE_QA_BLOCKERS_OPEN` or `RELEASE_QA_EVIDENCE_MISSING`; remediation: resolve blockers, re-run `/qa`, then rerun `/release`.
113
-
114
- ## Generated-test evidence prerequisite (US-0066 / DEC-0048)
115
-
116
- For generated-project scope, release evidence must include deterministic
117
- generated-test auto-run references:
118
-
119
- - **Execution evidence source**: `sprints/Sxxxx/summary.md` generated baseline
120
- test section (stack profile, generated paths, scaffold actions).
121
- - **QA evidence source**: `sprints/Sxxxx/qa-findings.md` generated-test auto-run
122
- fields (`generated_test_command`, `generated_test_result`,
123
- `generated_test_output_ref`, `generated_test_paths_ref`,
124
- `generated_test_reason_code`).
125
- - **Pass condition**: generated-test evidence exists, is traceable, and does not
126
- contradict QA/runtime verdicts.
127
- - **Fail condition**: missing/ambiguous generated-test evidence or unresolved
128
- scaffold failure reason code; block release with
129
- `TEST_SCAFFOLD_GENERATION_FAILED` and rerun `/execute` and/or `/qa`.
130
-
131
- ## UAT completion gate (US-0039)
132
-
133
- Release may not proceed until UAT artifacts are in verified state (no placeholder, incomplete, or unresolved-fail).
134
-
135
- - **Evidence sources**: `sprints/Sxxxx/uat.json`, `sprints/Sxxxx/uat.md` (per DEC-0009).
136
- - **Pass condition**: All UAT steps populated with results; `passed` + `failed` = total; no unresolved fail state; not placeholder-only content.
137
- - **Fail conditions** (block release with remediation):
138
- - **Placeholder**: UAT steps empty or template-only — `RELEASE_UAT_INCOMPLETE`; run `/verify-work`, populate steps, rerun `/release`.
139
- - **Incomplete**: Steps exist but not all have results or counts inconsistent — `RELEASE_UAT_INCOMPLETE`; complete UAT, rerun `/release`.
140
- - **Unresolved fail**: One or more steps recorded as failed and not resolved `RELEASE_UAT_FAILED`; resolve failures or document acceptance, then rerun `/release`.
141
-
142
- Do not infer pass from missing or placeholder UAT; block and emit the appropriate reason code.
143
-
144
- ## Backlog reconciliation contract (US-0043 / DEC-0021)
145
-
146
- At release finalization boundary, reconcile backlog state for target sprint
147
- stories using canonical release evidence precedence.
148
-
149
- Canonical evidence precedence:
150
- 1. `handoffs/release_queue.md` target sprint row (`released` required)
151
- 2. `handoffs/releases/Sxxxx-release-notes.md` gate summary
152
- 3. `sprints/Sxxxx/qa-findings.md`
153
- 4. `sprints/Sxxxx/uat.json` and `sprints/Sxxxx/uat.md`
154
- 5. `sprints/Sxxxx/release-findings.md` (if present)
155
-
156
- Deterministic reconciliation behavior:
157
- - mutate only target sprint story blocks in `docs/product/backlog.md`
158
- - set target story `Status: DONE` when mandatory release evidence is PASS
159
- - reconcile target story acceptance checkboxes to checked state
160
- - never mutate unrelated backlog stories
161
- - if contradiction is detected (for example sprint is `released` but backlog
162
- story remains OPEN/unchecked), fail safe with reason code
163
- `BACKLOG_STATUS_DRIFT` and remediation guidance
164
-
165
- ## Canonical status source and global drift guard (US-0045 / DEC-0025)
166
-
167
- Canonical ownership:
168
- - Story status (`OPEN|DONE`) is authoritative in `docs/product/backlog.md`.
169
- - `docs/product/acceptance.md` and `docs/engineering/state.md` are derived views.
170
-
171
- Deterministic reconciliation precedence:
172
- 1. `docs/product/backlog.md` story status (canonical status owner)
173
- 2. target sprint release evidence (`handoffs/release_queue.md`,
174
- `handoffs/releases/Sxxxx-release-notes.md`, `sprints/Sxxxx/qa-findings.md`,
175
- `sprints/Sxxxx/uat.json`, `sprints/Sxxxx/uat.md`, `sprints/Sxxxx/release-findings.md`)
176
- 3. derived-view updates (`docs/product/acceptance.md`, `docs/engineering/state.md`)
177
-
178
- Guardrails:
179
- - Mutations remain target-scoped; never rewrite unrelated stories/sprints.
180
- - On contradictory canonical vs release evidence at reconciliation boundary,
181
- fail closed with `CANONICAL_STATUS_CONFLICT` and remediation guidance.
182
- - Normalization and reconciliation outputs must be auditable in
183
- `docs/engineering/status-normalization-report.md`.
184
-
185
- ## Steps
186
- 1. Resolve target sprint identity from current sprint context.
187
- - If unresolved, fail closed:
188
- - do not write any sprint-scoped notes file,
189
- - do not mutate another sprint queue row,
190
- - record/update blocked queue row keyed as `UNKNOWN` with reason
191
- `RELEASE_SPRINT_UNRESOLVED`,
192
- - include remediation guidance (set explicit sprint context and rerun).
193
- 2. Verify sync-policy prerequisite evidence (US-0038):
194
- - Latest sync verdict must include deterministic evidence fields:
195
- `phase_boundary`, `policy_mode`, `checks`, `push_decision`, `reason_code`,
196
- `evidence_refs`.
197
- - `TEST_COMMAND` baseline evidence is mandatory for any push-eligible path.
198
- - Optional checks (`LINT_COMMAND`, `TYPECHECK_COMMAND`) are required only when
199
- configured; missing optional commands must be reported as `skipped`, not fail.
200
- - If baseline test evidence fails, append/update `sprints/Sxxxx/release-findings.md`
201
- with `RELEASE_TEST_FAILED`, include evidence refs/remediation, write
202
- `handoffs/release_to_dev.md`, and stop.
203
- 3. Enforce blocker-aware release safety:
204
- - If unresolved blocking QA findings or unresolved critical issues exist,
205
- require `no_push` semantics (`BLOCKING_QA_FINDINGS`) and hold release until
206
- remediation evidence is present.
207
- - Record blocking findings in `sprints/Sxxxx/release-findings.md` and handoff
208
- in `handoffs/release_to_dev.md` before stopping.
209
- 3a. Optional compatibility critical gate (US-0034):
210
- - If `CROSS_REPO_OBSERVABILITY=0`, skip with zero required overhead.
211
- - If `CROSS_REPO_OBSERVABILITY=1`, read
212
- `docs/engineering/compatibility-report.md`.
213
- - If unresolved `critical` compatibility findings exist and
214
- `COMPATIBILITY_GATE_ON_CRITICAL=1`, trigger decision gate and stop release
215
- progression with reason code `COMPATIBILITY_CRITICAL_OPEN`.
216
- 3b. Optional component-scope gate (US-0035):
217
- - If `COMPONENT_SCOPE_MODE=0`, skip with zero required overhead.
218
- - If `COMPONENT_SCOPE_MODE=1`, read
219
- `docs/engineering/component-scope-report.md`.
220
- - If unapproved out-of-scope impact remains open, trigger decision gate and
221
- stop release progression with reason code
222
- `COMPONENT_SCOPE_VIOLATION_UNAPPROVED`.
223
- 3c. Optional spec-pack completeness gate (US-0031):
224
- - If `SPEC_PACK_MODE=0`, skip with zero required overhead.
225
- - If `SPEC_PACK_MODE=1`, validate target-story spec-pack artifacts per
226
- runbook (Design Concept, CRS, Technical Specification); required sections
227
- must be present and non-empty. If any required section is missing, block
228
- release with reason code `SPEC_PACK_INCOMPLETE` and remediation guidance.
229
- 3d. Optional user-guide completeness gate (US-0032):
230
- - If `USER_GUIDE_MODE=0`, skip with zero required overhead.
231
- - If `USER_GUIDE_MODE=1`, validate target-story user guide at
232
- `docs/user-guides/US-xxxx.md` per runbook (minimum required sections);
233
- if guide missing or required sections absent, block release with reason
234
- code `USER_GUIDE_INCOMPLETE` and remediation guidance.
235
- 3e. Legacy drift guard (US-0049 / DEC-0031):
236
- - Run legacy-drift detection over DONE stories (backlog DONE and acceptance
237
- unchecked OR traceability/state lacks entry OR release artifacts lack
238
- representation). If legacy drift is detected, either block with reason code
239
- (`BACKLOG_DONE_ACCEPTANCE_UNCHECKED`, `BACKLOG_DONE_TRACEABILITY_MISSING`,
240
- `BACKLOG_DONE_RELEASE_ARTIFACT_MISSING`) and remediation, or perform
241
- target-scoped repair and append entry to `docs/engineering/legacy-drift-audit.md`.
242
- - Behavior is deterministic and documented in runbook; do not mutate
243
- unrelated stories.
244
- 3f. README feature coverage gate (US-0091 / DEC-0074):
245
- - Read merged scratchpad `README_FEATURE_COVERAGE_ENFORCE` (default `0`).
246
- - When `0`: skip with `skipped` evidence in `sprints/Sxxxx/release-findings.md`
247
- § doc gates (grandfathering / migration pass).
248
- - When `1`: run
249
- `python scripts/validate_readme_feature_coverage.py --repo . --enforce`.
250
- - On failure: emit `README_FEATURE_COVERAGE_BLOCKED` plus sub-codes on stderr;
251
- remediation lists each missing id and target `root_h2` / `dev_h2` from
252
- `docs/engineering/context/readme-section-affinity.json`.
253
- - Active + `template/.cursor/commands/release.md` byte-identical step **3f**
254
- block (full-file parity per US-0017).
255
- 4. Verify UAT completeness (DEC-0009): confirm all sprint UAT artifacts (`uat.json`,
256
- `uat.md`) are in populated/verified state per DEC-0009. All steps must have
257
- recorded results. If any UAT is placeholder or incomplete, block release and
258
- recommend `/verify-work`.
259
- - Record `RELEASE_UAT_INCOMPLETE` in `sprints/Sxxxx/release-findings.md` with
260
- remediation and evidence refs before stop.
261
- 4a. Isolation compliance gate (US-0048 / DEC-0029): verify per-phase isolation
262
- evidence is present and valid in `docs/engineering/state.md` for the target
263
- sprint lifecycle (at minimum: `execute`, `qa`, `verify-work`).
264
- - Missing evidence: block with `PHASE_CONTEXT_ISOLATION_MISSING`
265
- - Invalid schema/fields: block with `ISOLATION_EVIDENCE_INVALID`
266
- - Stale/reused evidence: block with `ISOLATION_EVIDENCE_STALE`
267
- - Orchestrator/phase executed without fresh subagent: block with
268
- `PHASE_CONTEXT_ISOLATION_VIOLATION`
269
- - **Phase role alignment (US-0069 / DEC-0051)**: each entry's `role` must
270
- match the canonical expected role for its `phase_id` (matrix + scratchpad
271
- alternates as documented in `/auto`). Mismatch `PHASE_ROLE_MISMATCH`.
272
- - Remediation: re-run the affected phase(s) in fresh subagent contexts,
273
- write new isolation evidence, then rerun `/release`.
274
- 4b. Strict runtime proof gate (US-0056 / DEC-0038): verify strict runtime-proof
275
- tuples are present and valid for target lifecycle phases (`execute`, `qa`,
276
- `verify-work`) and deterministically linked to checkpoint evidence.
277
- - Missing tuple: block with `RUNTIME_PROOF_MISSING`
278
- - Invalid tuple/hash/linkage: block with `RUNTIME_PROOF_INVALID`
279
- - Reused `runtime_proof_id`: block with `RUNTIME_PROOF_REUSED`
280
- - Expired/stale proof: block with `RUNTIME_PROOF_STALE`
281
- - Ambiguous proof-to-checkpoint linkage: block with
282
- `RUNTIME_PROOF_AMBIGUOUS_LINK`
283
- - **Strict-proof role alignment (US-0069 / DEC-0051)**: tuple `role` must
284
- equal the sibling isolation evidence `role` and the expected phase contract
285
- role; `proof_hash` must be consistent with sorted-key JSON of the tuple
286
- fields per `DEC-0038`. Violation → `RUNTIME_PROOF_INVALID` or
287
- `PHASE_ROLE_MISMATCH` as applicable.
288
- - Remediation: rerun affected phase(s), write fresh runtime proof tuples,
289
- then rerun `/release`.
290
- 5. Ensure target queue row exists; set status to `unreleased` before finalization.
291
- - Create row if missing.
292
- - Set `release_notes_ref` to target sprint notes path.
293
- - Keep all non-target rows unchanged.
294
- 6. Write/update only target sprint notes at:
295
- `handoffs/releases/Sxxxx-release-notes.md`.
296
- - Preserve any existing historical sprint file content unless explicitly
297
- working on that same sprint.
298
- 7. Perform legacy migration/backfill check (one-time, non-destructive):
299
- - If legacy content exists only in `handoffs/release_notes.md` and target
300
- sprint can be resolved, backfill target sprint file without deleting legacy.
301
- - If legacy sprint context is unresolved, keep legacy file unchanged and
302
- record `LEGACY_NOTES_SPRINT_UNRESOLVED` with manual migration guidance.
303
- - Migration must be idempotent; do not overwrite existing target sprint notes
304
- as part of backfill.
305
- 8. Run mismatch fail-safe checks before finalization:
306
- - If queue row missing for resolved sprint: reason `QUEUE_ENTRY_MISSING`.
307
- - If queue row missing `release_notes_ref`: reason `NOTES_REF_MISSING`.
308
- - If attempted transition is invalid: reason `STATUS_TRANSITION_INVALID`.
309
- - For any mismatch: fail closed, preserve existing notes, keep queue in
310
- `unreleased` or `blocked`, and include remediation guidance.
311
- - Append/update `sprints/Sxxxx/release-findings.md` and
312
- `handoffs/release_to_dev.md` for blocked outcomes.
313
- 9. On successful finalization, transition only target sprint:
314
- `unreleased -> released`.
315
- - Update `last_updated`, `release_version` (when available), and gate summary.
316
- 10. Reconcile target story backlog status + acceptance checkboxes in
317
- `docs/product/backlog.md` using US-0043 and US-0045 contracts.
318
- - Apply only to target sprint-linked stories.
319
- - If contradictory states remain after reconciliation attempt, fail closed
320
- with `BACKLOG_STATUS_DRIFT` or `CANONICAL_STATUS_CONFLICT`, write
321
- remediation guidance, and stop.
322
- 11. Reconcile derived status views from canonical backlog status:
323
- - update linked rows/checklists in `docs/product/acceptance.md`,
324
- - append deterministic status checkpoint in `docs/engineering/state.md`,
325
- - preserve non-target entries unchanged.
326
- 12. If one-time normalization baseline is missing, run the documented
327
- normalization pass and write auditable report rows to
328
- `docs/engineering/status-normalization-report.md` (story id, prior values,
329
- resolved values, evidence refs, timestamp).
330
- 13. Update backward-compatible legacy file `handoffs/release_notes.md` as
331
- latest-release pointer and summary:
332
- - include latest released sprint id,
333
- - include pointer to canonical sprint-scoped notes file,
334
- - include visibility section for unreleased queue entries.
335
- 14. Update runbook/state readiness and evidence references for release outcome.
336
- - On pass, ensure `sprints/Sxxxx/release-findings.md` records release outcome
337
- (`PASS`) and references final evidence artifacts.
338
- 15. If `AUTO_RELEASE_NOTES=1` in `.cursor/scratchpad.md`, generation logic must
339
- still target sprint-scoped notes first and update legacy pointer second.
340
- 16. Optional configurable publish targets (US-0054 / DEC-0036):
341
- - Read `.cursor/scratchpad.md`:
342
- - `RELEASE_PUBLISH_MODE=disabled|confirm|auto`
343
- - `RELEASE_TARGETS_FILE`
344
- - `RELEASE_TARGETS_DEFAULT`
345
- - If `RELEASE_PUBLISH_MODE=disabled`, skip publish target execution with
346
- deterministic no-op evidence.
347
- - Validate target schema in `RELEASE_TARGETS_FILE` before execution:
348
- - stable `id`, `type`, `enabled`, `order`,
349
- - supported `type`: `npm|choco|brew|git|docker|cloud|custom|ssh`,
350
- - env-reference-only secret fields (`*Env`) for sensitive values.
351
- - fail fast on invalid/missing required fields with
352
- `PUBLISH_TARGET_CONFIG_INVALID`.
353
- - Resolve selected targets (explicit request, else
354
- `RELEASE_TARGETS_DEFAULT`), filter `enabled=true`, and execute in
355
- deterministic order (`order`, then `id`).
356
- - If `RELEASE_PUBLISH_MODE=confirm`, require explicit operator confirmation
357
- before execution; if confirmation is denied/absent, stop with
358
- `PUBLISH_CONFIRMATION_REQUIRED`.
359
- - For `ssh` targets, require `hostEnv`, `userEnv`, `authEnv`, and
360
- `remoteCommand`. Missing required fields fail with
361
- `PUBLISH_TARGET_CONFIG_INVALID`.
362
- - If target execution fails, emit `PUBLISH_TARGET_EXECUTION_FAILED` with
363
- target ID and remediation; do not mutate unrelated release artifacts.
364
- 17. Remote runtime connectivity contract (US-0064 / DEC-0044):
365
- - Extend target interpretation with runtime metadata from
366
- `RELEASE_TARGETS_FILE`:
367
- - `runtime.mode` (`local|remote`),
368
- - endpoint fields (`domainEnv|ipEnv|hostEnv`, `port`, `protocol`),
369
- - optional ingress metadata (`traefik.enabled`, `router`, `entrypoint`,
370
- `tls`),
371
- - optional `dockerOverSsh` contract for ssh targets.
372
- - Validate remote connectivity fields for remote-mode targets; fail with
373
- `REMOTE_CONNECTIVITY_CONFIG_INVALID` on missing/invalid requirements.
374
- - Write/update canonical operator doc:
375
- `docs/engineering/runtime-connectivity.md` with sanitized endpoint summary
376
- and local vs remote execution context.
377
- - In release output/handoffs, include operator connection guidance
378
- (where hosted, how to connect) without exposing secrets.
379
- 18. Release operator Run/Connect/Verify hints contract (US-0067 / DEC-0049):
380
- - `handoffs/releases/Sxxxx-release-notes.md` must include a deterministic
381
- operator section order and required fields:
382
- 1) `## Run`:
383
- - `start_command`
384
- - `runtime_mode` (`local|remote`)
385
- - `runtime_context_ref` (link to `docs/engineering/runtime-connectivity.md`
386
- when available)
387
- 2) `## Connect`:
388
- - `service_url`
389
- - `service_port`
390
- - `health_endpoint`
391
- 3) `## Verify`:
392
- - `verification_steps` (deterministic numbered list)
393
- - `expected_health_signal`
394
- 4) `## Credentials`:
395
- - env-reference-only credential source refs (for example `API_TOKEN_ENV`)
396
- - expected value source location guidance (for example CI secret store,
397
- operator shell profile) with no inline secret values
398
- 5) `## Known Issues`:
399
- - concise deterministic known issues list, or explicit `None`.
400
- - `handoffs/release_notes.md` must include a concise latest release operator
401
- summary (start command + endpoint + verify pointer) and link to canonical
402
- sprint notes.
403
- - Fail closed when required operator hints are missing/ambiguous or contain
404
- inline secrets:
405
- - `RELEASE_OPERATOR_HINTS_MISSING`
406
- - `RELEASE_OPERATOR_HINTS_AMBIGUOUS`
407
- - `RELEASE_OPERATOR_HINTS_SECRET_EXPOSURE`
408
- - Remediation: populate required fields in canonical sprint notes with
409
- sanitized env-ref-only credential guidance, then rerun `/release`.
410
-
411
- ## Fail-safe reason codes and remediation guidance
412
-
413
- Required deterministic reason codes:
414
- - `RELEASE_SPRINT_UNRESOLVED`
415
- - `RELEASE_TEST_FAILED`
416
- - `RELEASE_QA_BLOCKERS_OPEN`
417
- - `RELEASE_QA_EVIDENCE_MISSING`
418
- - `RELEASE_UAT_INCOMPLETE`
419
- - `RELEASE_UAT_FAILED`
420
- - `PHASE_CONTEXT_ISOLATION_MISSING`
421
- - `PHASE_CONTEXT_ISOLATION_VIOLATION`
422
- - `ISOLATION_EVIDENCE_STALE`
423
- - `ISOLATION_EVIDENCE_INVALID`
424
- - `RUNTIME_PROOF_MISSING`
425
- - `RUNTIME_PROOF_INVALID`
426
- - `RUNTIME_PROOF_REUSED`
427
- - `RUNTIME_PROOF_STALE`
428
- - `RUNTIME_PROOF_AMBIGUOUS_LINK`
429
- - `RELEASE_GATE_OVERRIDE_APPROVED`
430
- - `LEGACY_NOTES_SPRINT_UNRESOLVED`
431
- - `QUEUE_ENTRY_MISSING`
432
- - `NOTES_REF_MISSING`
433
- - `STATUS_TRANSITION_INVALID`
434
- - `BACKLOG_STATUS_DRIFT`
435
- - `CANONICAL_STATUS_CONFLICT`
436
- - `COMPATIBILITY_CRITICAL_OPEN`
437
- - `COMPONENT_SCOPE_VIOLATION_UNAPPROVED`
438
- - `SPEC_PACK_INCOMPLETE`
439
- - `USER_GUIDE_INCOMPLETE`
440
- - `BACKLOG_DONE_ACCEPTANCE_UNCHECKED`
441
- - `BACKLOG_DONE_TRACEABILITY_MISSING`
442
- - `BACKLOG_DONE_RELEASE_ARTIFACT_MISSING`
443
- - `PUBLISH_TARGET_CONFIG_INVALID`
444
- - `PUBLISH_CONFIRMATION_REQUIRED`
445
- - `PUBLISH_TARGET_EXECUTION_FAILED`
446
- - `REMOTE_CONNECTIVITY_CONFIG_INVALID`
447
- - `RUNTIME_CONNECTIVITY_DOC_WRITE_FAILED`
448
- - `RELEASE_OPERATOR_HINTS_MISSING`
449
- - `RELEASE_OPERATOR_HINTS_AMBIGUOUS`
450
- - `RELEASE_OPERATOR_HINTS_SECRET_EXPOSURE`
451
- - `PHASE_OWNERSHIP_VIOLATION`
452
- - `PHASE_OVERRIDE_EVIDENCE_MISSING`
453
- - `TEST_SCAFFOLD_STACK_UNRESOLVED`
454
- - `TEST_SCAFFOLD_UNSUPPORTED_STACK`
455
- - `TEST_SCAFFOLD_GENERATION_FAILED`
456
-
457
- When any reason code is emitted:
458
- - Preserve existing release note artifacts (non-destructive default).
459
- - Do not auto-reconcile by deleting/rebuilding unrelated sprint history.
460
- - Provide actionable remediation steps and require rerun after correction.
461
-
462
- ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
463
-
464
- - Mutations in `/release` must comply with
465
- `docs/engineering/artifact-ordering-policy.md`.
466
- - Ordering expectations:
467
- - `docs/engineering/state.md`: append-bottom checkpoint entries only.
468
- - `docs/product/backlog.md` + `docs/product/acceptance.md`: target story
469
- normalization while preserving sorted-canonical order.
470
- - `handoffs/release_queue.md`: append one target sprint row/update in-place for
471
- that row only.
472
- - `handoffs/release_notes.md`: update latest pointer section first; keep
473
- historical list stable.
474
- - Missing/ambiguous placement anchors must fail with
475
- `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and no partial mutation.
476
-
477
- ## Cross-phase ownership guard (US-0061 / DEC-0043)
478
-
479
- - `/release` mutations must also satisfy
480
- `docs/engineering/artifact-ownership-policy.md`.
481
- - Release may mutate only release-owned scopes (target sprint queue row, release
482
- notes pointer/sprint notes, and target story reconciliation surfaces).
483
- - Cross-phase non-owned section rewrites/deletions fail closed with
484
- `PHASE_OWNERSHIP_VIOLATION`.
485
- - If an override-authorized mutation path is configured but override evidence is
486
- missing, fail closed with `PHASE_OVERRIDE_EVIDENCE_MISSING`.
487
-
1
+ ---
2
+ description: "its-magic release: prepare release notes and runbook updates."
3
+ ---
4
+
5
+ # /release
6
+
7
+ ## Subagents
8
+ - release
9
+
10
+ ## Execution model
11
+ - Run `/release` in a fresh Release subagent context.
12
+ - After writing outputs, stop and optionally hand off to `/refresh-context` in a
13
+ new subagent/chat.
14
+
15
+ ## Isolation evidence write requirement (US-0048 / DEC-0029)
16
+
17
+ At the end of `/release`, append an isolation evidence entry to
18
+ `docs/engineering/state.md`:
19
+
20
+ - `phase_id=release`
21
+ - `role=release`
22
+ - `fresh_context_marker=<new marker for this subagent>`
23
+ - `timestamp=<ISO UTC>`
24
+ - `evidence_ref=<primary output ref>` (recommended: `sprints/Sxxxx/release-findings.md` and `handoffs/releases/Sxxxx-release-notes.md`)
25
+
26
+ ## Inputs
27
+
28
+ - **Narrow-read (US-0053 / US-0096 Tranche A)**: Start at docs/engineering/phase-context.md
29
+ and the story section anchor in vision/architecture/decisions when a heading exists; forbid
30
+ full-file reads when a section heading exists.
31
+ - `sprints/Sxxxx/summary.md` (target sprint)
32
+ - `sprints/Sxxxx/qa-findings.md` (target sprint)
33
+ - `sprints/Sxxxx/release-findings.md` (target sprint; create/update during release gate evaluation)
34
+ - `sprints/Sxxxx/uat.json`
35
+ - `sprints/Sxxxx/uat.md`
36
+ - `docs/engineering/runbook.md`
37
+ - `docs/engineering/state.md`
38
+ - `handoffs/release_notes.md` (legacy compatibility pointer)
39
+ - `handoffs/release_queue.md` (canonical queue tracker)
40
+
41
+ ## Outputs (artifacts)
42
+ - `handoffs/releases/Sxxxx-release-notes.md` (canonical per-sprint notes)
43
+ - `handoffs/release_queue.md` (canonical queue state)
44
+ - `handoffs/release_notes.md`
45
+ - `sprints/Sxxxx/release-findings.md` (canonical post-QA release issue log)
46
+ - `handoffs/release_to_dev.md` (if release gate blocks and remediation is needed)
47
+ - `docs/engineering/runbook.md`
48
+ - `docs/engineering/state.md`
49
+
50
+ ## Stop conditions
51
+ - Deploy command missing for requested environment
52
+ - Decision gate triggered
53
+ - Sprint identity unresolved
54
+ - Queue/notes mismatch detected with no safe auto-remediation
55
+
56
+ ## Canonical release artifacts (US-0040 / DEC-0020)
57
+
58
+ - Canonical release history is sprint-scoped:
59
+ `handoffs/releases/Sxxxx-release-notes.md`.
60
+ - Canonical release state tracker is `handoffs/release_queue.md`.
61
+ - Legacy compatibility file `handoffs/release_notes.md` remains supported as a
62
+ latest-release pointer/summary (not canonical history storage).
63
+ - Never overwrite release notes for non-target sprints.
64
+
65
+ ## Release queue schema contract
66
+
67
+ Each queue row must include at minimum:
68
+ - `sprint_id`
69
+ - `story_refs`
70
+ - `status` (`planned|ready|unreleased|released|blocked`)
71
+ - `last_updated` (ISO timestamp)
72
+ - `release_notes_ref` (`handoffs/releases/Sxxxx-release-notes.md`)
73
+ - `gate_snapshot` (gate summary or deterministic reason code)
74
+ - `release_version` (optional until finalization)
75
+
76
+ ## Deterministic target-sprint-only transition rules
77
+
78
+ Allowed transitions per target sprint:
79
+ - `planned -> ready -> unreleased -> released`
80
+ - `blocked` may be set for deterministic failure conditions.
81
+
82
+ Strict mutation semantics:
83
+ - During one `/release` run, only the target sprint row may be created/updated.
84
+ - Do not mutate unrelated sprint rows in `handoffs/release_queue.md`.
85
+ - Do not write/update `handoffs/releases/Syyyy-release-notes.md` when target is
86
+ `Sxxxx`.
87
+
88
+ ## Release gate chain (US-0039 / DEC-0019)
89
+
90
+ Mandatory gate order (strict, deterministic). No step may be skipped or reordered:
91
+
92
+ 1. **Check-in test gate** — Verify latest `TEST_COMMAND` result is passing; block on missing, stale, or failing evidence. When `TEST_COMMAND` runs the consolidated repo runner (`tests/run-tests.*`), passing results must include **US-0071** user-visible metadata guard coverage (positive, leak detection, idempotence); otherwise treat as incomplete release evidence for this repository (`METADATA_SANITIZATION_POLICY_MISSING` / missing regression row).
93
+ 2. **QA completion gate** — Require no unresolved blocking findings in current sprint context before proceeding.
94
+ 3. **UAT completion gate** — Require UAT artifacts populated and verified; block on placeholder, incomplete, or unresolved-fail state.
95
+ 4. **Isolation compliance gate** Require valid per-phase isolation evidence (US-0048 / DEC-0029); block on missing/invalid/stale evidence or violation.
96
+ 4b. **Strict runtime proof gate** — Require valid strict runtime attestation tuples (US-0056 / DEC-0038); block on missing/invalid/reused/stale/ambiguous proof linkage.
97
+ 5. **Release finalization** Only after gates 1–4 pass: write release notes, update queue, reconcile backlog/runbook/state.
98
+
99
+ Optional runbook keys (`LINT_COMMAND`, `TYPECHECK_COMMAND`) are not mandatory release gates. When blank, they must not cause release to fail; report as `skipped`. Mandatory gates remain check-in test + QA + UAT + isolation only (US-0039 AC-10, US-0048).
100
+
101
+ Default: no bypass. Override only via explicit decision gate with documented rationale and evidence (see Override evidence contract below).
102
+
103
+ ## No-bypass default (US-0039)
104
+
105
+ Release gates are mandatory by default. Bypass is not allowed unless an
106
+ explicit decision gate is approved and evidence is recorded.
107
+
108
+ Check-in test evidence: canonical source `tests/report.md`; valid = present + fresh + passing. Fail reasons: `RELEASE_TEST_EVIDENCE_MISSING`, `RELEASE_TEST_STALE`, `RELEASE_TEST_FAILED`. QA gate: no unresolved blocking findings; `RELEASE_QA_BLOCKERS_OPEN`, `RELEASE_QA_EVIDENCE_MISSING`. UAT gate: no placeholder/incomplete/unresolved-fail; `RELEASE_UAT_INCOMPLETE`, `RELEASE_UAT_FAILED`. Override evidence: decision record, rationale, approver, risk acceptance; `RELEASE_GATE_OVERRIDE_APPROVED`.
109
+
110
+ ## QA completion evidence gate (US-0039)
111
+
112
+ Release may not proceed until QA completion evidence shows no unresolved blocking findings for the target sprint.
113
+
114
+ - **Evidence source**: `sprints/Sxxxx/qa-findings.md` (and optionally `handoffs/qa_to_dev.md` for handoff context).
115
+ - **Pass condition**: No unresolved blocking or critical findings; QA phase has been run and findings recorded.
116
+ - **Fail condition**: Unresolved blocking findings exist, or QA evidence is missing for target sprint — block with `RELEASE_QA_BLOCKERS_OPEN` or `RELEASE_QA_EVIDENCE_MISSING`; remediation: resolve blockers, re-run `/qa`, then rerun `/release`.
117
+
118
+ ## Generated-test evidence prerequisite (US-0066 / DEC-0048)
119
+
120
+ For generated-project scope, release evidence must include deterministic
121
+ generated-test auto-run references:
122
+
123
+ - **Execution evidence source**: `sprints/Sxxxx/summary.md` generated baseline
124
+ test section (stack profile, generated paths, scaffold actions).
125
+ - **QA evidence source**: `sprints/Sxxxx/qa-findings.md` generated-test auto-run
126
+ fields (`generated_test_command`, `generated_test_result`,
127
+ `generated_test_output_ref`, `generated_test_paths_ref`,
128
+ `generated_test_reason_code`).
129
+ - **Pass condition**: generated-test evidence exists, is traceable, and does not
130
+ contradict QA/runtime verdicts.
131
+ - **Fail condition**: missing/ambiguous generated-test evidence or unresolved
132
+ scaffold failure reason code; block release with
133
+ `TEST_SCAFFOLD_GENERATION_FAILED` and rerun `/execute` and/or `/qa`.
134
+
135
+ ## UAT completion gate (US-0039)
136
+
137
+ Release may not proceed until UAT artifacts are in verified state (no placeholder, incomplete, or unresolved-fail).
138
+
139
+ - **Evidence sources**: `sprints/Sxxxx/uat.json`, `sprints/Sxxxx/uat.md` (per DEC-0009).
140
+ - **Pass condition**: All UAT steps populated with results; `passed` + `failed` = total; no unresolved fail state; not placeholder-only content.
141
+ - **Fail conditions** (block release with remediation):
142
+ - **Placeholder**: UAT steps empty or template-only `RELEASE_UAT_INCOMPLETE`; run `/verify-work`, populate steps, rerun `/release`.
143
+ - **Incomplete**: Steps exist but not all have results or counts inconsistent — `RELEASE_UAT_INCOMPLETE`; complete UAT, rerun `/release`.
144
+ - **Unresolved fail**: One or more steps recorded as failed and not resolved — `RELEASE_UAT_FAILED`; resolve failures or document acceptance, then rerun `/release`.
145
+
146
+ Do not infer pass from missing or placeholder UAT; block and emit the appropriate reason code.
147
+
148
+ ## Backlog reconciliation contract (US-0043 / DEC-0021)
149
+
150
+ At release finalization boundary, reconcile backlog state for target sprint
151
+ stories using canonical release evidence precedence.
152
+
153
+ Canonical evidence precedence:
154
+ 1. `handoffs/release_queue.md` target sprint row (`released` required)
155
+ 2. `handoffs/releases/Sxxxx-release-notes.md` gate summary
156
+ 3. `sprints/Sxxxx/qa-findings.md`
157
+ 4. `sprints/Sxxxx/uat.json` and `sprints/Sxxxx/uat.md`
158
+ 5. `sprints/Sxxxx/release-findings.md` (if present)
159
+
160
+ Deterministic reconciliation behavior:
161
+ - mutate only target sprint story blocks in `docs/product/backlog.md`
162
+ - set target story `Status: DONE` when mandatory release evidence is PASS
163
+ - reconcile target story acceptance checkboxes to checked state
164
+ - never mutate unrelated backlog stories
165
+ - if contradiction is detected (for example sprint is `released` but backlog
166
+ story remains OPEN/unchecked), fail safe with reason code
167
+ `BACKLOG_STATUS_DRIFT` and remediation guidance
168
+
169
+ ## Canonical status source and global drift guard (US-0045 / DEC-0025)
170
+
171
+ Canonical ownership:
172
+ - Story status (`OPEN|DONE`) is authoritative in `docs/product/backlog.md`.
173
+ - `docs/product/acceptance.md` and `docs/engineering/state.md` are derived views.
174
+
175
+ Deterministic reconciliation precedence:
176
+ 1. `docs/product/backlog.md` story status (canonical status owner)
177
+ 2. target sprint release evidence (`handoffs/release_queue.md`,
178
+ `handoffs/releases/Sxxxx-release-notes.md`, `sprints/Sxxxx/qa-findings.md`,
179
+ `sprints/Sxxxx/uat.json`, `sprints/Sxxxx/uat.md`, `sprints/Sxxxx/release-findings.md`)
180
+ 3. derived-view updates (`docs/product/acceptance.md`, `docs/engineering/state.md`)
181
+
182
+ Guardrails:
183
+ - Mutations remain target-scoped; never rewrite unrelated stories/sprints.
184
+ - On contradictory canonical vs release evidence at reconciliation boundary,
185
+ fail closed with `CANONICAL_STATUS_CONFLICT` and remediation guidance.
186
+ - Normalization and reconciliation outputs must be auditable in
187
+ `docs/engineering/status-normalization-report.md`.
188
+
189
+ ## Steps
190
+ 1. Resolve target sprint identity from current sprint context.
191
+ - If unresolved, fail closed:
192
+ - do not write any sprint-scoped notes file,
193
+ - do not mutate another sprint queue row,
194
+ - record/update blocked queue row keyed as `UNKNOWN` with reason
195
+ `RELEASE_SPRINT_UNRESOLVED`,
196
+ - include remediation guidance (set explicit sprint context and rerun).
197
+ 2. Verify sync-policy prerequisite evidence (US-0038):
198
+ - Latest sync verdict must include deterministic evidence fields:
199
+ `phase_boundary`, `policy_mode`, `checks`, `push_decision`, `reason_code`,
200
+ `evidence_refs`.
201
+ - `TEST_COMMAND` baseline evidence is mandatory for any push-eligible path.
202
+ - Optional checks (`LINT_COMMAND`, `TYPECHECK_COMMAND`) are required only when
203
+ configured; missing optional commands must be reported as `skipped`, not fail.
204
+ - If baseline test evidence fails, append/update `sprints/Sxxxx/release-findings.md`
205
+ with `RELEASE_TEST_FAILED`, include evidence refs/remediation, write
206
+ `handoffs/release_to_dev.md`, and stop.
207
+ 3. Enforce blocker-aware release safety:
208
+ - If unresolved blocking QA findings or unresolved critical issues exist,
209
+ require `no_push` semantics (`BLOCKING_QA_FINDINGS`) and hold release until
210
+ remediation evidence is present.
211
+ - Record blocking findings in `sprints/Sxxxx/release-findings.md` and handoff
212
+ in `handoffs/release_to_dev.md` before stopping.
213
+ 3a. Optional compatibility critical gate (US-0034):
214
+ - If `CROSS_REPO_OBSERVABILITY=0`, skip with zero required overhead.
215
+ - If `CROSS_REPO_OBSERVABILITY=1`, read
216
+ `docs/engineering/compatibility-report.md`.
217
+ - If unresolved `critical` compatibility findings exist and
218
+ `COMPATIBILITY_GATE_ON_CRITICAL=1`, trigger decision gate and stop release
219
+ progression with reason code `COMPATIBILITY_CRITICAL_OPEN`.
220
+ 3b. Optional component-scope gate (US-0035):
221
+ - If `COMPONENT_SCOPE_MODE=0`, skip with zero required overhead.
222
+ - If `COMPONENT_SCOPE_MODE=1`, read
223
+ `docs/engineering/component-scope-report.md`.
224
+ - If unapproved out-of-scope impact remains open, trigger decision gate and
225
+ stop release progression with reason code
226
+ `COMPONENT_SCOPE_VIOLATION_UNAPPROVED`.
227
+ 3c. Optional spec-pack completeness gate (US-0031):
228
+ - If `SPEC_PACK_MODE=0`, skip with zero required overhead.
229
+ - If `SPEC_PACK_MODE=1`, validate target-story spec-pack artifacts per
230
+ runbook (Design Concept, CRS, Technical Specification); required sections
231
+ must be present and non-empty. If any required section is missing, block
232
+ release with reason code `SPEC_PACK_INCOMPLETE` and remediation guidance.
233
+ 3d. Optional user-guide completeness gate (US-0032):
234
+ - If `USER_GUIDE_MODE=0`, skip with zero required overhead.
235
+ - If `USER_GUIDE_MODE=1`, validate target-story user guide at
236
+ `docs/user-guides/US-xxxx.md` per runbook (minimum required sections);
237
+ if guide missing or required sections absent, block release with reason
238
+ code `USER_GUIDE_INCOMPLETE` and remediation guidance.
239
+ 3e. Legacy drift guard (US-0049 / DEC-0031):
240
+ - Run legacy-drift detection over DONE stories (backlog DONE and acceptance
241
+ unchecked OR traceability/state lacks entry OR release artifacts lack
242
+ representation). If legacy drift is detected, either block with reason code
243
+ (`BACKLOG_DONE_ACCEPTANCE_UNCHECKED`, `BACKLOG_DONE_TRACEABILITY_MISSING`,
244
+ `BACKLOG_DONE_RELEASE_ARTIFACT_MISSING`) and remediation, or perform
245
+ target-scoped repair and append entry to `docs/engineering/legacy-drift-audit.md`.
246
+ - Behavior is deterministic and documented in runbook; do not mutate
247
+ unrelated stories.
248
+ 3f. README feature coverage gate (US-0091 / DEC-0074):
249
+ - Read merged scratchpad `README_FEATURE_COVERAGE_ENFORCE` (default `0`).
250
+ - When `0`: skip with `skipped` evidence in `sprints/Sxxxx/release-findings.md`
251
+ § doc gates (grandfathering / migration pass).
252
+ - When `1`: run
253
+ `python scripts/validate_readme_feature_coverage.py --repo . --enforce`.
254
+ - On failure: emit `README_FEATURE_COVERAGE_BLOCKED` plus sub-codes on stderr;
255
+ remediation lists each missing id and target `root_h2` / `dev_h2` from
256
+ `docs/engineering/context/readme-section-affinity.json`.
257
+ - Active + `template/.cursor/commands/release.md` byte-identical step **3f**
258
+ block (full-file parity per US-0017).
259
+ 3g. Project README coverage gate (US-0097 / DEC-0083):
260
+ - Read merged scratchpad `PROJECT_README_ENFORCE` (default `1` post-bootstrap).
261
+ - When `0`: skip with `PROJECT_README_ENFORCE_SKIPPED` evidence in
262
+ `sprints/Sxxxx/release-findings.md` § doc gates (migration/grandfathering only).
263
+ - When `1`: run
264
+ `python scripts/validate_project_readme_coverage.py --repo . --enforce`.
265
+ - On failure: emit `PROJECT_README_COVERAGE_BLOCKED` plus sub-codes
266
+ (`PROJECT_README_COVERAGE_GAP:<US-xxxx>`, `PROJECT_README_MIGRATION_AMBIGUOUS`,
267
+ `PROJECT_README_INPUT_INVALID`) on stderr; remediation lists each missing id.
268
+ - Gate order is strict: **3e → 3f (framework / US-0091) → 3g (project / US-0097) → 4 (UAT)**.
269
+ Framework and project enforce toggles are independent (`README_FEATURE_COVERAGE_ENFORCE`
270
+ vs `PROJECT_README_ENFORCE`).
271
+ - Active + `template/.cursor/commands/release.md` byte-identical step **3g**
272
+ block (full-file parity per US-0017).
273
+ 4. Verify UAT completeness (DEC-0009): confirm all sprint UAT artifacts (`uat.json`,
274
+ `uat.md`) are in populated/verified state per DEC-0009. All steps must have
275
+ recorded results. If any UAT is placeholder or incomplete, block release and
276
+ recommend `/verify-work`.
277
+ - Record `RELEASE_UAT_INCOMPLETE` in `sprints/Sxxxx/release-findings.md` with
278
+ remediation and evidence refs before stop.
279
+ 4a. Isolation compliance gate (US-0048 / DEC-0029): verify per-phase isolation
280
+ evidence is present and valid in `docs/engineering/state.md` for the target
281
+ sprint lifecycle (at minimum: `execute`, `qa`, `verify-work`).
282
+ - Missing evidence: block with `PHASE_CONTEXT_ISOLATION_MISSING`
283
+ - Invalid schema/fields: block with `ISOLATION_EVIDENCE_INVALID`
284
+ - Stale/reused evidence: block with `ISOLATION_EVIDENCE_STALE`
285
+ - Orchestrator/phase executed without fresh subagent: block with
286
+ `PHASE_CONTEXT_ISOLATION_VIOLATION`
287
+ - **Phase role alignment (US-0069 / DEC-0051)**: each entry's `role` must
288
+ match the canonical expected role for its `phase_id` (matrix + scratchpad
289
+ alternates as documented in `/auto`). Mismatch → `PHASE_ROLE_MISMATCH`.
290
+ - Remediation: re-run the affected phase(s) in fresh subagent contexts,
291
+ write new isolation evidence, then rerun `/release`.
292
+ 4b. Strict runtime proof gate (US-0056 / DEC-0038): verify strict runtime-proof
293
+ tuples are present and valid for target lifecycle phases (`execute`, `qa`,
294
+ `verify-work`) and deterministically linked to checkpoint evidence.
295
+ - Missing tuple: block with `RUNTIME_PROOF_MISSING`
296
+ - Invalid tuple/hash/linkage: block with `RUNTIME_PROOF_INVALID`
297
+ - Reused `runtime_proof_id`: block with `RUNTIME_PROOF_REUSED`
298
+ - Expired/stale proof: block with `RUNTIME_PROOF_STALE`
299
+ - Ambiguous proof-to-checkpoint linkage: block with
300
+ `RUNTIME_PROOF_AMBIGUOUS_LINK`
301
+ - **Strict-proof role alignment (US-0069 / DEC-0051)**: tuple `role` must
302
+ equal the sibling isolation evidence `role` and the expected phase contract
303
+ role; `proof_hash` must be consistent with sorted-key JSON of the tuple
304
+ fields per `DEC-0038`. Violation → `RUNTIME_PROOF_INVALID` or
305
+ `PHASE_ROLE_MISMATCH` as applicable.
306
+ - Remediation: rerun affected phase(s), write fresh runtime proof tuples,
307
+ then rerun `/release`.
308
+ 5. Ensure target queue row exists; set status to `unreleased` before finalization.
309
+ - Create row if missing.
310
+ - Set `release_notes_ref` to target sprint notes path.
311
+ - Keep all non-target rows unchanged.
312
+ 6. Write/update only target sprint notes at:
313
+ `handoffs/releases/Sxxxx-release-notes.md`.
314
+ - Preserve any existing historical sprint file content unless explicitly
315
+ working on that same sprint.
316
+ 7. Perform legacy migration/backfill check (one-time, non-destructive):
317
+ - If legacy content exists only in `handoffs/release_notes.md` and target
318
+ sprint can be resolved, backfill target sprint file without deleting legacy.
319
+ - If legacy sprint context is unresolved, keep legacy file unchanged and
320
+ record `LEGACY_NOTES_SPRINT_UNRESOLVED` with manual migration guidance.
321
+ - Migration must be idempotent; do not overwrite existing target sprint notes
322
+ as part of backfill.
323
+ 8. Run mismatch fail-safe checks before finalization:
324
+ - If queue row missing for resolved sprint: reason `QUEUE_ENTRY_MISSING`.
325
+ - If queue row missing `release_notes_ref`: reason `NOTES_REF_MISSING`.
326
+ - If attempted transition is invalid: reason `STATUS_TRANSITION_INVALID`.
327
+ - For any mismatch: fail closed, preserve existing notes, keep queue in
328
+ `unreleased` or `blocked`, and include remediation guidance.
329
+ - Append/update `sprints/Sxxxx/release-findings.md` and
330
+ `handoffs/release_to_dev.md` for blocked outcomes.
331
+ 9. On successful finalization, transition only target sprint:
332
+ `unreleased -> released`.
333
+ - Update `last_updated`, `release_version` (when available), and gate summary.
334
+ 10. Reconcile target story backlog status + acceptance checkboxes in
335
+ `docs/product/backlog.md` using US-0043 and US-0045 contracts.
336
+ - Apply only to target sprint-linked stories.
337
+ - If contradictory states remain after reconciliation attempt, fail closed
338
+ with `BACKLOG_STATUS_DRIFT` or `CANONICAL_STATUS_CONFLICT`, write
339
+ remediation guidance, and stop.
340
+ 11. Reconcile derived status views from canonical backlog status:
341
+ - update linked rows/checklists in `docs/product/acceptance.md`,
342
+ - append deterministic status checkpoint in `docs/engineering/state.md`,
343
+ - preserve non-target entries unchanged.
344
+ 12. If one-time normalization baseline is missing, run the documented
345
+ normalization pass and write auditable report rows to
346
+ `docs/engineering/status-normalization-report.md` (story id, prior values,
347
+ resolved values, evidence refs, timestamp).
348
+ 13. Update backward-compatible legacy file `handoffs/release_notes.md` as
349
+ latest-release pointer and summary:
350
+ - include latest released sprint id,
351
+ - include pointer to canonical sprint-scoped notes file,
352
+ - include visibility section for unreleased queue entries.
353
+ 14. Update runbook/state readiness and evidence references for release outcome.
354
+ - On pass, ensure `sprints/Sxxxx/release-findings.md` records release outcome
355
+ (`PASS`) and references final evidence artifacts.
356
+ 15. If `AUTO_RELEASE_NOTES=1` in `.cursor/scratchpad.md`, generation logic must
357
+ still target sprint-scoped notes first and update legacy pointer second.
358
+ 16. Optional configurable publish targets (US-0054 / DEC-0036):
359
+ - Read `.cursor/scratchpad.md`:
360
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto`
361
+ - `RELEASE_TARGETS_FILE`
362
+ - `RELEASE_TARGETS_DEFAULT`
363
+ - If `RELEASE_PUBLISH_MODE=disabled`, skip publish target execution with
364
+ deterministic no-op evidence.
365
+ - Validate target schema in `RELEASE_TARGETS_FILE` before execution:
366
+ - stable `id`, `type`, `enabled`, `order`,
367
+ - supported `type`: `npm|choco|brew|git|docker|cloud|custom|ssh`,
368
+ - env-reference-only secret fields (`*Env`) for sensitive values.
369
+ - fail fast on invalid/missing required fields with
370
+ `PUBLISH_TARGET_CONFIG_INVALID`.
371
+ - Resolve selected targets (explicit request, else
372
+ `RELEASE_TARGETS_DEFAULT`), filter `enabled=true`, and execute in
373
+ deterministic order (`order`, then `id`).
374
+ - If `RELEASE_PUBLISH_MODE=confirm`, require explicit operator confirmation
375
+ before execution; if confirmation is denied/absent, stop with
376
+ `PUBLISH_CONFIRMATION_REQUIRED`.
377
+ - For `ssh` targets, require `hostEnv`, `userEnv`, `authEnv`, and
378
+ `remoteCommand`. Missing required fields fail with
379
+ `PUBLISH_TARGET_CONFIG_INVALID`.
380
+ - If target execution fails, emit `PUBLISH_TARGET_EXECUTION_FAILED` with
381
+ target ID and remediation; do not mutate unrelated release artifacts.
382
+ 17. Remote runtime connectivity contract (US-0064 / DEC-0044):
383
+ - Extend target interpretation with runtime metadata from
384
+ `RELEASE_TARGETS_FILE`:
385
+ - `runtime.mode` (`local|remote`),
386
+ - endpoint fields (`domainEnv|ipEnv|hostEnv`, `port`, `protocol`),
387
+ - optional ingress metadata (`traefik.enabled`, `router`, `entrypoint`,
388
+ `tls`),
389
+ - optional `dockerOverSsh` contract for ssh targets.
390
+ - Validate remote connectivity fields for remote-mode targets; fail with
391
+ `REMOTE_CONNECTIVITY_CONFIG_INVALID` on missing/invalid requirements.
392
+ - Write/update canonical operator doc:
393
+ `docs/engineering/runtime-connectivity.md` with sanitized endpoint summary
394
+ and local vs remote execution context.
395
+ - In release output/handoffs, include operator connection guidance
396
+ (where hosted, how to connect) without exposing secrets.
397
+ 18. Release operator Run/Connect/Verify hints contract (US-0067 / DEC-0049):
398
+ - `handoffs/releases/Sxxxx-release-notes.md` must include a deterministic
399
+ operator section order and required fields:
400
+ 1) `## Run`:
401
+ - `start_command`
402
+ - `runtime_mode` (`local|remote`)
403
+ - `runtime_context_ref` (link to `docs/engineering/runtime-connectivity.md`
404
+ when available)
405
+ 2) `## Connect`:
406
+ - `service_url`
407
+ - `service_port`
408
+ - `health_endpoint`
409
+ 3) `## Verify`:
410
+ - `verification_steps` (deterministic numbered list)
411
+ - `expected_health_signal`
412
+ 4) `## Credentials`:
413
+ - env-reference-only credential source refs (for example `API_TOKEN_ENV`)
414
+ - expected value source location guidance (for example CI secret store,
415
+ operator shell profile) with no inline secret values
416
+ 5) `## Known Issues`:
417
+ - concise deterministic known issues list, or explicit `None`.
418
+ - `handoffs/release_notes.md` must include a concise latest release operator
419
+ summary (start command + endpoint + verify pointer) and link to canonical
420
+ sprint notes.
421
+ - Fail closed when required operator hints are missing/ambiguous or contain
422
+ inline secrets:
423
+ - `RELEASE_OPERATOR_HINTS_MISSING`
424
+ - `RELEASE_OPERATOR_HINTS_AMBIGUOUS`
425
+ - `RELEASE_OPERATOR_HINTS_SECRET_EXPOSURE`
426
+ - Remediation: populate required fields in canonical sprint notes with
427
+ sanitized env-ref-only credential guidance, then rerun `/release`.
428
+
429
+ ## Fail-safe reason codes and remediation guidance
430
+
431
+ Required deterministic reason codes:
432
+ - `RELEASE_SPRINT_UNRESOLVED`
433
+ - `RELEASE_TEST_FAILED`
434
+ - `RELEASE_QA_BLOCKERS_OPEN`
435
+ - `RELEASE_QA_EVIDENCE_MISSING`
436
+ - `RELEASE_UAT_INCOMPLETE`
437
+ - `RELEASE_UAT_FAILED`
438
+ - `PHASE_CONTEXT_ISOLATION_MISSING`
439
+ - `PHASE_CONTEXT_ISOLATION_VIOLATION`
440
+ - `ISOLATION_EVIDENCE_STALE`
441
+ - `ISOLATION_EVIDENCE_INVALID`
442
+ - `RUNTIME_PROOF_MISSING`
443
+ - `RUNTIME_PROOF_INVALID`
444
+ - `RUNTIME_PROOF_REUSED`
445
+ - `RUNTIME_PROOF_STALE`
446
+ - `RUNTIME_PROOF_AMBIGUOUS_LINK`
447
+ - `RELEASE_GATE_OVERRIDE_APPROVED`
448
+ - `LEGACY_NOTES_SPRINT_UNRESOLVED`
449
+ - `QUEUE_ENTRY_MISSING`
450
+ - `NOTES_REF_MISSING`
451
+ - `STATUS_TRANSITION_INVALID`
452
+ - `BACKLOG_STATUS_DRIFT`
453
+ - `CANONICAL_STATUS_CONFLICT`
454
+ - `COMPATIBILITY_CRITICAL_OPEN`
455
+ - `COMPONENT_SCOPE_VIOLATION_UNAPPROVED`
456
+ - `SPEC_PACK_INCOMPLETE`
457
+ - `USER_GUIDE_INCOMPLETE`
458
+ - `BACKLOG_DONE_ACCEPTANCE_UNCHECKED`
459
+ - `BACKLOG_DONE_TRACEABILITY_MISSING`
460
+ - `BACKLOG_DONE_RELEASE_ARTIFACT_MISSING`
461
+ - `PUBLISH_TARGET_CONFIG_INVALID`
462
+ - `PUBLISH_CONFIRMATION_REQUIRED`
463
+ - `PUBLISH_TARGET_EXECUTION_FAILED`
464
+ - `REMOTE_CONNECTIVITY_CONFIG_INVALID`
465
+ - `RUNTIME_CONNECTIVITY_DOC_WRITE_FAILED`
466
+ - `RELEASE_OPERATOR_HINTS_MISSING`
467
+ - `RELEASE_OPERATOR_HINTS_AMBIGUOUS`
468
+ - `RELEASE_OPERATOR_HINTS_SECRET_EXPOSURE`
469
+ - `PHASE_OWNERSHIP_VIOLATION`
470
+ - `PHASE_OVERRIDE_EVIDENCE_MISSING`
471
+ - `TEST_SCAFFOLD_STACK_UNRESOLVED`
472
+ - `TEST_SCAFFOLD_UNSUPPORTED_STACK`
473
+ - `TEST_SCAFFOLD_GENERATION_FAILED`
474
+
475
+ When any reason code is emitted:
476
+ - Preserve existing release note artifacts (non-destructive default).
477
+ - Do not auto-reconcile by deleting/rebuilding unrelated sprint history.
478
+ - Provide actionable remediation steps and require rerun after correction.
479
+
480
+ ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
481
+
482
+ - Mutations in `/release` must comply with
483
+ `docs/engineering/artifact-ordering-policy.md`.
484
+ - Ordering expectations:
485
+ - `docs/engineering/state.md`: append-bottom checkpoint entries only.
486
+ - `docs/product/backlog.md` + `docs/product/acceptance.md`: target story
487
+ normalization while preserving sorted-canonical order.
488
+ - `handoffs/release_queue.md`: append one target sprint row/update in-place for
489
+ that row only.
490
+ - `handoffs/release_notes.md`: update latest pointer section first; keep
491
+ historical list stable.
492
+ - Missing/ambiguous placement anchors must fail with
493
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and no partial mutation.
494
+
495
+ ## Cross-phase ownership guard (US-0061 / DEC-0043)
496
+
497
+ - `/release` mutations must also satisfy
498
+ `docs/engineering/artifact-ownership-policy.md`.
499
+ - Release may mutate only release-owned scopes (target sprint queue row, release
500
+ notes pointer/sprint notes, and target story reconciliation surfaces).
501
+ - Cross-phase non-owned section rewrites/deletions fail closed with
502
+ `PHASE_OWNERSHIP_VIOLATION`.
503
+ - If an override-authorized mutation path is configured but override evidence is
504
+ missing, fail closed with `PHASE_OVERRIDE_EVIDENCE_MISSING`.
505
+