@pmelab/gtd 27.5.0 → 27.7.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 (49) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +12 -2
  3. package/dist/chunks/{reserved-DM5W_LAt.mjs → reserved-Df8GeSHw.mjs} +37 -9
  4. package/dist/chunks/{tail-6gvLXXcg.mjs → tail-DmIfEAI4.mjs} +1 -1
  5. package/dist/flows.mjs +17 -1
  6. package/dist/gtd.bundle.mjs +56 -11
  7. package/dist/testkit.mjs +67 -26
  8. package/dist/workflows/cleanup.mjs +2 -2
  9. package/dist/workflows/feature.mjs +61 -10
  10. package/dist/workflows/fix.mjs +2 -2
  11. package/dist/workflows/review.mjs +2 -2
  12. package/dist/workflows/rollout.mjs +1 -1
  13. package/dist/workflows.mjs +110 -16
  14. package/package.json +1 -1
  15. package/src/cli/Cli.ts +2 -2
  16. package/src/edge/Edge.test.ts +111 -0
  17. package/src/edge/Edge.ts +15 -3
  18. package/src/flags/index.test.ts +13 -0
  19. package/src/flags/index.ts +1 -0
  20. package/src/flows/runtime.test.ts +42 -0
  21. package/src/flows/runtime.ts +36 -0
  22. package/src/replay/Replay.test.ts +43 -0
  23. package/src/replay/Replay.ts +10 -2
  24. package/src/replay/Trailers.test.ts +54 -0
  25. package/src/replay/Trailers.ts +15 -1
  26. package/src/testkit/EmittedScriptRecognizer.test.ts +41 -0
  27. package/src/testkit/EmittedScriptRecognizer.ts +16 -7
  28. package/src/testkit/TestRepo.test.ts +79 -1
  29. package/src/testkit/TestRepo.ts +17 -6
  30. package/src/testkit/steps.ts +44 -1
  31. package/src/testkit/testkit.feature +35 -0
  32. package/src/workflows/cleanup/cleanup-path.feature +94 -0
  33. package/src/workflows/cleanup/cleanup.feature +0 -29
  34. package/src/workflows/feature/fast-path.feature +114 -0
  35. package/src/workflows/feature/feature.ts +3 -1
  36. package/src/workflows/feature/one-step-land.feature +108 -0
  37. package/src/workflows/feature/refactor-first.feature +137 -0
  38. package/src/workflows/feature/risk-tier.feature +238 -0
  39. package/src/workflows/feature/seam-rejection.feature +146 -0
  40. package/src/workflows/feature/seam.feature +0 -67
  41. package/src/workflows/feature/seam.ts +5 -4
  42. package/src/workflows/feature/steps.ts +3 -2
  43. package/src/workflows/feature/tier.test.ts +164 -0
  44. package/src/workflows/feature/tier.ts +74 -0
  45. package/src/workflows/shared/options.test.ts +6 -1
  46. package/src/workflows/shared/text.test.ts +129 -0
  47. package/src/workflows/shared/text.ts +57 -9
  48. package/src/workflows/shared/vars.ts +2 -0
  49. package/src/workflows/shared/workflows.steps.ts +13 -4
@@ -36,35 +36,6 @@ Feature: cleanup removes a default-on release flag and keeps its flag-on path
36
36
  """
37
37
  And the working tree is committed as "feat: registry"
38
38
 
39
- Scenario: removing the entry and the off path lands, then reaches the review gate
40
- Given step "cleanup.removing" writes "src/flags/index.ts" with:
41
- """
42
- export const FLAGS = [
43
- { name: "alpha", owner: "a", expiry: "2027-01-01", kind: "release" },
44
- { name: "ops1", owner: "c", expiry: "2027-03-01", kind: "ops" },
45
- ] as const
46
- """
47
- And step "cleanup.removing" writes "src/calc.ts" with:
48
- """
49
- export const on = true
50
- """
51
- And step "build.health.check" changes nothing
52
- And step "build.review.reviewing" writes ".gtd/REVIEW.md" with:
53
- """
54
- # Review: abc1234
55
-
56
- <!-- base: 0000000 -->
57
-
58
- ## calc
59
-
60
- - [ ] ./src/calc.ts#1-1
61
- flag removed
62
- """
63
- When gtd starts workflow "cleanup" with "--var flag=live"
64
- And the process is driven
65
- Then the process rests at "build.review.await-review"
66
- And "src/flags/index.ts" does not contain "live"
67
-
68
39
  Scenario: a turn leaving the registry entry is refused
69
40
  Given step "cleanup.removing" writes "src/calc.ts" with:
70
41
  """
