dflow-sdd-ddd 0.13.0 → 0.15.0

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 (96) hide show
  1. package/CHANGELOG.md +824 -1
  2. package/CONTRIBUTING.md +16 -10
  3. package/README.en.md +156 -200
  4. package/README.md +89 -144
  5. package/TEMPLATE-COVERAGE.md +15 -8
  6. package/TEMPLATE-LANGUAGE-GLOSSARY.md +15 -1
  7. package/bin/dflow.js +36 -4
  8. package/docs/commands.en.md +110 -0
  9. package/docs/commands.md +101 -0
  10. package/docs/doctor-uncertainty.en.md +212 -0
  11. package/docs/doctor-uncertainty.md +212 -0
  12. package/docs/evaluating-dflow.en.md +29 -11
  13. package/docs/evaluating-dflow.md +8 -6
  14. package/docs/npm-publish-checklist.md +3 -1
  15. package/docs/release-versioning-policy.md +8 -2
  16. package/docs/upgrading.en.md +196 -0
  17. package/docs/upgrading.md +197 -0
  18. package/docs/using-with-claude-code.en.md +25 -10
  19. package/docs/using-with-claude-code.md +20 -7
  20. package/docs/using-with-codex.en.md +18 -6
  21. package/docs/using-with-codex.md +16 -5
  22. package/docs/using-with-github-copilot.en.md +25 -10
  23. package/docs/using-with-github-copilot.md +21 -8
  24. package/lib/doc-shapes.json +997 -0
  25. package/lib/doctor-checks.js +2654 -0
  26. package/lib/init.js +3583 -107
  27. package/lib/render-diagrams.js +1474 -0
  28. package/lib/render.js +865 -49
  29. package/package.json +2 -2
  30. package/templates/brownfield/references/drift-verification.md +4 -0
  31. package/templates/brownfield/references/finish-feature-flow.md +635 -88
  32. package/templates/brownfield/references/finish-feature-follow-up.md +60 -0
  33. package/templates/brownfield/references/finish-feature-minimal-host.md +406 -0
  34. package/templates/brownfield/references/finish-feature-post-hoc-hotfix.md +95 -0
  35. package/templates/brownfield/references/git-integration.md +160 -15
  36. package/templates/brownfield/references/init-project-flow.md +26 -4
  37. package/templates/brownfield/references/modify-existing-flow.md +412 -87
  38. package/templates/brownfield/references/modify-existing-follow-up.md +121 -0
  39. package/templates/brownfield/references/modify-existing-post-hoc-hotfix.md +82 -0
  40. package/templates/brownfield/references/new-feature-flow.md +61 -6
  41. package/templates/brownfield/references/new-phase-flow.md +57 -7
  42. package/templates/brownfield/references/pr-review-checklist.md +303 -10
  43. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +158 -34
  44. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +1 -1
  45. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +75 -6
  46. package/templates/brownfield/scaffolding/Git-principles-trunk.md +82 -8
  47. package/templates/brownfield/scaffolding/_conventions.md +50 -28
  48. package/templates/brownfield/scaffolding/_overview.md +1 -0
  49. package/templates/brownfield/templates/_index.md +151 -7
  50. package/templates/brownfield/templates/analysis.md +79 -0
  51. package/templates/brownfield/templates/behavior.md +1 -0
  52. package/templates/brownfield/templates/context-definition.md +1 -0
  53. package/templates/brownfield/templates/context-map.md +2 -1
  54. package/templates/brownfield/templates/glossary.md +1 -0
  55. package/templates/brownfield/templates/lightweight-spec.md +154 -11
  56. package/templates/brownfield/templates/models.md +1 -0
  57. package/templates/brownfield/templates/phase-spec.md +9 -1
  58. package/templates/brownfield/templates/rules.md +1 -0
  59. package/templates/brownfield/templates/tech-debt.md +1 -0
  60. package/templates/common/references/ddd-modeling-guide.md +33 -16
  61. package/templates/{greenfield → common}/references/dflow-feedback-flow.md +2 -1
  62. package/templates/common/references/flow-rationale-registry.md +130 -0
  63. package/templates/common/skill/SKILL.md +13 -11
  64. package/templates/greenfield/references/drift-verification.md +4 -0
  65. package/templates/greenfield/references/finish-feature-flow.md +625 -89
  66. package/templates/greenfield/references/finish-feature-follow-up.md +60 -0
  67. package/templates/greenfield/references/finish-feature-minimal-host.md +363 -0
  68. package/templates/greenfield/references/finish-feature-post-hoc-hotfix.md +95 -0
  69. package/templates/greenfield/references/git-integration.md +148 -15
  70. package/templates/greenfield/references/init-project-flow.md +28 -8
  71. package/templates/greenfield/references/modify-existing-flow.md +378 -85
  72. package/templates/greenfield/references/modify-existing-follow-up.md +103 -0
  73. package/templates/greenfield/references/modify-existing-post-hoc-hotfix.md +82 -0
  74. package/templates/greenfield/references/new-feature-flow.md +67 -4
  75. package/templates/greenfield/references/new-phase-flow.md +56 -7
  76. package/templates/greenfield/references/pr-review-checklist.md +287 -8
  77. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +153 -32
  78. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +5 -2
  79. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +74 -6
  80. package/templates/greenfield/scaffolding/Git-principles-trunk.md +88 -12
  81. package/templates/greenfield/scaffolding/_conventions.md +50 -28
  82. package/templates/greenfield/scaffolding/_overview.md +6 -2
  83. package/templates/greenfield/templates/_index.md +137 -7
  84. package/templates/greenfield/templates/aggregate-design.md +1 -0
  85. package/templates/greenfield/templates/analysis.md +79 -0
  86. package/templates/greenfield/templates/behavior.md +1 -0
  87. package/templates/greenfield/templates/context-definition.md +1 -0
  88. package/templates/greenfield/templates/context-map.md +2 -1
  89. package/templates/greenfield/templates/events.md +4 -1
  90. package/templates/greenfield/templates/glossary.md +1 -0
  91. package/templates/greenfield/templates/lightweight-spec.md +154 -11
  92. package/templates/greenfield/templates/models.md +1 -0
  93. package/templates/greenfield/templates/phase-spec.md +9 -1
  94. package/templates/greenfield/templates/rules.md +1 -0
  95. package/templates/greenfield/templates/tech-debt.md +1 -0
  96. package/templates/brownfield/references/dflow-feedback-flow.md +0 -251
