@windyroad/itil 0.61.1 → 0.61.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 (171) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +7 -2
  3. package/agents/test/fixtures/proceed-new-genuinely-new.md +0 -43
  4. package/agents/test/fixtures/proceed-new-subtle-sibling.md +0 -47
  5. package/agents/test/fixtures/regression-p347-vs-p346.md +0 -54
  6. package/agents/test/hang-off-check.bats +0 -225
  7. package/hooks/test/block-list.bats +0 -153
  8. package/hooks/test/command-detect.bats +0 -181
  9. package/hooks/test/itil-assistant-output-gate.bats +0 -114
  10. package/hooks/test/itil-assistant-output-review.bats +0 -224
  11. package/hooks/test/itil-bash-polling-antipattern-detect.bats +0 -154
  12. package/hooks/test/itil-changeset-discipline.bats +0 -603
  13. package/hooks/test/itil-claude-space-protection.bats +0 -294
  14. package/hooks/test/itil-commit-trailer-transition-advisory.bats +0 -80
  15. package/hooks/test/itil-correction-detect.bats +0 -189
  16. package/hooks/test/itil-deferral-cadence-gate.bats +0 -187
  17. package/hooks/test/itil-fictional-defer-detect.bats +0 -292
  18. package/hooks/test/itil-fix-title-lifecycle-advisory.bats +0 -129
  19. package/hooks/test/itil-mid-loop-ask-detect.bats +0 -220
  20. package/hooks/test/itil-no-implement-draft-gate.bats +0 -210
  21. package/hooks/test/itil-pending-questions-surface.bats +0 -307
  22. package/hooks/test/itil-readme-refresh-discipline.bats +0 -642
  23. package/hooks/test/itil-rfc-oversight-nudge.bats +0 -83
  24. package/hooks/test/itil-rfc-trailer-advisory.bats +0 -375
  25. package/hooks/test/itil-story-mirror-migration-nudge.bats +0 -122
  26. package/hooks/test/manage-problem-enforce-create.bats +0 -424
  27. package/hooks/test/p057-staging-trap-detect.bats +0 -231
  28. package/hooks/test/pre-publish-intake-gate.bats +0 -144
  29. package/hooks/test/runtime-sid-marker.bats +0 -90
  30. package/hooks/test/session-id.bats +0 -370
  31. package/scripts/migrate-problems-add-type.sh +0 -116
  32. package/scripts/test/catchup-scan.bats +0 -274
  33. package/scripts/test/check-afk-accept-eligible.bats +0 -310
  34. package/scripts/test/check-fail-soft-skip-discipline.bats +0 -172
  35. package/scripts/test/check-fix-rfc-trace.bats +0 -164
  36. package/scripts/test/check-locale-discipline.bats +0 -291
  37. package/scripts/test/check-problems-readme-budget.bats +0 -192
  38. package/scripts/test/check-rfc-has-stories.bats +0 -69
  39. package/scripts/test/check-rfc-rejected-alternatives.bats +0 -108
  40. package/scripts/test/check-rfc-stories-ratified.bats +0 -82
  41. package/scripts/test/check-upstream-responses.bats +0 -503
  42. package/scripts/test/classify-readme-drift.bats +0 -392
  43. package/scripts/test/derive-first-dispatch.bats +0 -274
  44. package/scripts/test/derive-release-vehicle.bats +0 -454
  45. package/scripts/test/detect-unratified-stories-maps.bats +0 -60
  46. package/scripts/test/dual-tolerant-glob-rfc-002-t2.bats +0 -309
  47. package/scripts/test/effort-tally.bats +0 -170
  48. package/scripts/test/evaluate-relevance.bats +0 -773
  49. package/scripts/test/kind-a-commands.bats +0 -46
  50. package/scripts/test/mark-create-gate.bats +0 -59
  51. package/scripts/test/mark-story-oversight-confirmed.bats +0 -53
  52. package/scripts/test/migrate-problems-add-type.bats +0 -280
  53. package/scripts/test/migrate-story-status-mirror.bats +0 -167
  54. package/scripts/test/no-type-regression-guard.bats +0 -74
  55. package/scripts/test/oversight-mirror-corpus-lint.bats +0 -150
  56. package/scripts/test/plugin-exercise-index.bats +0 -386
  57. package/scripts/test/plugin-maturity-doc-lint.bats +0 -470
  58. package/scripts/test/plugin-maturity-populate.bats +0 -631
  59. package/scripts/test/plugin-maturity-render.bats +0 -469
  60. package/scripts/test/plugin-validate-ci-gate.bats +0 -208
  61. package/scripts/test/reconcile-readme.bats +0 -1007
  62. package/scripts/test/reconcile-rfcs.bats +0 -496
  63. package/scripts/test/reconcile-stories.bats +0 -173
  64. package/scripts/test/reconcile-story-maps.bats +0 -74
  65. package/scripts/test/release-watch-poll-loop.bats +0 -180
  66. package/scripts/test/resolve-governance-plugin-dirs.bats +0 -78
  67. package/scripts/test/rfc-stories-extension.bats +0 -175
  68. package/scripts/test/skill-invocations.bats +0 -535
  69. package/scripts/test/skill-md-dual-tolerant-coverage-rfc-002-t3.bats +0 -374
  70. package/scripts/test/story-oversight-lib.bats +0 -190
  71. package/scripts/test/update-jtbd-references-related-problems.bats +0 -178
  72. package/scripts/test/update-problem-references-section.bats +0 -242
  73. package/scripts/test/update-problem-rfcs-section.bats +0 -242
  74. package/scripts/test/update-references-section-sibling-helpers.bats +0 -80
  75. package/scripts/test/update-rfc-commits-section.bats +0 -77
  76. package/scripts/test/verify-iter-summary.bats +0 -196
  77. package/scripts/test/working-the-problem-traversal.bats +0 -116
  78. package/skills/capture-problem/test/capture-problem-step-1-5b-jtbd-trace.bats +0 -398
  79. package/skills/capture-problem/test/capture-problem.bats +0 -389
  80. package/skills/capture-story/test/capture-story-behavioural.bats +0 -317
  81. package/skills/capture-story-map/test/capture-story-map-behavioural.bats +0 -98
  82. package/skills/close-incident/test/close-incident-contract.bats +0 -146
  83. package/skills/link-incident/test/link-incident-contract.bats +0 -125
  84. package/skills/list-incidents/test/list-incidents-contract.bats +0 -115
  85. package/skills/list-problems/test/list-problems-contract.bats +0 -100
  86. package/skills/list-stories/test/list-stories-contract.bats +0 -127
  87. package/skills/list-story-maps/test/list-story-maps-contract.bats +0 -46
  88. package/skills/manage-incident/test/manage-incident-adr-044-contract.bats +0 -206
  89. package/skills/manage-incident/test/manage-incident-close-forwarder.bats +0 -67
  90. package/skills/manage-incident/test/manage-incident-link-forwarder.bats +0 -67
  91. package/skills/manage-incident/test/manage-incident-list-forwarder.bats +0 -68
  92. package/skills/manage-incident/test/manage-incident-mitigate-forwarder.bats +0 -66
  93. package/skills/manage-incident/test/manage-incident-restore-forwarder.bats +0 -66
  94. package/skills/manage-incident/test/manage-incident.bats +0 -171
  95. package/skills/manage-problem/test/manage-problem-adr-044-step4-derive-first.bats +0 -151
  96. package/skills/manage-problem/test/manage-problem-auto-migrate-step.bats +0 -53
  97. package/skills/manage-problem/test/manage-problem-concern-boundary.bats +0 -64
  98. package/skills/manage-problem/test/manage-problem-effort-buckets.bats +0 -56
  99. package/skills/manage-problem/test/manage-problem-external-root-cause-detection.bats +0 -119
  100. package/skills/manage-problem/test/manage-problem-first-run-intake-prompt.bats +0 -43
  101. package/skills/manage-problem/test/manage-problem-git-mv-restage-reminder.bats +0 -48
  102. package/skills/manage-problem/test/manage-problem-id-collision-guard.bats +0 -39
  103. package/skills/manage-problem/test/manage-problem-list-forwarder.bats +0 -66
  104. package/skills/manage-problem/test/manage-problem-next-id-origin-lookup.bats +0 -50
  105. package/skills/manage-problem/test/manage-problem-no-prose-options.bats +0 -74
  106. package/skills/manage-problem/test/manage-problem-output-formatting.bats +0 -30
  107. package/skills/manage-problem/test/manage-problem-parked-and-cache.bats +0 -73
  108. package/skills/manage-problem/test/manage-problem-readme-refresh-on-transition.bats +0 -62
  109. package/skills/manage-problem/test/manage-problem-readme-tie-break-order.bats +0 -318
  110. package/skills/manage-problem/test/manage-problem-readme-vq-sort-order.bats +0 -206
  111. package/skills/manage-problem/test/manage-problem-release-vehicle-seed.bats +0 -83
  112. package/skills/manage-problem/test/manage-problem-review-forwarder.bats +0 -71
  113. package/skills/manage-problem/test/manage-problem-step-9d-recovery-path.bats +0 -97
  114. package/skills/manage-problem/test/manage-problem-transition-forwarder.bats +0 -96
  115. package/skills/manage-problem/test/manage-problem-transitive-dependencies.bats +0 -365
  116. package/skills/manage-problem/test/manage-problem-verification-detection.bats +0 -64
  117. package/skills/manage-problem/test/manage-problem-verification-pending.bats +0 -114
  118. package/skills/manage-problem/test/manage-problem-work-forwarder.bats +0 -88
  119. package/skills/manage-story/test/manage-story-contract.bats +0 -174
  120. package/skills/manage-story-map/test/manage-story-map-contract.bats +0 -63
  121. package/skills/mitigate-incident/test/mitigate-incident-contract.bats +0 -258
  122. package/skills/reconcile-readme/test/reconcile-readme-contract.bats +0 -201
  123. package/skills/report-upstream/test/report-upstream-contract.bats +0 -394
  124. package/skills/restore-incident/test/restore-incident-contract.bats +0 -170
  125. package/skills/review-problems/test/inbound-channels-cache-shape.bats +0 -127
  126. package/skills/review-problems/test/inbound-discovery-contract.bats +0 -383
  127. package/skills/review-problems/test/jtbd-301-verdict-shape-contract.bats +0 -225
  128. package/skills/review-problems/test/review-problems-contract.bats +0 -235
  129. package/skills/review-problems/test/review-problems-likely-verified-cell-shape.bats +0 -229
  130. package/skills/scaffold-intake/test/scaffold-intake-contract.bats +0 -126
  131. package/skills/scaffold-intake/test/scaffold-intake-fixture.bats +0 -164
  132. package/skills/scaffold-intake/test/scaffold-intake-secrets-absent.bats +0 -87
  133. package/skills/transition-problem/test/transition-problem-contract.bats +0 -285
  134. package/skills/transition-problems/test/transition-problems-contract.bats +0 -331
  135. package/skills/update-upstream/test/update-upstream-contract.bats +0 -375
  136. package/skills/work-problem/test/work-problem-contract.bats +0 -294
  137. package/skills/work-problems/test/work-problems-above-appetite-remediation.bats +0 -139
  138. package/skills/work-problems/test/work-problems-adr-013-rule-6-p352-amendment.bats +0 -166
  139. package/skills/work-problems/test/work-problems-auto-migrate-step.bats +0 -57
  140. package/skills/work-problems/test/work-problems-cost-logging.bats +0 -109
  141. package/skills/work-problems/test/work-problems-deviation-candidate-shape.bats +0 -121
  142. package/skills/work-problems/test/work-problems-first-run-intake-prompt.bats +0 -36
  143. package/skills/work-problems/test/work-problems-inter-iteration-verify.bats +0 -59
  144. package/skills/work-problems/test/work-problems-mid-loop-userpromptsubmit-handler.bats +0 -69
  145. package/skills/work-problems/test/work-problems-no-mid-loop-asking.bats +0 -192
  146. package/skills/work-problems/test/work-problems-p341-pre-all-done-gate.bats +0 -122
  147. package/skills/work-problems/test/work-problems-p342-r007-derive-then-pass-flags.bats +0 -170
  148. package/skills/work-problems/test/work-problems-p342-retro-auto-ticket-carveout.bats +0 -120
  149. package/skills/work-problems/test/work-problems-preflight-failure-handling.bats +0 -248
  150. package/skills/work-problems/test/work-problems-preflight-session-continuity.bats +0 -139
  151. package/skills/work-problems/test/work-problems-preflight.bats +0 -69
  152. package/skills/work-problems/test/work-problems-release-cadence.bats +0 -63
  153. package/skills/work-problems/test/work-problems-step-0-iter-error-staleness.bats +0 -93
  154. package/skills/work-problems/test/work-problems-step-0b-cache-staleness-behavioural.bats +0 -138
  155. package/skills/work-problems/test/work-problems-step-0c-deferred-placeholder-staleness-behavioural.bats +0 -238
  156. package/skills/work-problems/test/work-problems-step-0d-outbound-responses-staleness-behavioural.bats +0 -174
  157. package/skills/work-problems/test/work-problems-step-2-5-routing.bats +0 -80
  158. package/skills/work-problems/test/work-problems-step-2-5b-cross-halt-routing.bats +0 -149
  159. package/skills/work-problems/test/work-problems-step-3-5-jtbd-ratification-predicate.bats +0 -191
  160. package/skills/work-problems/test/work-problems-step-5-bats-polling-discipline.bats +0 -91
  161. package/skills/work-problems/test/work-problems-step-5-delegation.bats +0 -333
  162. package/skills/work-problems/test/work-problems-step-5-idle-timeout-sigterm.bats +0 -421
  163. package/skills/work-problems/test/work-problems-step-5-is-error-transient-halt.bats +0 -278
  164. package/skills/work-problems/test/work-problems-step-5-iter-changeset-required.bats +0 -95
  165. package/skills/work-problems/test/work-problems-step-5-prompt-body-re-grounding.bats +0 -128
  166. package/skills/work-problems/test/work-problems-step-5-stream-timeout-salvage.bats +0 -251
  167. package/skills/work-problems/test/work-problems-step-6-5-always-drain.bats +0 -203
  168. package/skills/work-problems/test/work-problems-step-6-5-cache-refresh-chain.bats +0 -174
  169. package/skills/work-problems/test/work-problems-step-6-5-fix-and-continue.bats +0 -254
  170. package/skills/work-problems/test/work-problems-step-6-5-postrelease-kv-callback.bats +0 -209
  171. package/skills/work-problems/test/work-problems-stop-condition-questions.bats +0 -85