@@ -0,0 +1,114 @@
1
+ @inmem
2
+ Feature: a trivial change takes the same few beats at either risk tier, flag-free at low
3
+
4
+ With GTD_FLAG_NAIVE_PASS and GTD_FLAG_RISK_TIER on, a one-line copy fix goes
5
+ from idle through the naive pass, the seam judge's land, implement and human
6
+ review back to idle. Low tier walks exactly the steps high does; only the
7
+ implementation prompt and the summary differ.
8
+
9
+ Background:
10
+ Given the shipped workflows, as gtd install scaffolds them
11
+ And an environment variable "GTD_QUALITYREVIEWS" set to "correctness"
12
+ And an environment variable "GTD_FLAG_NAIVE_PASS" set to "1"
13
+ And an environment variable "GTD_FLAG_RISK_TIER" set to "1"
14
+ And a file "src/greeting.ts" with:
15
+ """
16
+ export const greeting = "Helo, world"
17
+ """
18
+ And the working tree is committed as "feat: add greeting"
19
+ And a file "TODO.md" with:
20
+ """
21
+ # Fix the typo
22
+
23
+ greeting says "Helo"; make it "Hello".
24
+ """
25
+ And step "unwind" changes nothing
26
+ And step "start-gate.check" changes nothing
27
+ And step "design.gate.answer" changes nothing
28
+ And step "implement.health.check" changes nothing
29
+ And step "implement.closing" runs its script
30
+ And step "build.quality.correctness.reviewing" changes nothing
31
+ And step "build.review.reviewing" writes ".gtd/REVIEW.md" with:
32
+ """
33
+ # Review: abc1234
34
+
35
+ <!-- base: 0000000 -->
36
+
37
+ ## greeting
38
+
39
+ - [ ] ./src/greeting.ts#1-1
40
+ typo fixed
41
+ """
42
+ And step "build.review.closing" runs its script
43
+
44
+ Scenario Outline: a one-line fix runs idle to idle with the same beats at either tier
45
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
46
+ """
47
+ # Requirements
48
+
49
+ ## Risk Tier
50
+
51
+ <tier> — one-line copy fix
52
+ """
53
+ When the process is driven
54
+ Then the process rests at "seam.naive"
55
+ And the last commit subject is "gtd(human): design.gate.answer → seam.naive"
56
+
57
+ Given step "seam.naive" writes "src/greeting.ts" with:
58
+ """
59
+ export const greeting = "Hello, world"
60
+ """
61
+ And judge step "seam.judge" answers:
62
+ """
63
+ [{"id":"shape","answer":"land","p":0.9}]
64
+ """
65
+ When the process is driven
66
+ Then the process rests at "implement.building"
67
+ And the resting step's content contains "<demand>"
68
+ And the resting step's content does not contain "<absent>"
69
+
70
+ Given step "implement.building" writes "src/greeting.ts" with:
71
+ """
72
+ export const greeting = "Hello, world!"
73
+ """
74
+ When the process is driven
75
+ Then the process rests at "build.review.await-review"
76
+
77
+ Given a file ".gtd/REVIEW.md" with:
78
+ """
79
+ # Review: abc1234
80
+
81
+ <!-- base: 0000000 -->
82
+
83
+ ## greeting
84
+
85
+ - [x] ./src/greeting.ts#1-1
86
+ typo fixed
87
+ """
88
+ When gtd lands
89
+ And the process is driven
90
+ Then the process rests at "idle"
91
+ And "src/greeting.ts" contains "Hello, world!"
92
+ And the commit subjects end with:
93
+ """
94
+ gtd(human): idle → unwind
95
+ gtd(check): unwind → start-gate.check
96
+ gtd(check): start-gate.check → design.triage
97
+ gtd(agent): design.triage → design.gate.answer
98
+ gtd(human): design.gate.answer → seam.naive
99
+ gtd(agent): seam.naive → seam.judge
100
+ gtd(judge): seam.judge → implement.building
101
+ gtd(agent): implement.building → implement.health.check
102
+ gtd(check): implement.health.check → implement.closing
103
+ gtd(check): implement.closing → build.quality.correctness.reviewing
104
+ gtd(agent): build.quality.correctness.reviewing → build.review.reviewing
105
+ gtd(agent): build.review.reviewing → build.review.await-review
106
+ gtd(human): build.review.await-review → build.review.closing
107
+ gtd(check): build.review.closing → idle
108
+ """
109
+ And the output of gtd "summary" <summary> "needs a human reviewer"
110
+
111
+ Examples:
112
+ | tier | demand | absent | summary |
113
+ | low | Add no release flag | new release flag | does not contain |
114
+ | high | Put the new behaviour behind a new release flag | Add no release flag | contains |
@@ -18,6 +18,7 @@ import { packages } from "./packages.js"
18
18
  import { architecture, design } from "./planning.js"