@@ -34,20 +34,45 @@ touches and read them all.
34
34
  {reason}." (If you can't, pause and ask the author.)
35
35
  - [ ] Only then proceed to the code-review sections below
36
36
 
37
- If the PR has no spec or no `_index.md`:
37
+ If the PR records its change in neither a spec nor an `_index.md` row (a T3
38
+ inline row or a `Tier = baseline` row is such a record, and a host that
39
+ carries one needs no spec), first check whether it only records existing
40
+ behaviour or a decision in Domain documents, without changing output.
41
+ That PR is observation-only, and some observation-only records legitimately
42
+ have no host: answer it with the reply under "If the spec is missing or
43
+ incomplete" at the end of Spec Compliance, not with the one below. For any
44
+ other PR with no such record:
38
45
  ```
39
46
  "I don't see a feature directory or _index.md for this PR. Before I
40
- review the code, can you point me to it, or run /dflow:new-feature
41
- (or /dflow:bug-fix for a small fix) to create the feature directory
42
- and at least a lightweight spec? SDD relies on the spec being the
43
- review anchor."
47
+ review the code, can you point me to the host feature? SDD relies on
48
+ the recorded change being the review anchor.
49
+
50
+ If this change belongs to a feature that already exists, run
51
+ /dflow:modify-existing or /dflow:bug-fix against it — the cascade
52
+ decides what gets recorded (a T2 lands a lightweight spec; a T3 lands
53
+ one inline row in that feature's _index.md and no spec file). If it is
54
+ genuinely new work, run /dflow:new-feature.
55
+
56
+ If no feature exists to host it at all, that is the standalone case and
57
+ it has a defined route: /dflow:modify-existing opens a minimal
58
+ (zero-phase) host for it — Step 1.7, or Step 1.6's minimal variant when
59
+ the change is a follow-up on a completed feature. Send it there rather
60
+ than inventing a home by hand."
44
61
  ```
45
62
 
46
63
  ## Spec Compliance
47
64
 
48
65
  Per-feature checks:
49
66
  - [ ] **Feature directory exists** with `_index.md` + at least one