@@ -1,254 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # P140: /wr-itil:work-problems Step 6.5 Failure handling subsection must
4
- # document diagnose-then-classify routing — fix-and-continue for the
5
- # documented mechanically-fixable allow-list, halt for everything else.
6
- #
7
- # Prior behaviour was a uniform halt-on-CI-failure rule that converted
8
- # 1-line stale-grep-string updates and transient flakes into ~45min queue
9
- # stalls, regressing JTBD-006 "Progress the Backlog While I'm Away"
10
- # without any governance benefit. P140's Phase 1 amendment replaces that
11
- # uniform rule with a closed allow-list policy authorising silent
12
- # fix-and-continue per ADR-013 Rule 5, capped at 3 retries per iteration
13
- # before falling back to the halt branch.
14
- #
15
- # Doc-lint contract assertions per ADR-037 Permitted Exception
16
- # (contract-assertion class — same shape as the P130 / P126 / P135
17
- # sibling fixtures). The asserted prose IS the load-bearing policy
18
- # surface — re-reading the SKILL.md is the only way an AFK reader (and
19
- # the iteration subprocess) learns the fixable-class taxonomy and the
20
- # retry cap. Behavioural verification is impossible until Phase 2's
21
- # advisory classifier ships (deferred per the ticket Fix Strategy —
22
- # observe over 30 days).
23
- #
24
- # @problem P140
25
- # @adr ADR-013 (Rule 5 — policy-authorised silent action)
26
- # @adr ADR-014 (one-commit-per-iter; retries each ride their own commit)
27
- # @adr ADR-018 (inter-iteration release cadence; this refines its
28
- # Failure handling clause)
29
- # @adr ADR-026 (agent output grounding — diagnostic preamble citation)
30
- # @adr ADR-037 (skill-testing strategy — contract-assertion class)
31
- # @adr ADR-042 (above-appetite branch — Rule 3 commit-gate-per-retry
32
- # precedent composes with this fix-and-continue branch)
33
- # @adr ADR-044 (decision-delegation contract — framework-resolution
34
- # boundary; closed allow-list extensions are deviation-candidates)
35
- # @jtbd JTBD-006 (Progress the Backlog While I'm Away — primary)
36
- # @jtbd JTBD-001 (Enforce Governance Without Slowing Down — composes;
37
- # per-retry gates preserve governance)
38
-
39
- setup() {
40
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
41
- SKILL_MD="$REPO_ROOT/packages/itil/skills/work-problems/SKILL.md"
42
- }
43
-
44
- @test "work-problems P140: SKILL.md exists" {
45
- [ -f "$SKILL_MD" ]
46
- }
47
-
48
- # ── Failure handling subsection identity ───────────────────────────────────
49
-
50
- @test "work-problems P140: Step 6.5 Failure handling subsection cites P140" {
51
- # The amendment must self-identify so future readers tracing back from
52
- # the ticket find the load-bearing prose without keyword-guessing.
53
- run grep -nE 'Failure handling.*P140|P140.*Failure handling' "$SKILL_MD"
54
- [ "$status" -eq 0 ]
55
- }
56
-
57
- # ── Diagnostic preamble (ADR-026 grounding) ────────────────────────────────
58
-
59
- @test "work-problems P140: Failure handling cites gh run view --log-failed as the diagnostic preamble" {
60
- # ADR-026 grounding: the orchestrator MUST read the actual failure
61
- # output before classifying. Without this, classification degrades to
62
- # guess-from-context.
63
- run grep -nE 'gh run view.*--log-failed' "$SKILL_MD"
64
- [ "$status" -eq 0 ]
65
- }
66
-
67
- @test "work-problems P140: Failure handling cites ADR-026 (grounding) on the diagnostic preamble" {
68
- # The grounding requirement should cite ADR-026 explicitly so the
69
- # connection is auditable.
70
- run grep -nE 'ADR-026' "$SKILL_MD"
71
- [ "$status" -eq 0 ]
72
- }
73
-
74
- # ── Fixable-in-iter allow-list (closed) ────────────────────────────────────
75
-
76
- @test "work-problems P140: Failure handling names P081-class stale-grep-string as a fixable class" {
77
- run grep -nE 'P081-class stale-grep-string|stale-grep-string' "$SKILL_MD"
78
- [ "$status" -eq 0 ]
79
- }
80
-
81
- @test "work-problems P140: Failure handling names hook stub mismatch as a fixable class" {
82
- run grep -niE 'hook stub mismatch' "$SKILL_MD"
83
- [ "$status" -eq 0 ]
84
- }
85
-
86
- @test "work-problems P140: Failure handling names test ID drift as a fixable class" {
87
- run grep -niE 'test ID drift' "$SKILL_MD"
88
- [ "$status" -eq 0 ]
89
- }
90
-
91
- @test "work-problems P140: Failure handling names environmental flake as a fixable class" {
92
- run grep -niE 'environmental flake' "$SKILL_MD"
93
- [ "$status" -eq 0 ]
94
- }
95
-
96
- @test "work-problems P140: allow-list is framed as 'closed' (not extensible at agent discretion)" {
97
- # JTBD review guard-rail: persona could misread "fix-and-continue" as
98
- # "auto-fix anything" without the closed framing. Future agent edits
99
- # must not drift the allow-list open without explicit user direction.
100
- run grep -niE 'allow-list.*closed|closed.*allow-list' "$SKILL_MD"
101
- [ "$status" -eq 0 ]
102
- }
103
-
104
- @test "work-problems P140: extending the allow-list is framed as a deviation-candidate per ADR-044" {
105
- # ADR-044 framework-resolution boundary: the closed list IS the
106
- # framework-resolved policy. Adding a class is a direction-setting
107
- # decision, not a mechanical fix.
108
- run grep -niE 'deviation-candidate.*ADR-044|ADR-044.*deviation' "$SKILL_MD"
109
- [ "$status" -eq 0 ]
110
- }
111
-
112
- @test "work-problems P140: ambiguous classification defaults to halt (no diagnose-then-guess)" {
113
- # JTBD review guard-rail (b): without this, the persona-misread risk
114
- # of "auto-fix anything" re-enters via fuzzy classification.
115
- run grep -niE 'Ambiguous classification defaults to halt|ambiguous.*halt' "$SKILL_MD"
116
- [ "$status" -eq 0 ]
117
- }
118
-
119
- # ── Fix-and-continue branch ────────────────────────────────────────────────
120
-
121
- @test "work-problems P140: Failure handling documents a fix-and-continue branch" {
122
- run grep -niE 'Fix-and-continue branch|fix-and-continue branch' "$SKILL_MD"
123
- [ "$status" -eq 0 ]
124
- }
125
-
126
- @test "work-problems P140: each fix-and-continue retry rides standard ADR-014 commit gate flow (architect / JTBD / risk-scorer)" {
127
- # Architect-flagged invariant: governance gates MUST run on every
128
- # retry. The fix-and-continue branch does NOT bypass gates.
129
- run grep -niE 'standard ADR-014 commit gate flow|ADR-014.*commit gate' "$SKILL_MD"
130
- [ "$status" -eq 0 ]
131
- }
132
-
133
- @test "work-problems P140: ADR-042 Rule 3 commit-gate-per-retry precedent is cross-referenced" {
134
- # ADR-042 already establishes that retries each ride their own
135
- # commit through full gate flow. P140 composes with that precedent
136
- # rather than inventing a new commit-cardinality rule.
137
- run grep -niE 'ADR-042 Rule 3' "$SKILL_MD"
138
- [ "$status" -eq 0 ]
139
- }
140
-
141
- # ── 3-retry cap (per iteration) ────────────────────────────────────────────
142
-
143
- @test "work-problems P140: Failure handling caps fix-and-continue at 3 retries" {
144
- run grep -niE '3-retry cap|3 retr|three retr' "$SKILL_MD"
145
- [ "$status" -eq 0 ]
146
- }
147
-
148
- @test "work-problems P140: 3-retry cap is per-iteration, not per-failure-class" {
149
- # Without this clarification, an agent could reset the counter on
150
- # each new failure class and drain budget indefinitely.
151
- run grep -niE 'per[- ]iteration, not per[- ]failure[- ]class|cap is per[- ]iteration' "$SKILL_MD"
152
- [ "$status" -eq 0 ]
153
- }
154
-
155
- # ── Halt branch preserved ──────────────────────────────────────────────────
156
-
157
- @test "work-problems P140: Halt branch preserved for genuinely-unrecoverable failures" {
158
- run grep -niE 'genuinely-unrecoverable|genuinely unrecoverable' "$SKILL_MD"
159
- [ "$status" -eq 0 ]
160
- }
161
-
162
- @test "work-problems P140: Halt branch enumerates auth failure / npm publish rejection / semantic test as unrecoverable" {
163
- # The halt branch's allow-list mirror — naming the unrecoverable
164
- # classes makes the boundary auditable.
165
- run grep -niE 'auth failure|npm publish rejection|semantic test.*judgment' "$SKILL_MD"
166
- [ "$status" -eq 0 ]
167
- }
168
-
169
- # ── Step 2.5b cross-reference preserved (P126) ─────────────────────────────
170
-
171
- @test "work-problems P140: Halt branch routes through Step 2.5b surfacing routine (P126 preserved)" {
172
- # The halt branch's existing P126 cross-reference must survive the
173
- # amendment — surfacing accumulated user-answerable skips before
174
- # emitting the halt summary remains the contract.
175
- run grep -nE 'Step 2\.5b cross-reference \(P126\)' "$SKILL_MD"
176
- [ "$status" -eq 0 ]
177
- }
178
-
179
- # ── ADR-013 Rule 5 policy-authorised silent action ─────────────────────────
180
-
181
- @test "work-problems P140: fix-and-continue branch is policy-authorised per ADR-013 Rule 5" {
182
- # ADR-044's framework-mediated surface includes "policy-authorised
183
- # silent proceed" — the closed allow-list IS the policy. Future
184
- # readers must find the citation to confirm this is not an ad-hoc
185
- # bypass of Rule 1.
186
- run grep -nE 'ADR-013 Rule 5|Rule 5 policy-authorised|policy-authorised.*ADR-013' "$SKILL_MD"
187
- [ "$status" -eq 0 ]
188
- }
189
-
190
- # ── Composition cross-references ───────────────────────────────────────────
191
-
192
- @test "work-problems P140: Failure handling cross-references P081 (stop-gap composition)" {
193
- # P081 is the structural-tests-are-wasteful root cause. Most
194
- # P081-class stale-grep-string failures are P081's territory.
195
- # Fix-and-continue is the stop-gap; P081's full retrofit is the
196
- # structural elimination.
197
- run grep -nE 'P081' "$SKILL_MD"
198
- [ "$status" -eq 0 ]
199
- }
200
-
201
- @test "work-problems P140: Failure handling cross-references P135 (decision-delegation contract)" {
202
- # P135 + ADR-044 frame the closed allow-list as the
203
- # framework-resolved policy.
204
- run grep -nE 'P135' "$SKILL_MD"
205
- [ "$status" -eq 0 ]
206
- }
207
-
208
- @test "work-problems P140: Failure handling cross-references P130 (orchestrator main-turn ask discipline)" {
209
- # P130 ensures fix-and-continue does NOT introduce mid-iter asks —
210
- # the closed allow-list resolves the decision per ADR-044's
211
- # framework-resolution boundary.
212
- run grep -nE 'P130' "$SKILL_MD"
213
- [ "$status" -eq 0 ]
214
- }
215
-
216
- @test "work-problems P140: Failure handling cross-references P132 (over-ask in interactive sessions)" {
217
- # P140 is the inverse of P132 on the failure-handling surface — both
218
- # arise from over-defensive uniform routing. Naming the symmetry
219
- # protects against future drift.
220
- run grep -nE 'P132' "$SKILL_MD"
221
- [ "$status" -eq 0 ]
222
- }
223
-
224
- # ── Mid-loop ask discipline halt-point bullet narrowed ─────────────────────
225
-
226
- @test "work-problems P140: Step 6.5 CI-failure halt-point bullet narrows to outside-allow-list / cap-reached scope" {
227
- # The Mid-loop ask discipline subsection enumerates Step 6.5 CI-
228
- # failure as a halt point. After P140 the halt fires only on
229
- # unrecoverable failures — the bullet must reflect that narrower
230
- # scope, otherwise future readers conclude all CI failures still
231
- # halt.
232
- run grep -nE 'fixable-in-iter allow-list|3-retry cap reached|outside the.*allow-list' "$SKILL_MD"
233
- [ "$status" -eq 0 ]
234
- }
235
-
236
- # ── Non-Interactive Decision Making table row ──────────────────────────────
237
-
238
- @test "work-problems P140: Decision Making table carries a CI-failure-during-Step-6.5-drain row" {
239
- # The decision table is the AFK reader's quick-reference; without a
240
- # row here the failure-handling refinement is buried 80 lines up in
241
- # Step 6.5.
242
- run grep -nE '\| CI failure during Step 6\.5 drain' "$SKILL_MD"
243
- [ "$status" -eq 0 ]
244
- }
245
-
246
- @test "work-problems P140: Decision Making table row cites the closed fixable-in-iter allow-list" {
247
- run grep -nE 'closed fixable-in-iter allow-list' "$SKILL_MD"
248
- [ "$status" -eq 0 ]
249
- }
250
-
251
- @test "work-problems P140: Decision Making table row cites the 3-retry cap" {
252
- run grep -nE 'CI failure during Step 6\.5.*3-retry cap|3-retry cap.*CI failure' "$SKILL_MD"
253
- [ "$status" -eq 0 ]
254
- }
@@ -1,209 +0,0 @@
1
- #!/usr/bin/env bats
2
- # Step 6.5 Post-release K→V auto-transition callback (P228) — behavioural.
3
- #
4
- # Driver: ADR-022 prescribes K→V transition on release, but until P228
5
- # there was no auto-fire surface to back-fill the transition once a fix
6
- # ships. The post-release callback enumerator
7
- # (`packages/itil/lib/enumerate-postrelease-kv-candidates.sh`) is the
8
- # data source: it walks `docs/problems/known-error/*.md`, invokes the
9
- # derive-release-vehicle helper per ticket, and emits one
10
- # `KV_CANDIDATE: P<NNN> | <changeset>` line per ticket whose changeset
11
- # has shipped (derive exit 0).
12
- #
13
- # The 2026-06-08 P220 witness — `## Fix Released` populated but K→V
14
- # deferred citing a misapplied P143 amendment — is the empirical bug
15
- # this enumerator wires the surface to close.
16
- #
17
- # Cases covered (behavioural — exercise the helper, assert observable
18
- # output; structural ban per ADR-005 / P081):
19
- # 1. known-error/ dir absent → KV_CANDIDATES_SUMMARY: total=0
20
- # 2. known-error/ dir empty → KV_CANDIDATES_SUMMARY: total=0
21
- # 3. ticket present, derive exit 0 → KV_CANDIDATE emitted; total=1
22
- # 4. ticket present, derive exit 2 → skipped silently; total=0
23
- # (no `.changeset/<name>.md` ref in body — legacy ticket)
24
- # 5. ticket present, derive exit 3 → skipped silently; total=0
25
- # (changeset still in working tree — unreleased)
26
- # 6. mixed cohort (3 tickets: shipped + legacy + unreleased)
27
- # → only the shipped one emitted
28
- # 7. README.md inside known-error/ is excluded from the enumeration
29
- # 8. unknown derive exit code → stderr warning + skip; total=0
30
- #
31
- # Cross-references:
32
- # @problem P228 (K→V auto-transition gap)
33
- # @adr ADR-022 (Verifying lifecycle)
34
- # @adr ADR-018 (release-cadence host of the callback)
35
- # @adr ADR-005 (behavioural bats per P081)
36
- # @jtbd JTBD-006 (Progress the Backlog While I'm Away — primary driver)
37
-
38
- setup() {
39
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
40
- HELPER="$REPO_ROOT/packages/itil/lib/enumerate-postrelease-kv-candidates.sh"
41
-
42
- FIXTURE="$(mktemp -d)"
43
- mkdir -p "$FIXTURE/docs/problems"
44
-
45
- STUB_DIR="$(mktemp -d)"
46
- }
47
-
48
- teardown() {
49
- rm -rf "$FIXTURE" "$STUB_DIR"
50
- }
51
-
52
- # Helper — write a stub derive-release-vehicle command that returns a
53
- # canned exit code (per ticket-id-to-exit-code map encoded in $STUB_MAP).
54
- # $STUB_MAP shape: `<NNN>:<exit>:<changeset>;<NNN>:<exit>:<changeset>;...`
55
- # The third field is consumed only when exit=0 (emitted in the RELEASE_VEHICLE
56
- # block the lib greps for changeset path).
57
- write_stub_derive() {
58
- local stub="$STUB_DIR/wr-itil-derive-release-vehicle"
59
- cat > "$stub" <<'STUB'
60
- #!/usr/bin/env bash
61
- # Stub derive-release-vehicle for the enumerator behavioural test. Reads
62
- # $STUB_MAP from the environment, returns canned exit codes per ticket.
63
- nnn="$1"
64
- nnn_norm="$(printf '%03d' "$((10#$nnn))")"
65
- IFS=';' read -ra entries <<< "${STUB_MAP:-}"
66
- for entry in "${entries[@]}"; do
67
- [ -z "$entry" ] && continue
68
- IFS=':' read -r id ex cs <<< "$entry"
69
- id_norm="$(printf '%03d' "$((10#$id))")"
70
- if [ "$id_norm" = "$nnn_norm" ]; then
71
- if [ "$ex" -eq 0 ]; then
72
- cat <<EOF
73
- RELEASE_VEHICLE:
74
- changeset: $cs
75
- version-packages-commit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
76
- pr: #999
77
- merge-commit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
78
- release-date: 2026-06-08
79
- EOF
80
- fi
81
- exit "$ex"
82
- fi
83
- done
84
- # Default: no entry for this ticket → exit 1 (not found)
85
- exit 1
86
- STUB
87
- chmod +x "$stub"
88
- }
89
-
90
- # Helper — write a known-error ticket fixture (body content is opaque to
91
- # the enumerator; only the filename's leading NNN matters since the
92
- # derive helper is stubbed).
93
- write_ke_ticket() {
94
- local nnn="$1"
95
- local slug="$2"
96
- mkdir -p "$FIXTURE/docs/problems/known-error"
97
- cat > "$FIXTURE/docs/problems/known-error/${nnn}-${slug}.md" <<EOF
98
- # Problem ${nnn}: ${slug}
99
-
100
- **Status**: Known Error
101
-
102
- ## Description
103
-
104
- Test fixture for the enumerator behavioural bats.
105
- EOF
106
- }
107
-
108
- # Source the lib once for all tests.
109
- load_lib() {
110
- # shellcheck source=/dev/null
111
- source "$HELPER"
112
- }
113
-
114
- @test "helper file exists and is sourceable" {
115
- [ -f "$HELPER" ]
116
- load_lib
117
- }
118
-
119
- @test "case 1: known-error/ dir absent → total=0" {
120
- load_lib
121
- rm -rf "$FIXTURE/docs/problems/known-error"
122
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
123
- [ "$status" -eq 0 ]
124
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
125
- [[ "$output" != *"KV_CANDIDATE:"* ]]
126
- }
127
-
128
- @test "case 2: known-error/ dir empty → total=0" {
129
- load_lib
130
- mkdir -p "$FIXTURE/docs/problems/known-error"
131
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
132
- [ "$status" -eq 0 ]
133
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
134
- [[ "$output" != *"KV_CANDIDATE:"* ]]
135
- }
136
-
137
- @test "case 3: ticket present + derive exit 0 → KV_CANDIDATE emitted, total=1" {
138
- load_lib
139
- write_stub_derive
140
- write_ke_ticket "228" "adr-022-known-error-to-verifying-transition"
141
- PATH="$STUB_DIR:$PATH" STUB_MAP="228:0:.changeset/p228-fix.md" \
142
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
143
- [ "$status" -eq 0 ]
144
- [[ "$output" == *"KV_CANDIDATE: P228 | .changeset/p228-fix.md"* ]]
145
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=1"* ]]
146
- }
147
-
148
- @test "case 4: ticket present + derive exit 2 (no vehicle ref) → skipped silently, total=0" {
149
- load_lib
150
- write_stub_derive
151
- write_ke_ticket "100" "legacy-pre-p330-no-vehicle"
152
- PATH="$STUB_DIR:$PATH" STUB_MAP="100:2:" \
153
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
154
- [ "$status" -eq 0 ]
155
- [[ "$output" != *"KV_CANDIDATE:"* ]]
156
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
157
- }
158
-
159
- @test "case 5: ticket present + derive exit 3 (unreleased) → skipped silently, total=0" {
160
- load_lib
161
- write_stub_derive
162
- write_ke_ticket "200" "changeset-still-in-tree"
163
- PATH="$STUB_DIR:$PATH" STUB_MAP="200:3:" \
164
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
165
- [ "$status" -eq 0 ]
166
- [[ "$output" != *"KV_CANDIDATE:"* ]]
167
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
168
- }
169
-
170
- @test "case 6: mixed cohort — only the shipped ticket is emitted, total=1" {
171
- load_lib
172
- write_stub_derive
173
- write_ke_ticket "228" "shipped"
174
- write_ke_ticket "100" "legacy-no-vehicle"
175
- write_ke_ticket "200" "changeset-in-tree"
176
- PATH="$STUB_DIR:$PATH" \
177
- STUB_MAP="228:0:.changeset/p228-fix.md;100:2:;200:3:" \
178
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
179
- [ "$status" -eq 0 ]
180
- [[ "$output" == *"KV_CANDIDATE: P228 | .changeset/p228-fix.md"* ]]
181
- [[ "$output" != *"KV_CANDIDATE: P100"* ]]
182
- [[ "$output" != *"KV_CANDIDATE: P200"* ]]
183
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=1"* ]]
184
- }
185
-
186
- @test "case 7: README.md inside known-error/ is excluded from the enumeration" {
187
- load_lib
188
- write_stub_derive
189
- mkdir -p "$FIXTURE/docs/problems/known-error"
190
- printf '# Known Error Tickets\n' > "$FIXTURE/docs/problems/known-error/README.md"
191
- PATH="$STUB_DIR:$PATH" STUB_MAP="" \
192
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
193
- [ "$status" -eq 0 ]
194
- [[ "$output" != *"KV_CANDIDATE:"* ]]
195
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
196
- }
197
-
198
- @test "case 8: unknown derive exit code → stderr warning + skip, total=0" {
199
- load_lib
200
- write_stub_derive
201
- write_ke_ticket "999" "weird-exit"
202
- PATH="$STUB_DIR:$PATH" STUB_MAP="999:42:" \
203
- run enumerate_postrelease_kv_candidates "$FIXTURE/docs/problems"
204
- [ "$status" -eq 0 ]
205
- [[ "$output" != *"KV_CANDIDATE:"* ]]
206
- [[ "$output" == *"KV_CANDIDATES_SUMMARY: total=0"* ]]
207
- # Stderr warning is captured into $output when bats merges stderr; the
208
- # contract here is "skip silently AND don't lose audit signal".
209
- }
@@ -1,85 +0,0 @@
1
- #!/usr/bin/env bats
2
- # Doc-lint guard: work-problems SKILL.md must surface outstanding design
3
- # questions before emitting `ALL_DONE` at stop-condition #2. In AFK mode
4
- # (the persona default per JTBD-006) the questions are listed in the
5
- # post-stop summary as an "Outstanding Design Questions" table. In
6
- # interactive invocations the skill may batch up to 4 questions through
7
- # a single `AskUserQuestion` call per ADR-013 Rule 1.
8
- #
9
- # Structural assertion — Permitted Exception to the source-grep ban
10
- # (ADR-005 / P011). These tests assert that the skill specification
11
- # document contains the stop-condition #2 question-surfacing step and its
12
- # supporting classifier taxonomy.
13
- #
14
- # Cross-reference:
15
- # P053: docs/problems/053-work-problems-does-not-surface-outstanding-design-questions-at-stop.open.md
16
- # ADR-013 Rule 1 / Rule 6: docs/decisions/013-structured-user-interaction-for-governance-decisions.proposed.md
17
- # ADR-018: docs/decisions/018-inter-iteration-release-cadence-for-afk-loops.proposed.md
18
- # @jtbd JTBD-006 (Progress the Backlog While I'm Away)
19
- # @jtbd JTBD-001 (Enforce Governance Without Slowing Down)
20
-
21
- setup() {
22
- SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
23
- SKILL_FILE="${SKILL_DIR}/SKILL.md"
24
- }
25
-
26
- @test "SKILL.md exists (P053 precondition)" {
27
- [ -f "$SKILL_FILE" ]
28
- }
29
-
30
- @test "SKILL.md stop-condition #2 has a pre-terminal question-surfacing step (P053)" {
31
- # P053 fix: between detecting stop-condition #2 and emitting `ALL_DONE`,
32
- # the skill must surface outstanding design questions. Accept a dedicated
33
- # "Step 2.5" heading OR equivalent wording that names the pre-terminal
34
- # question-batching step.
35
- run grep -inE "Step 2\.5|pre-terminal question|question-batching|outstanding design question|surface (the )?(outstanding )?questions? before ALL_DONE" "$SKILL_FILE"
36
- [ "$status" -eq 0 ]
37
- }
38
-
39
- @test "SKILL.md stop-condition #2 cites the 4-question AskUserQuestion cap (P053 + ADR-013)" {
40
- # ADR-013 Rule 1 routes governance decisions through AskUserQuestion.
41
- # AskUserQuestion's documented per-call limit is 4 options. The
42
- # Step 2.5 block must name this cap so implementers do not silently
43
- # overflow.
44
- run grep -inE "cap at 4|up to 4 question|4 options? per AskUserQuestion|AskUserQuestion'?s? 4-(question|option) (limit|cap)|4-question cap|four questions? (per|at) a time" "$SKILL_FILE"
45
- [ "$status" -eq 0 ]
46
- }
47
-
48
- @test "SKILL.md classifier records a skip-reason taxonomy (P053)" {
49
- # Step 4 classifier must distinguish user-answerable skips from
50
- # architect-design and upstream-blocked skips so Step 2.5 can select
51
- # the user-answerable subset. Accept either an explicit three-bucket
52
- # taxonomy OR the individual category names appearing near the
53
- # classifier.
54
- run grep -inE "user-answerable|user answerable" "$SKILL_FILE"
55
- [ "$status" -eq 0 ]
56
- run grep -inE "architect-design|architect design (judgment|required)" "$SKILL_FILE"
57
- [ "$status" -eq 0 ]
58
- run grep -inE "upstream-blocked|upstream blocked|upstream dependency" "$SKILL_FILE"
59
- [ "$status" -eq 0 ]
60
- }
61
-
62
- @test "SKILL.md non-interactive fallback emits an Outstanding Design Questions table (P053 + ADR-013 Rule 6)" {
63
- # Rule 6: when AskUserQuestion is unavailable (AFK default per
64
- # JTBD-006), the skill must record the questions in the post-stop
65
- # summary rather than asking. Accept either literal "Outstanding
66
- # Design Questions" heading OR a named table with Ticket/Question
67
- # columns that carries the same semantics.
68
- run grep -inE "Outstanding Design Questions|outstanding.design.questions" "$SKILL_FILE"
69
- [ "$status" -eq 0 ]
70
- }
71
-
72
- @test "SKILL.md stop-condition #2 cites ADR-013 Rule 6 fallback path (P053)" {
73
- # The fallback must be traceable to the ADR it honours. Require an
74
- # explicit Rule 6 citation in the stop-condition block.
75
- run grep -inE "ADR-013.*Rule 6|Rule 6.*ADR-013" "$SKILL_FILE"
76
- [ "$status" -eq 0 ]
77
- }
78
-
79
- @test "SKILL.md Final Summary template includes the Outstanding Design Questions section when relevant (P053)" {
80
- # The Output Format block must show reviewers what the summary looks
81
- # like with outstanding questions attached — not just describe it in
82
- # prose elsewhere.
83
- run grep -n "### Outstanding Design Questions\|## Outstanding Design Questions" "$SKILL_FILE"
84
- [ "$status" -eq 0 ]
85
- }