19
19
  import { buildTail, type ReviewOutcome } from "./review.js"
20
20
  import { seamBuild } from "./seam.js"
21
+ import { recordRisk, riskTierOn } from "./tier.js"
21
22
 
22
23
  // The ordinary start. Any change to the tree starts a process: `idle` →
23
24
  // `unwind` reverts the sketch (its intent survives in history) → a
@@ -56,9 +57,10 @@ export const planAndBuild = async (firstBase: string): Promise<void> => {
56
57
  let base = firstBase
57
58
  for (;;) {
58
59
  await design(base)
60
+ const tier = riskTierOn() ? recordRisk() : undefined
59
61
  // GTD_FLAG_NAIVE_PASS: the record is pinned at the process start, so a mid-process flip never moves a process.
60
62
  if (vars.flag_naive_pass === "1") {
61
- await seamBuild()
63
+ await seamBuild(tier)
62
64
  } else {
63
65
  await architecture()
64
66
  await packages()
@@ -0,0 +1,108 @@
1
+ # One SDLC path per file, so a changed path reds exactly one fixture — do not merge.
2
+ @inmem
3
+ Feature: a naive pass the judge rules land goes straight to implement with no seam gate
4
+
5
+ With GTD_FLAG_NAIVE_PASS on and GTD_FLAG_RISK_TIER off, a naive pass that
6
+ edits an existing source file is judged land: the process skips the approval
7
+ gate, any refactor and any architecture, and runs implement, quality and
8
+ review back to idle. The flags are pinned here so the per-flag test runs never
9
+ move it off this path.
10
+
11
+ Background:
12
+ Given the shipped workflows, as gtd install scaffolds them
13
+ And an environment variable "GTD_QUALITYREVIEWS" set to "correctness"
14
+ And an environment variable "GTD_FLAG_NAIVE_PASS" set to "1"
15
+ And an environment variable "GTD_FLAG_RISK_TIER" set to "0"
16
+ And a file "src/greeting.ts" with:
17
+ """
18
+ export const greeting = "Helo, world"
19
+ """
20
+ And the working tree is committed as "feat: add greeting"
21
+ And a file "TODO.md" with:
22
+ """
23
+ # Fix the typo
24
+
25
+ greeting says "Helo"; make it "Hello".
26
+ """
27
+ And step "unwind" changes nothing
28
+ And step "start-gate.check" changes nothing
29
+ And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
30
+ """
31
+ # Requirements
32
+
33
+ ## Concerns
34
+
35
+ ### Typo
36
+
37
+ - greeting reads "Hello, world".
38
+ """
39
+ And step "design.gate.answer" changes nothing
40
+ And step "seam.naive" writes "src/greeting.ts" with:
41
+ """
42
+ export const greeting = "Hello, world"
43
+ """
44
+ And judge step "seam.judge" answers:
45
+ """
46
+ [{"id":"shape","answer":"land","p":0.9}]
47
+ """
48
+ And step "implement.building" writes "src/greeting.ts" with:
49
+ """
50
+ export const greeting = "Hello, world!"
51
+ """
52
+ And step "implement.health.check" changes nothing
53
+ And step "implement.closing" runs its script
54
+ And step "build.quality.correctness.reviewing" changes nothing
55
+ And step "build.review.reviewing" writes ".gtd/REVIEW.md" with:
56
+ """
57
+ # Review: abc1234
58
+
59
+ <!-- base: 0000000 -->
60
+
61
+ ## greeting
62
+
63
+ - [ ] ./src/greeting.ts#1-1
64
+ typo fixed
65
+ """
66
+ And step "build.review.closing" runs its script
67
+
68
+ Scenario: a land judgment runs idle to idle with no seam gate, refactor or architecture
69
+ When the process is driven
70
+ Then the process rests at "build.review.await-review"
71
+ Given a file ".gtd/REVIEW.md" with:
72
+ """
73
+ # Review: abc1234
74
+
75
+ <!-- base: 0000000 -->
76
+
77
+ ## greeting
78
+
79
+ - [x] ./src/greeting.ts#1-1
80
+ typo fixed
81
+ """
82
+ When gtd lands
83
+ And the process is driven
84
+ Then the process rests at "idle"
85
+ And "src/greeting.ts" contains "Hello, world!"
86
+ And the commit subjects end with:
87
+ """
88
+ gtd(human): idle → unwind
89
+ gtd(check): unwind → start-gate.check
90
+ gtd(check): start-gate.check → design.triage
91
+ gtd(agent): design.triage → design.gate.answer
92
+ gtd(human): design.gate.answer → seam.naive
93
+ gtd(agent): seam.naive → seam.judge
94
+ gtd(judge): seam.judge → implement.building
95
+ gtd(agent): implement.building → implement.health.check
96
+ gtd(check): implement.health.check → implement.closing
97
+ gtd(check): implement.closing → build.quality.correctness.reviewing
98
+ gtd(agent): build.quality.correctness.reviewing → build.review.reviewing
99
+ gtd(agent): build.review.reviewing → build.review.await-review
100
+ gtd(human): build.review.await-review → build.review.closing
101
+ gtd(check): build.review.closing → idle
102
+ """
103
+ And the commit "gtd(human): idle → unwind" has a body containing "Gtd-Var: flag_naive_pass=1"
104
+ And the commit "gtd(human): idle → unwind" has a body containing "Gtd-Var: flag_risk_tier=0"
105
+ And the commit "gtd(agent): seam.naive → seam.judge" has a body containing "Gtd-Kept:"
106
+ And the commit "gtd(judge): seam.judge → implement.building" has a body containing "\"answer\":\"land\""
107
+ And no commit body contains "Gtd-Approved:"
108
+ And no commit body contains "Gtd-Workflow:"
@@ -0,0 +1,137 @@
1
+ # One SDLC path per file, so a changed path reds exactly one fixture — do not merge.
2
+ @inmem
3
+ Feature: a refactor-first judgment walks one fixed path to idle
4
+
5
+ With GTD_FLAG_NAIVE_PASS on and GTD_FLAG_RISK_TIER off, a naive pass touching
6
+ an existing non-allowlisted file is ruled refactor-first, rests at the
7
+ approval gate, and is refactored before it is implemented. The flags are
8
+ pinned so the per-flag test runs never move it off its path.
9
+
10
+ Background:
11
+ Given the shipped workflows, as gtd install scaffolds them
12
+ And an environment variable "GTD_QUALITYREVIEWS" set to ""
13
+ And an environment variable "GTD_FLAG_NAIVE_PASS" set to "1"
14
+ And an environment variable "GTD_FLAG_RISK_TIER" set to "0"
15
+ And a file "src/calc.ts" with:
16
+ """
17
+ export const add = (a: number, b: number) => a + b
18
+ """
19
+ And the working tree is committed as "feat: add calculator"
20
+ And a file "TODO.md" with:
21
+ """
22
+ # Add subtract
23
+
24
+ subtract(a, b) returns the difference.
25
+ """
26
+ And step "unwind" changes nothing
27
+ And step "start-gate.check" changes nothing
28
+ And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
29
+ """
30
+ # Requirements
31
+
32
+ ## Concerns
33
+
34
+ ### Subtract
35
+
36
+ - `subtract(a, b)` returns `a - b`.
37
+ """
38
+ And step "design.gate.answer" changes nothing
39
+
40
+ Scenario: a refactor-first judgment runs approval, refactor, implement and review to idle
41
+ Given step "seam.naive" writes "src/calc.ts" with:
42
+ """
43
+ export const add = (a: number, b: number) => a + b
44
+ export const subtract = (a: number, b: number) => a - b
45
+ """
46
+ And judge step "seam.judge" answers:
47
+ """
48
+ [{"id":"shape","answer":"refactor-first","p":0.9}]
49
+ """
50
+ And step "refactor.deriving" runs its script
51
+ And step "build.review.reviewing" writes ".gtd/REVIEW.md" with:
52
+ """
53
+ # Review: abc1234
54
+
55
+ <!-- base: 0000000 -->
56
+
57
+ ## calc
58
+
59
+ - [ ] ./src/calc.ts#1-3
60
+ subtract built on the shared op
61
+ """
62
+ And step "build.review.closing" runs its script
63
+ When the process is driven
64
+ Then the process rests at "seam.approve"
65
+ And the resting step's content contains "src/calc.ts"
66
+
67
+ When gtd lands
68
+ And the process is driven
69
+ Then the process rests at "refactor.building"
70
+ And ".gtd/REFACTOR.md" contains "calc.ts`"
71
+
72
+ Given step "refactor.building" writes "src/calc.ts" with:
73
+ """
74
+ export const op = (a: number, b: number, sign: number) => a + sign * b
75
+ export const add = (a: number, b: number) => op(a, b, 1)
76
+ """
77
+ And step "refactor.health.check" changes nothing
78
+ And step "refactor.closing" runs its script
79
+ When the process is driven
80
+ Then the process rests at "implement.building"
81
+ And ".gtd/REFACTOR.md" does not exist
82
+ And "src/calc.ts" contains "op(a, b, 1)"
83
+
84
+ Given step "implement.building" writes "src/calc.ts" with:
85
+ """
86
+ export const op = (a: number, b: number, sign: number) => a + sign * b
87
+ export const add = (a: number, b: number) => op(a, b, 1)
88
+ export const subtract = (a: number, b: number) => op(a, b, -1)
89
+ """
90
+ And step "implement.health.check" changes nothing
91
+ And step "implement.closing" runs its script
92
+ When the process is driven
93
+ Then the process rests at "build.review.await-review"
94
+
95
+ Given a file ".gtd/REVIEW.md" with:
96
+ """
97
+ # Review: abc1234
98
+
99
+ <!-- base: 0000000 -->
100
+
101
+ ## calc
102
+
103
+ - [x] ./src/calc.ts#1-3
104
+ subtract built on the shared op
105
+ """
106
+ When gtd lands
107
+ And the process is driven
108
+ Then the process rests at "idle"
109
+ And "src/calc.ts" contains "op(a, b, 1)"
110
+ And "src/calc.ts" contains "subtract"
111
+ And the commit subjects end with:
112
+ """
113
+ gtd(human): idle → unwind
114
+ gtd(check): unwind → start-gate.check
115
+ gtd(check): start-gate.check → design.triage
116
+ gtd(agent): design.triage → design.gate.answer
117
+ gtd(human): design.gate.answer → seam.naive
118
+ gtd(agent): seam.naive → seam.judge
119
+ gtd(judge): seam.judge → seam.approve
120
+ gtd(human): seam.approve → refactor.deriving
121
+ gtd(check): refactor.deriving → refactor.building
122
+ gtd(agent): refactor.building → refactor.health.check
123
+ gtd(check): refactor.health.check → refactor.closing
124
+ gtd(check): refactor.closing → implement.building
125
+ gtd(agent): implement.building → implement.health.check
126
+ gtd(check): implement.health.check → implement.closing
127
+ gtd(check): implement.closing → build.review.reviewing
128
+ gtd(agent): build.review.reviewing → build.review.await-review
129
+ gtd(human): build.review.await-review → build.review.closing
130
+ gtd(check): build.review.closing → idle
131
+ """
132
+ And the commit "gtd(human): idle → unwind" has a body containing "Gtd-Var: flag_naive_pass=1"
133
+ And the commit "gtd(human): idle → unwind" has a body containing "Gtd-Var: flag_risk_tier=0"
134
+ And the commit "gtd(agent): seam.naive → seam.judge" has a body containing "Gtd-Kept:"
135
+ And the commit "gtd(judge): seam.judge → seam.approve" has a body containing "\"answer\":\"refactor-first\""
136
+ And the commit "gtd(human): seam.approve → refactor.deriving" has a body containing "Gtd-Approved: {\"step\":\"seam.approve#1\",\"name\":\"Test\",\"email\":\"test@test.com\"}"
137
+ And no commit body contains "Gtd-Workflow:"
@@ -0,0 +1,238 @@
1
+ @inmem
2
+ Feature: the risk tier is proposed at triage and recorded behind GTD_FLAG_RISK_TIER
3
+
4
+ With GTD_FLAG_NAIVE_PASS and GTD_FLAG_RISK_TIER both on, design.triage asks
5
+ for a risk tier and production signals, and the design gate's exit lands them
6
+ as Gtd-Mark trailers: one `risk-tier=<low|high>`, one `production-signal`
7
+ per signal. A missing or unreadable tier is high. With the flag off, nothing
8
+ is asked and no commit carries a Gtd-Mark.
9
+
10
+ Background:
11
+ Given the shipped workflows, as gtd install scaffolds them
12
+ And an environment variable "GTD_QUALITYREVIEWS" set to ""
13
+ And an environment variable "GTD_FLAG_NAIVE_PASS" set to "1"
14
+
15
+ Rule: with GTD_FLAG_RISK_TIER on
16
+
17
+ Background:
18
+ Given an environment variable "GTD_FLAG_RISK_TIER" set to "1"
19
+ And a file "src/calc.ts" with:
20
+ """
21
+ export const add = (a: number, b: number) => a + b
22
+ """
23
+ And a file "src/calc.test.ts" with:
24
+ """
25
+ import { expect, it } from "vitest"
26
+ it("adds", () => expect(1 + 1).toBe(2))
27
+ """
28
+ And the working tree is committed as "feat: add calculator"
29
+ And a file "TODO.md" with:
30
+ """
31
+ # Add subtract
32
+
33
+ subtract(a, b) returns the difference.
34
+ """
35
+ And step "unwind" changes nothing
36
+ And step "start-gate.check" changes nothing
37
+
38
+ Scenario: with both flags on the triage prompt asks for the tier and the signals
39
+ When the process is driven
40
+ Then the process rests at "design.triage"
41
+ And the resting step's content contains "## Risk Tier"
42
+ And the resting step's content contains "## Production Signals"
43
+ And the resting step's content contains "unsure means `high`"
44
+
45
+ Scenario: a low tier marks risk-tier=low on the design-exit commit
46
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
47
+ """
48
+ # Requirements
49
+
50
+ ## Risk Tier
51
+
52
+ low — trivial copy change
53
+ """
54
+ And step "design.gate.answer" changes nothing
55
+ When the process is driven
56
+ Then the process rests at "seam.naive"
57
+ And the last commit subject is "gtd(human): design.gate.answer → seam.naive"
58
+ And the last commit body contains "Gtd-Mark: risk-tier=low"
59
+
60
+ Scenario: a high tier marks the design-exit commit
61
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
62
+ """
63
+ # Requirements
64
+
65
+ ## Risk Tier
66
+
67
+ high — touches payments
68
+ """
69
+ And step "design.gate.answer" changes nothing
70
+ When the process is driven
71
+ Then the process rests at "seam.naive"
72
+ And the last commit subject is "gtd(human): design.gate.answer → seam.naive"
73
+ And the last commit body contains "Gtd-Mark: risk-tier=high"
74
+
75
+ Scenario Outline: a missing section or an unknown word counts as high
76
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
77
+ """
78
+ # Requirements
79
+
80
+ <tier section>
81
+ ## Concerns
82
+
83
+ ### Subtract
84
+ """
85
+ And step "design.gate.answer" changes nothing
86
+ When the process is driven
87
+ Then the process rests at "seam.naive"
88
+ And the last commit body contains "Gtd-Mark: risk-tier=high"
89
+
90
+ Examples:
91
+ | tier section |
92
+ | |
93
+ | ## Risk Tier\n\nmedium — hmm |
94
+ | ```\n## Risk Tier\n\nlow\n```\n |
95
+
96
+ Scenario Outline: signals written at triage land as marks for either tier
97
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
98
+ """
99
+ # Requirements
100
+
101
+ ## Risk Tier
102
+
103
+ <tier> — reason
104
+
105
+ ## Production Signals
106
+
107
+ - error rate on /subtract stays flat
108
+ - p95 latency
109
+ """
110
+ And step "design.gate.answer" changes nothing
111
+ When the process is driven
112
+ Then the process rests at "seam.naive"
113
+ And the last commit body contains "Gtd-Mark: production-signal=error rate on /subtract stays flat"
114
+ And the last commit body contains "Gtd-Mark: production-signal=p95 latency"
115
+
116
+ Examples:
117
+ | tier |
118
+ | low |
119
+ | high |
120
+
121
+ Scenario: the tier comes from the requirements the final design gate lap accepted
122
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
123
+ """
124
+ # Requirements
125
+
126
+ ## Risk Tier
127
+
128
+ low — trivial copy change
129
+ """
130
+ And step "seam.naive" writes "src/calc.ts" with:
131
+ """
132
+ export const add = (a: number, b: number) => a + b
133
+ export const subtract = (a: number, b: number) => a - b
134
+ """
135
+ And judge step "seam.judge" answers:
136
+ """
137
+ [{"id":"shape","answer":"land","p":0.9}]
138
+ """
139
+ When the process is driven
140
+ Then the process rests at "design.gate.answer"
141
+ Given a file ".gtd/REQUIREMENTS.md" with:
142
+ """
143
+ # Requirements
144
+
145
+ ## Risk Tier
146
+
147
+ high — touches payments
148
+ """
149
+ And step "design.triage" from now on changes nothing
150
+ And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
151
+ """
152
+ # Requirements
153
+
154
+ ## Risk Tier
155
+
156
+ high — touches payments
157
+
158
+ ## Concerns
159
+
160
+ ### Subtract
161
+ """
162
+ And step "design.gate.answer" changes nothing
163
+ When the process is driven
164
+ Then the process rests at "implement.building"
165
+ And the resting step's content contains "Put the new behaviour behind a new release flag"
166
+ And the resting step's content does not contain "Add no release flag"
167
+
168
+ Rule: with GTD_FLAG_RISK_TIER off
169
+
170
+ Background:
171
+ Given an environment variable "GTD_FLAG_RISK_TIER" set to "0"
172
+ And a file "src/calc.ts" with:
173
+ """
174
+ export const add = (a: number, b: number) => a + b
175
+ """
176
+ And a file "src/calc.test.ts" with:
177
+ """
178
+ import { expect, it } from "vitest"
179
+ it("adds", () => expect(1 + 1).toBe(2))
180
+ """
181
+ And the working tree is committed as "feat: add calculator"
182
+ And a file "TODO.md" with:
183
+ """
184
+ # Add subtract
185
+
186
+ subtract(a, b) returns the difference.
187
+ """
188
+ And step "unwind" changes nothing
189
+ And step "start-gate.check" changes nothing
190
+
191
+ Scenario: the flag-off twin asks for no tier and marks no commit
192
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
193
+ """
194
+ # Requirements
195
+
196
+ ## Risk Tier
197
+
198
+ low — trivial
199
+
200
+ ## Production Signals
201
+
202
+ - error rate stays flat
203
+ """
204
+ And step "design.gate.answer" changes nothing
205
+ When the process is driven
206
+ Then the process rests at "seam.naive"
207
+ And no commit body contains "Gtd-Mark"
208
+
209
+ Scenario: the flag-off twin's triage prompt has no tier section
210
+ When the process is driven
211
+ Then the process rests at "design.triage"
212
+ And the resting step's content does not contain "## Risk Tier"
213
+ And the resting step's content does not contain "## Production Signals"
214
+
215
+
216
+ Scenario: the flag-off twin keeps today's flag demand
217
+ Given step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
218
+ """
219
+ # Requirements
220
+
221
+ ## Risk Tier
222
+
223
+ low — trivial
224
+ """
225
+ And step "design.gate.answer" changes nothing
226
+ And step "seam.naive" writes "src/calc.ts" with:
227
+ """
228
+ export const add = (a: number, b: number) => a + b
229
+ export const subtract = (a: number, b: number) => a - b
230
+ """
231
+ And judge step "seam.judge" answers:
232
+ """
233
+ [{"id":"shape","answer":"land","p":0.9}]
234
+ """
235
+ When the process is driven
236
+ Then the process rests at "implement.building"
237
+ And the resting step's content contains "Put the new behaviour behind a new release flag"
238
+ And the resting step's content does not contain "Add no release flag"