50
- phase-spec (or one lightweight-spec for a T2-only feature)
67
+ phase-spec (or one lightweight-spec for a T2-only feature).
68
+ **Exception — a host whose whole record is inline.** A **T3-only**
69
+ minimal host has no spec file by design: a T3 never produces one.
70
+ A **baseline-only** host has none either — a baseline capture writes
71
+ Domain documents directly and records a `Tier = baseline` row. For both,
72
+ the requirement is at least one `_index.md` Lightweight Changes row,
73
+ not a spec file. Do **not** ask the author to add a spec to satisfy
74
+ this line — that manufactures the artifact the tier forbids and the
75
+ flow refuses to write.
51
76
  - [ ] **`_index.md` Current BR Snapshot is up to date** — reflects
52
77
  the cumulative effect of all phase-specs / lightweight-specs in
53
78
  the directory
@@ -55,7 +80,9 @@ Per-feature checks:
55
80
  phase-spec file exists and its `status` matches the row's claim
56
81
  - [ ] **For follow-up features**: `_index.md` Metadata has `follow-up-of:
57
82
  {原 SPEC-ID}` AND the original feature's `_index.md`
58
- Follow-up Tracking row references this feature
83
+ Follow-up Tracking row references this feature. **`follow-up-of` may
84
+ be a YAML array** — when it names several originals, *each* of them
85
+ must carry the row; checking the first one is not checking the field.
59
86
 
60
87
  Per-phase-spec / lightweight-spec checks (run for **each** spec file the
61
88
  PR touches, not just one):
@@ -63,6 +90,23 @@ PR touches, not just one):
63
90
  - [ ] **Business rules covered** — all BR-* rules in this spec
64
91
  implemented
65
92
  - [ ] **Edge cases handled** — EC-* in this spec addressed
93
+ - [ ] **No-BR family evidence** — for a lightweight-spec whose Behavior
94
+ Delta is a `BR:` / `BR Delta:` none line, check that family's
95
+ evidence instead: (a) `Output Footprint`; (b) `Contract Delta` +
96
+ `**Downstream consumers**`; (c) `Operational Rationale` +
97
+ `**Trace**`; (d) `Performance Delta` + `**SLA / resource
98
+ context**`; (e) `Governing BR-IDs` + root cause + a regression
99
+ check; (f) `Change Rationale` with `**Before**` / `**After**` +
100
+ `**Regression**`. The BR / scenario / Domain items above are
101
+ **N/A** for these specs — record them as N/A rather than passing
102
+ them on an empty rule set, and never fabricate a BR or a
103
+ `behavior.md` anchor to make one pass. Domain documents are not
104
+ automatically N/A: a contract change that touches documented
105
+ behavior still belongs in `behavior.md`. A spec in the
106
+ classic BR-delta form, or a bug spec with the older single `BR:`
107
+ line, is accepted as-is. A change matching more than one family
108
+ must carry **every** matching family's evidence, not just the one
109
+ its BR line names
66
110
  - [ ] **Delta integrity** (phase 2+ only) — the Delta-from-prior-phases
67
111
  section's ADDED / MODIFIED / REMOVED / RENAMED entries actually
68
112
  match the diff against the prior phase-spec's BR set
@@ -70,19 +114,267 @@ PR touches, not just one):
70
114
  If the closeout commit is in this PR (`/dflow:finish-feature` was run):
71
115
  - [ ] **BC layer sync landed** — `dflow/specs/domain/{context}/rules.md` and
72
116
  `behavior.md` reflect the feature's net effect (compare against
73
- `_index.md` Current BR Snapshot)
117
+ `_index.md` Current BR Snapshot). **N/A for a no-BC host** — one whose
118
+ Goals & Scope declares no bounded context has nothing to sync, and a
119
+ `{context}` document invented to satisfy this line is a fiction, never a
120
+ pass.
121
+ ⚠ **Do not read that as "closeout already blocks it" without qualifying
122
+ where.** Closeout blocks it in the commits it actually reads — checkpoint
123
+ 1, and only on a **minimal** host, plus the closeout commit on any host.
124
+ A fiction committed by a **phase-bearing** no-BC host anywhere in between
125
+ passes every closeout check. That range is the *"A no-BC host committed no
126
+ BC-scoped Domain material"* item in the delegated block below, and it is
127
+ yours to run. **N/A for a baseline capture** — a baseline
128
+ writes Domain documents directly, so there is no separate sync to land.
129
+ **N/A for a T3**, which does no Domain work at all. Record the N/A rather
130
+ than ticking it against an empty comparison — but note `glossary.md` and
131
+ `migration/tech-debt.md` belong to no bounded context, stay in a no-BC
132
+ host's sweep, and are a baseline capture's own capture destinations, so
133
+ this N/A does not reach them.
74
134
  - [ ] **Whole feature directory `git mv`'d** to `completed/` — git
75
135
  shows `renamed:` (not `deleted:` + `new file:`)
76
136
  - [ ] **Integration Summary** was emitted to the conversation (not
77
137
  written to a file — it's ephemeral)
138
+ - [ ] **Every Lightweight Changes row now carries a `Commit` hash.**
139
+ Before closeout an empty cell can be legitimate: on a **hosted** row
140
+ the cell is filled by the host's *next* commit, and closeout is
141
+ allowed to be that commit. (A **minimal** host is stricter — its rows
142
+ are written before checkpoint 1, and closeout already refuses an empty
143
+ cell there.) After closeout there is no next commit, so an empty cell
144
+ will never be filled. That is why closeout does not assert this for a
145
+ phase-bearing host, and why it is checkable here.
146
+ ⚠ **A placeholder is not a hash.** `{hash}`, `{pending}`, `(待 commit)` —
147
+ anything that is not a resolvable commit — counts as **unfilled**, not as
148
+ carrying one. It is the harder case to catch precisely because the cell is
149
+ **non-empty**: every rule downstream is written against empty / non-empty,
150
+ so a placeholder reads as filled to all of them. Resolve each value
151
+ (`git cat-file -t {value}`) rather than checking the cell is populated.
152
+
153
+ **Delegated to review by `finish-feature-flow.md`.** Closeout states at each
154
+ of these sites that it does *not* prove them. They are not optional extras:
155
+ skip one and the boundary is a hole rather than a division of labour.
156
+
157
+ - [ ] **Whole history — no stray host-open commit.** Closeout validates the
158
+ hashes the record names and cannot see the rest of the branch. List
159
+ this branch's commits that touch the host directory:
160
+ `git log --oneline {base}..HEAD -- 'dflow/specs/features/active/{SPEC-ID}-{slug}/' 'dflow/specs/features/completed/{SPEC-ID}-{slug}/'`
161
+ For a **minimal (zero-phase) host** there must be exactly two —
162
+ checkpoint 1 and closeout. A third, typically a host opened in its own
163
+ commit before the work landed, breaks the two-commit lifecycle while
164
+ every closeout check still passes, because those read only the hashes
165
+ the record points at. **This count applies to a minimal host only**: a
166
+ phase-bearing feature has no fixed number of host commits, so there is
167
+ nothing to count there and this item is N/A.
168
+ This is also where closeout's minimal-host **selector** boundary is
169
+ settled: that selector reads the host's persisted shape today and
170
+ cannot know it was opened minimal and *stayed* minimal. The commit walk
171
+ is what shows that.
172
+ - [ ] **Hotfix identity — confirm it against the cited source** (post-hoc
173
+ host only). Closeout tests **plausibility only**, and says so: which
174
+ commit was *the* merged hotfix is not derivable from inside the flow,
175
+ so the developer asserts it and cites what the claim rests on —
176
+ `hotfix-identity:` beside `hotfix-branch:` in a **T2**'s
177
+ lightweight-spec frontmatter, or in the row Description for a **T3**.
178
+ **Open that source** — PR, incident, or tracker — and confirm it names
179
+ this fix and this commit. Closeout already checked that a citation is
180
+ *present*; only review can check that it *matches*.
181
+ - [ ] **Hosted `Commit` cell identity — confirm each hash is *that row's own*
182
+ implementation commit** (phase-bearing host only). `finish-feature-flow.md`
183
+ Step 4 instruction 1 orders the value ("each row's own implementation
184
+ hash, never the closeout hash") and its post-commit verification **states
185
+ that it cannot decide it**: the hash-evidence test is minimal-host-only
186
+ and lives in `finish-feature-minimal-host.md`, so on a phase-bearing host
187
+ no closeout check reads the value at all. The presence item above asserts the cell is **non-empty**;
188
+ this one asserts it is **right**, and the two are not interchangeable.
189
+ For each Lightweight Changes row, take its `Commit` hash and run
190
+ `git show --stat {hash}`. **Take the row's declaration if it has one and
191
+ require the commit to touch it** — a **T2**'s own spec file
192
+ (`lightweight-*.md` / `BUG-*.md`), a **T3**'s Description implementation
193
+ paths, a **`Tier = baseline`** row's capture documents — a capture
194
+ is **observation-only**, so what it declares is documents, never
195
+ implementation paths. (A phase-bearing host may legitimately hold a
196
+ baseline row alongside phase work; `finish-feature-minimal-host.md` says so
197
+ where it explains why such a host never reaches the zero-phase checks.)
198
+ **If the row declares nothing, that is by design on a hosted row — with
199
+ one exception.** A **T2** links to its own spec file on *every* host shape:
200
+ `finish-feature-flow.md` Step 1 carries two `Tier = T2` checks that no
201
+ host shape escapes — one of them says so in as many words — and
202
+ `finish-feature-minimal-host.md`'s phase-bearing exemption note confirms
203
+ those hosts keep them. A T2 row with
204
+ no such link is **malformed, not exempt** — find the spec file or flag the
205
+ row. For a **T3**, and for a **baseline** row, the absence is the
206
+ sanctioned state — and for the baseline it is the same hosted exemption
207
+ that covers a hosted T3, which `templates/_index.md` extends to baseline
208
+ rows in the same breath. It is not a property of captures.
209
+ ⚠ The record then gives you nothing to compare against, and that is
210
+ deliberate: `finish-feature-minimal-host.md` exempts phase-bearing hosts
211
+ from its `Commit` cell path check for exactly this reason
212
+ (`references/flow-rationale-registry.md`, `R-FF-COMMITCELL-02`:
213
+ "demanding it would reject every hosted T3"), and `templates/_index.md`
214
+ calls declaring them good
215
+ practice with no gate behind it. **Do not read "touches nothing declared"
216
+ as a pass.** What remains checkable is weaker and is worth stating as
217
+ such: the hash is **not** the closeout commit, is **not** any other row's
218
+ hash, and is a commit on this host's branch — or on a branch this host
219
+ recorded a `branch-override` for. Past that, ask the developer which
220
+ commit carried the row. If identity matters for this change, say so and
221
+ have the row declare its paths — that is what makes the comparison above
222
+ available.
223
+ ⚠ **Do not let tier decide that a declaration must exist.** Tier says what
224
+ the declaration would have been; the one hosted row required to carry one
225
+ is a T2, and that requirement lives in Step 1, not here. Keying this check
226
+ on tier produced three successive versions that each named an input some
227
+ row was not required to carry.
228
+ A cell holding the **closeout** hash, or another row's hash, is what this
229
+ exists to catch: both are non-empty, both pass every closeout check, and
230
+ neither is what instruction 1 ordered.
231
+ **N/A for a minimal host** — there `finish-feature-minimal-host.md`'s
232
+ hash-evidence test already runs (a)–(c) against every row before closeout
233
+ may proceed.
234
+ - [ ] **A recorded branch override still matches where the closeout landed**
235
+ (only when the host carries a `branch-override` row). Closeout passes its
236
+ branch check on any such row naming the branch it ran on, and **states
237
+ that it cannot decide** whether that override was still the current
238
+ intent — nothing expires a row once the developer returns to the host's
239
+ own branch. You can see what closeout cannot: which branch the closeout
240
+ commit sits on, and whether the work had already been integrated by then.
241
+ Two cases to reject, both instances of one rule — **the branch this
242
+ closeout landed on is not where this host's work was finished**: a closeout
243
+ committed onto the **base** branch *after* the feature branch was merged
244
+ (that puts the closeout commit outside the review this checklist is part
245
+ of), and a closeout committed onto a branch an override named earlier but
246
+ which the work has since **left** — a superseded spike, say. Closeout
247
+ distinguishes neither, because it accepts any branch this host ever
248
+ recorded an override for.
249
+ - [ ] **The closeout commit carries only this host's delta.** Closeout's spill
250
+ check derives its permitted set from Step 4 instruction 2, which defines
251
+ one for **every** host shape — so there is a permitted-file list to read
252
+ against on a phase-bearing feature too. What that does not change is what
253
+ the check proves: it is a **path-level spill check**, so it proves no
254
+ unpermitted *file* entered the commit, never that the permitted ones carry
255
+ only this change. An unrelated BR edit inside `rules.md`, or another
256
+ feature's term in `glossary.md`, passes it untouched. Read each
257
+ permitted file's diff against the intended delta in the spec / row.
258
+ - [ ] **A follow-up's reverse link was opened, not only closed.** The
259
+ original's Follow-up Tracking row must have existed as `in-progress`
260
+ before the flip to `completed` — `absent → in-progress → completed`,
261
+ never created straight as `completed`. Closeout verifies this for a
262
+ **minimal** host only, from checkpoint 1's committed blob; a
263
+ **phase-bearing** follow-up has no single commit required to carry the
264
+ row, so closeout has nothing equivalent to read and the opening half
265
+ arrives here unchecked. Confirm it from the branch history
266
+ (`git log -p {base}..HEAD -- <original feature>/_index.md`), for
267
+ **each** SPEC-ID in `follow-up-of`.
268
+ - [ ] **A no-BC host committed no BC-scoped Domain material** — **every no-BC
269
+ host, not only phase-bearing ones.** Closeout inspects only **checkpoint
270
+ 1's** diff on a minimal host, and a phase-bearing host has no single
271
+ checkpoint to inspect at all. **Neither is a branch-range proof**, and
272
+ closeout cannot take a range — it needs a base branch and Dflow
273
+ deliberately does not know yours. **You have it.** Run
274
+ `git diff --name-status {base}..HEAD -- 'dflow/specs/domain/'` and confirm
275
+ no BC-scoped Domain document — **the set this track's own no-BC closeout
276
+ check names**, `context-map.md` included — was **added, modified, deleted
277
+ or renamed**. A no-BC host is one whose Goals & Scope declares no bounded
278
+ context, the same identification the BC-layer-sync item above uses.
279
+ ⚠ **The path filter is deliberately wider than the prohibited set, so read
280
+ the output before flagging.** `context-map.md` sits at `domain/` top level
281
+ rather than under `{context}/`, and the filter has to reach up there to
282
+ catch it — which means it also lists `domain/glossary.md` and
283
+ `domain/analysis.md`. Both belong to no bounded context and stay
284
+ legitimate for a no-BC host: **seeing either here is not a finding.**
285
+ `migration/tech-debt.md` is outside the filter entirely and never appears.
286
+ ⚠ **A baseline capture is not a no-BC host** and this item does not apply
287
+ to it: writing Domain documents is exactly what a baseline is for. Closeout's
288
+ own no-BC check states the same exemption.
78
289
 
79
290
  If the spec is missing or incomplete:
80
291
  ```
81
292
  "I notice this PR doesn't have a matching feature directory / _index.md.
82
- Let's create one retroactively — it'll help with documentation and
83
- the target architecture. Can you describe what this change does?"
293
+ Can you describe what this change does? If it only records existing
294
+ behaviour or a decision without changing output, it is observation-only
295
+ and tier-exempt — it is captured in whichever Domain documents it
296
+ actually wrote (there is no fixed list) and stops there. It needs no host
297
+ when it is an analysis.md record made with no workflow running and
298
+ committed on its own, or a capture about no bounded context at all; any
299
+ other capture with no active feature to attach it to gets a baseline
300
+ minimal host, whose Tier = baseline row declares the documents it wrote —
301
+ not a spec. Otherwise: if it belongs to a feature
302
+ we already have, we can record it there retroactively — the tier decides
303
+ what gets written (T2: a lightweight spec; T3: one inline _index.md
304
+ row). If it's genuinely new work, it wants /dflow:new-feature. If
305
+ there's no feature it could belong to, that's the standalone case and
306
+ it has a defined route: /dflow:modify-existing opens a minimal
307
+ (zero-phase) host for it — Step 1.7, or Step 1.6's minimal variant when
308
+ it's a follow-up on a completed feature. Let's send it there rather
309
+ than inventing a home by hand."
84
310
  ```
85
311
 
312
+ ## Risk-Triggered Modeling Review
313
+
314
+ Use the spec and diff to identify these risks; do not use a keyword-only scan.
315
+ Only when a signal matches, read the named section in
316
+ `dflow/specs/shared/dflow-workflows/references/ddd-modeling-guide.md`. If no
317
+ signal matches, skip this section's guide lookup, create no artifact, and
318
+ continue with the existing checklist below.
319
+
320
+ | Risk signal | Read in the modeling guide |
321
+ |---|---|
322
+ | One use case mutates / saves multiple Aggregate roots, or adds a multi-root Unit of Work | Aggregate Design Rules; Domain Services |
323
+ | The diff crosses Bounded Contexts or changes an event payload, handler, or delivery expectation | Domain Events; Event Handling Guidelines |
324
+ | Deadline, retry, out-of-order callback, compensation, business-visible progress, or a claim that local persistence and an external provider / service fact form one atomic outcome | Aggregate Design Rules; Long-Running Processes; failure-path guidance under Event Handling Guidelines |
325
+ | `unique`, `only one active`, or another set-based invariant | Set-Based / Uniqueness Invariants |
326
+ | A Domain Service is added or changed | Domain Services; Long-Running Processes when the flow has state |
327
+
328
+ For every matched risk, record one disposition in the review:
329
+
330
+ - **Finding** — identify the violated guarantee at the boundary named by the
331
+ matched risk, its severity, and merge disposition. For a match involving an
332
+ external provider / service fact, state that a local transaction cannot make
333
+ that fact atomic with local state; implementing or repairing a local
334
+ transaction / Unit of Work alone is not sufficient closure.
335
+ - **Accepted with rationale** — state why the boundary / transaction / service
336
+ role is sound and when to revisit it. For such an exception, the rationale
337
+ must already exist or be added to the appropriate Aggregate / Domain Service
338
+ row and Notes in `models.md`; when it protects an invariant, update the
339
+ related `rules.md` entry too. The PR conversation points to that decision and
340
+ is not its only home. This disposition evaluates the rationale's adequacy,
341
+ not only its existence: it must explain how it answers every matched risk.
342
+ For a match involving an external provider / service fact, acknowledge that
343
+ a local transaction cannot make that fact atomic with local state and explain
344
+ how the outcome progresses across the boundary, including idempotency and
345
+ retry / compensation (or a justified equivalent). For a Domain Service match,
346
+ name the actual domain rule or decision the accepted operation carries; an
347
+ operation that only orders root calls is Application-layer orchestration and
348
+ remains a Finding, even when another operation of the same service holds a
349
+ real rule. If the rationale does not cover the matched risk, use Finding
350
+ rather than this disposition.
351
+ - **Not applicable** — explain from the spec and diff why the match is only
352
+ superficial.
353
+
354
+ Multiple signals for the same design decision may share one disposition, but
355
+ every matched risk must have an auditable disposition. This is not a per-signal
356
+ form.
357
+
358
+ ### Closing a blocking modeling finding
359
+
360
+ A DDD / domain-correctness blocker must state:
361
+
362
+ - the code boundary or enforcement needed to restore the guarantee;
363
+ - the existing durable surfaces that must change, as applicable — the spec,
364
+ domain `models.md` / `rules.md` / `context.md` / `context-map.md` /
365
+ `behavior.md`, or `migration/tech-debt.md`;
366
+ - the automated tests or observable evidence that re-verify the guarantee; and
367
+ - that the unimplemented guarantee must not remain marked `completed` before
368
+ re-review.
369
+
370
+ If the review offers defer as an option, it must list the owner, known risk,
371
+ exit criteria, and `migration/tech-debt.md` landing surface as closure
372
+ conditions. If the team defers the finding, record those items on that surface;
373
+ rationale, a re-evaluation condition, or "future refactor" alone is not
374
+ closure. The reviewer defines the evidence needed to unblock, not the author's
375
+ implementation. Use the existing PR comment / conversation surface; do not
376
+ create a separate review report.
377
+
86
378
  ## Domain Layer Quality
87
379
 
88
380
  - [ ] **No delivery-framework references in Domain** — `src/Domain/` must have zero dependencies on HTTP request/response objects, session/cookie context, job-runner context, CLI flag parsers, or ViewState equivalents
@@ -158,6 +450,7 @@ uses '報銷 (Expense Claim)'. Should we align the naming?"
158
450
 
159
451
  - [ ] **models.md updated** — New entities/VOs/services documented?
160
452
  - [ ] **rules.md updated** — New or changed business rules recorded?
453
+ - [ ] **analysis.md updated** — did this change touch a status transition, an ordered cross-context flow, which roles reach a function, or the way a figure is computed? If so, is the matching entry in `analysis.md` updated? Open one Evidence source it cites and confirm it still says what the entry claims. An entry whose Evidence is `inferred` names what its conclusion was drawn from: confirm instead that the conclusion still follows from it. An entry whose Evidence is `assumed` has no source to open: confirm instead that it says what it rests on and that the question of confirming it is recorded where the Evidence convention at the top of `analysis.md` says, and report it as unverified rather than blocking on it.
161
454
  - [ ] **context.md boundaries respected** — Does this change stay within its context?
162
455
 
163
456
  ## Tech Debt Awareness