@windyroad/itil 0.21.4-preview.235 → 0.21.5-preview.237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ This skill is the P071 phased-landing split of `/wr-itil:manage-incident <I> mit
|
|
|
17
17
|
- `<I###>` — the incident ID (e.g. `I007` or bare `007`). Resolves to `docs/incidents/<I###>-*.{investigating,mitigating}.md`.
|
|
18
18
|
- `<action>` — free-text description of the mitigation being applied (e.g. `rollback checkout service to 1.2.4`, `feature flag checkout.fast-path off`, `restart ingest worker pool`). Prefer **reversible** actions — see "Reversible preference" below.
|
|
19
19
|
|
|
20
|
-
If `$ARGUMENTS` is empty or malformed,
|
|
20
|
+
If `$ARGUMENTS` is empty or malformed, fail-fast with a usage message and exit (per ADR-044 Framework-Mediated Surface; matches the `transition-problem` / `work-problem` precedent). Argument malformation is a typo-class signal, not a decision — the slash command is the input contract; re-typing is faster than a multi-turn `AskUserQuestion` dialogue, and the user-memory direction `feedback_act_on_obvious_decisions.md` pins this. The exact usage block is in Step 1.
|
|
21
21
|
|
|
22
22
|
## Reversible preference (ADR-011)
|
|
23
23
|
|
|
@@ -32,9 +32,11 @@ Prefer **reversible** mitigations over forward fixes:
|
|
|
32
32
|
|
|
33
33
|
Record every attempt, successful or not. Failed mitigations are as important to the audit trail as successful ones — they narrow hypothesis space for future investigation.
|
|
34
34
|
|
|
35
|
-
## Evidence-first gate (ADR-011)
|
|
35
|
+
## Evidence-first gate (ADR-011; ADR-044 category-2 deviation-approval)
|
|
36
36
|
|
|
37
|
-
**Pre-flight check before the first mitigation attempt**: the incident file must contain at least one hypothesis with cited evidence in the `## Hypotheses` section. If not, block the transition and ask via `AskUserQuestion
|
|
37
|
+
**Pre-flight check before the first mitigation attempt**: the incident file must contain at least one hypothesis with cited evidence in the `## Hypotheses` section. If not, block the transition and ask via `AskUserQuestion`. This is the **ADR-044 category-2 (deviation-approval)** surface: ADR-011's evidence-first rule is the existing decision; "Record anyway" is the user-approved deviation in this specific case (the rule isn't being amended; this case is being excepted with audit trail). The user IS the right authority for the bypass shape.
|
|
38
|
+
|
|
39
|
+
The 3-option prompt:
|
|
38
40
|
|
|
39
41
|
> "Incident `<I###>` has no hypothesis with cited evidence. Per ADR-011, mitigation requires at least one ranked hypothesis backed by a log, repro, diff, or metric reference. (a) Add a hypothesis + evidence now and retry, (b) Record the mitigation anyway with an evidence-skipped justification (requires audit-trail note), (c) Cancel."
|
|
40
42
|
|
|
@@ -42,14 +44,24 @@ This gate is the **cool-headed commitment**: it blocks "try this and see" action
|
|
|
42
44
|
|
|
43
45
|
## Steps
|
|
44
46
|
|
|
45
|
-
### 1. Parse arguments
|
|
47
|
+
### 1. Parse arguments (fail-fast on typos — ADR-044 Surface 1)
|
|
46
48
|
|
|
47
49
|
Extract `<I###>` and `<action>` from `$ARGUMENTS`. Normalise `<I###>`:
|
|
48
50
|
|
|
49
51
|
- Accept `I007`, `i007`, `007`, `7` → canonicalise to `I007` (uppercase I + zero-padded 3 digits).
|
|
50
|
-
- If missing,
|
|
52
|
+
- If missing, malformed, or unrecognisable, emit the usage block below and exit. **Do not** fire `AskUserQuestion` for argument backfill — argument shape is a typo-class signal, not a decision. The framework-mediated answer per ADR-044 is fail-fast + exit; the user re-types in 1 second. Matches the `transition-problem` Step 1 + `work-problem` singular precedent for consistency across the suite (JTBD-101 — clear patterns).
|
|
53
|
+
|
|
54
|
+
Extract `<action>` as everything after the incident ID. If missing or trivially short (< 8 chars), apply the same fail-fast pattern: emit the usage block below and exit; the user re-invokes with a complete action.
|
|
55
|
+
|
|
56
|
+
**Usage block** (emitted on any malformed-argument case; copy verbatim so adopters get a consistent shape):
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
```
|
|
59
|
+
Usage: /wr-itil:mitigate-incident <I###> <action>
|
|
60
|
+
<I###> — incident ID (e.g. I007 or bare 007); must resolve to docs/incidents/<I###>-*.{investigating,mitigating}.md
|
|
61
|
+
<action> — descriptive mitigation (8+ chars), e.g. "rollback checkout service to 1.2.4", "feature flag checkout.fast-path off", "restart ingest worker pool"
|
|
62
|
+
|
|
63
|
+
Prefer reversible mitigations (see "Reversible preference" in this skill). Run /wr-itil:list-incidents to see active incidents if you don't know the ID.
|
|
64
|
+
```
|
|
53
65
|
|
|
54
66
|
### 2. Locate the incident file
|
|
55
67
|
|
|
@@ -61,7 +73,7 @@ ls docs/incidents/<I###>-*.investigating.md docs/incidents/<I###>-*.mitigating.m
|
|
|
61
73
|
- If exactly one file matches, record its current suffix (`investigating` or `mitigating`) — this drives the transition decision in Step 4.
|
|
62
74
|
- If multiple files match (should not happen under the `<ID>-<title>.<status>.md` naming convention), report the ambiguity and exit.
|
|
63
75
|
|
|
64
|
-
### 3. Pre-flight: evidence gate (first mitigation only)
|
|
76
|
+
### 3. Pre-flight: evidence gate (first mitigation only) — ADR-044 category-2 deviation-approval
|
|
65
77
|
|
|
66
78
|
If the file suffix is `.investigating.md` (i.e. this is the first mitigation), read the `## Hypotheses` section and check for at least one line containing `Evidence:` followed by a non-empty reference. The shape per ADR-011:
|
|
67
79
|
|
|
@@ -70,9 +82,9 @@ If the file suffix is `.investigating.md` (i.e. this is the first mitigation), r
|
|
|
70
82
|
```
|
|
71
83
|
|
|
72
84
|
- If at least one hypothesis has a cited evidence reference, proceed to Step 4.
|
|
73
|
-
- If no hypothesis carries evidence, invoke `AskUserQuestion` with the three-option prompt from "Evidence-first gate" above. Branch:
|
|
85
|
+
- If no hypothesis carries evidence, invoke `AskUserQuestion` with the three-option prompt from "Evidence-first gate" above. This is the ADR-044 **category-2 (deviation-approval)** surface — the user is the right authority for the bypass; the gate's behaviour is preserved verbatim post-ADR-044 because deviation-approval is a kept-AskUserQuestion category in the 6-class taxonomy. Branch:
|
|
74
86
|
- (a) User adds a hypothesis + evidence now — re-read the file and re-check; if satisfied, proceed. If still missing, report the gate failure and exit.
|
|
75
|
-
- (b) User records anyway — append an `## Audit trail` note to the file: `[<timestamp> UTC] Evidence-gate bypassed by user — reason: <justification>`. Then proceed to Step 4.
|
|
87
|
+
- (b) User records anyway (deviation approved) — append an `## Audit trail` note to the file: `[<timestamp> UTC] Evidence-gate bypassed by user — reason: <justification>`. Then proceed to Step 4.
|
|
76
88
|
- (c) User cancels — exit without change.
|
|
77
89
|
|
|
78
90
|
If the file suffix is already `.mitigating.md`, skip the gate (it only runs on the transition).
|
|
@@ -147,14 +159,14 @@ Report:
|
|
|
147
159
|
- Any quality-check warnings.
|
|
148
160
|
- A pointer: "Run `/wr-itil:manage-incident <I###> restored` when the verification signal confirms service is restored, or re-invoke `/wr-itil:mitigate-incident <I###> <next-action>` to record another mitigation attempt."
|
|
149
161
|
|
|
150
|
-
### 8. Commit the completed work (ADR-014)
|
|
162
|
+
### 8. Commit the completed work (ADR-014; risk-above-appetite is ADR-044 category-3 one-time-override)
|
|
151
163
|
|
|
152
164
|
Per ADR-014, governance skills commit their own work.
|
|
153
165
|
|
|
154
166
|
1. `git add` the renamed / modified incident file.
|
|
155
167
|
2. Delegate to `wr-risk-scorer:pipeline` (subagent_type: `wr-risk-scorer:pipeline`) to assess the staged changes and create a bypass marker. If the subagent type is not available (spawned subagent surface), invoke `/wr-risk-scorer:assess-release` via the Skill tool instead — per ADR-015 it wraps the same pipeline subagent.
|
|
156
168
|
3. `git commit -m "docs(incidents): I<NNN> mitigated — <action summary>"`.
|
|
157
|
-
4. If risk is above appetite: use `AskUserQuestion` to ask whether to commit anyway, remediate first, or park the work. If `AskUserQuestion` is unavailable, skip the commit and report the uncommitted state clearly.
|
|
169
|
+
4. If risk is above appetite: use `AskUserQuestion` to ask whether to commit anyway, remediate first, or park the work. This is the ADR-044 **category-3 (one-time-override)** surface — the rule (RISK-POLICY appetite) still stands but this specific case in incident-mitigation context often warrants an exception (the tech lead may need to ship a mitigation despite higher residual risk to restore service fast — JTBD-201). The 3-option vocabulary is the genuine category-3 surface. If `AskUserQuestion` is unavailable (rare in incident context — incident skills are interactive by definition), skip the commit and report the uncommitted state clearly per ADR-013 Rule 6.
|
|
158
170
|
|
|
159
171
|
### 9. Auto-release when changesets are queued (ADR-020)
|
|
160
172
|
|
|
@@ -194,10 +206,12 @@ If the user wants any of the above, the skill reports the appropriate sibling an
|
|
|
194
206
|
## Related
|
|
195
207
|
|
|
196
208
|
- **P071** (`docs/problems/071-argument-based-skill-subcommands-are-not-discoverable.open.md`) — originating ticket. This skill is slice 6a of the P071 phased-landing plan.
|
|
209
|
+
- **P136** (`docs/problems/136-adr-044-alignment-audit-master.open.md`) — ADR-044 alignment audit master. This skill is the second high-ask SKILL audited under Phase 2 (after work-problem singular).
|
|
197
210
|
- **ADR-010 amended** (`docs/decisions/010-rename-wr-problem-to-wr-itil.proposed.md` — Skill Granularity section) — canonical skill-split naming + forwarder contract + `deprecated-arguments: true` frontmatter flag.
|
|
198
211
|
- **ADR-011** (`docs/decisions/011-manage-incident-skill-wrapping.proposed.md`) — incident lifecycle file-suffix conventions (`.investigating.md` / `.mitigating.md` / `.restored.md` / `.closed.md`) + evidence-first rule + reversible-mitigation preference + Sev 4-5 lightweight path.
|
|
199
|
-
- **ADR-013
|
|
200
|
-
- **ADR-013** Rule 6 — policy-within-appetite non-interactive actions (release drain).
|
|
212
|
+
- **ADR-013 amended Rule 1** — structured user interaction; narrowed in P135 to defer to ADR-044 for framework-resolution boundary. Surface 1 (argument-backfill) no longer fires `AskUserQuestion` (framework-mediated); Surfaces 2 + 3 retain it under ADR-044 categories 2 + 3.
|
|
213
|
+
- **ADR-013** Rule 6 — policy-within-appetite non-interactive actions (release drain). Step 9 unchanged.
|
|
214
|
+
- **ADR-044** (`docs/decisions/044-decision-delegation-contract.proposed.md`) — Decision-Delegation Contract. Surface 1 (argument-backfill) is framework-mediated per the ADR; Surface 2 (evidence-first gate) is category-2 (deviation-approval); Surface 3 (risk-above-appetite commit) is category-3 (one-time-override).
|
|
201
215
|
- **ADR-014** — governance skills commit their own work.
|
|
202
216
|
- **ADR-015** — release scorer delegation pattern.
|
|
203
217
|
- **ADR-020** — auto-release when changesets are queued.
|
|
@@ -10,16 +10,27 @@
|
|
|
10
10
|
# Structural assertion — Permitted Exception to the source-grep ban
|
|
11
11
|
# (ADR-005 / P011 / ADR-037 contract-assertion pattern).
|
|
12
12
|
#
|
|
13
|
-
#
|
|
13
|
+
# tdd-review: structural-permitted (justification: SKILL.md prose contract
|
|
14
|
+
# assertions; behavioural skill-runtime harness pending P012 + P081 Phase 2;
|
|
15
|
+
# expected to migrate to behavioural form once the harness exists. Touched
|
|
16
|
+
# during P136 Phase 2 ADR-044 alignment audit per the inline plan's
|
|
17
|
+
# bridge-marker rule.)
|
|
18
|
+
#
|
|
19
|
+
# @problem P071 (originating split)
|
|
20
|
+
# @problem P136 (ADR-044 alignment audit master — Phase 2 mitigate-incident)
|
|
21
|
+
# @adr ADR-044 (Decision-Delegation Contract — argument-backfill is framework-mediated; evidence-gate is cat-2 deviation-approval; risk-above-appetite commit is cat-3 one-time-override)
|
|
14
22
|
# @jtbd JTBD-001 (enforce governance without slowing down — discoverable surface)
|
|
15
|
-
# @jtbd JTBD-101 (extend the suite with clear patterns — one skill per distinct user intent)
|
|
16
|
-
# @jtbd JTBD-201 (restore service fast with an audit trail — mitigation + evidence gate)
|
|
23
|
+
# @jtbd JTBD-101 (extend the suite with clear patterns — one skill per distinct user intent; consistent argument-backfill with transition-problem / work-problem)
|
|
24
|
+
# @jtbd JTBD-201 (restore service fast with an audit trail — mitigation + evidence gate; fail-fast on typos preserves "restore fast")
|
|
17
25
|
#
|
|
18
26
|
# Cross-reference:
|
|
19
27
|
# P071: docs/problems/071-argument-based-skill-subcommands-are-not-discoverable.open.md
|
|
28
|
+
# P136: docs/problems/136-adr-044-alignment-audit-master.open.md
|
|
20
29
|
# ADR-010 amended (Skill Granularity section) — split naming + forwarder contract
|
|
21
30
|
# ADR-011 — manage-incident skill-wrapping precedent (evidence-gate, reversible preference)
|
|
31
|
+
# ADR-013 amended Rule 1 — structured user interaction; framework-resolution narrowing per ADR-044
|
|
22
32
|
# ADR-037 — contract-assertion bats pattern
|
|
33
|
+
# ADR-044 — Decision-Delegation Contract; argument-backfill is mechanical (Surface 1); evidence-gate is cat-2 (Surface 2); risk-above-appetite is cat-3 (Surface 3)
|
|
23
34
|
|
|
24
35
|
setup() {
|
|
25
36
|
SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
@@ -150,3 +161,98 @@ setup() {
|
|
|
150
161
|
run grep -inE "lightweight|low.?severity|Sev 4|Sev 5" "$SKILL_FILE"
|
|
151
162
|
[ "$status" -eq 0 ]
|
|
152
163
|
}
|
|
164
|
+
|
|
165
|
+
# ----------------------------------------------------------------------
|
|
166
|
+
# P136 Phase 2 — ADR-044 alignment audit (added 2026-04-27)
|
|
167
|
+
#
|
|
168
|
+
# These assertions land the framework-mediated argument-backfill contract
|
|
169
|
+
# (Surface 1 — fail-fast on typo-class input; matches transition-problem
|
|
170
|
+
# / work-problem precedent), and the ADR-044 cross-references on the
|
|
171
|
+
# retained user-authority surfaces (Surface 2 — evidence-first gate as
|
|
172
|
+
# category-2 deviation-approval; Surface 3 — risk-above-appetite commit
|
|
173
|
+
# as category-3 one-time-override).
|
|
174
|
+
# ----------------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
@test "SKILL.md Step 1 uses fail-fast usage message for malformed args (ADR-044 Surface 1)" {
|
|
177
|
+
# Argument-backfill is typo-class signal, not a decision. Per ADR-044
|
|
178
|
+
# Framework-Mediated boundary + the suite's existing transition-problem
|
|
179
|
+
# / work-problem singular precedent, malformed input fails the contract
|
|
180
|
+
# with a usage block and exits. Re-typing the slash command is faster
|
|
181
|
+
# than the multi-turn AskUserQuestion dialogue that was here before.
|
|
182
|
+
run awk '/^### 1\./,/^### 2\./' "$SKILL_FILE"
|
|
183
|
+
[ "$status" -eq 0 ]
|
|
184
|
+
[[ "$output" == *"Usage:"* ]] || [[ "$output" == *"usage message"* ]] || [[ "$output" == *"fail-fast"* ]]
|
|
185
|
+
[[ "$output" == *"exit"* ]] || [[ "$output" == *"stop"* ]]
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@test "SKILL.md Step 1 does NOT fire AskUserQuestion for argument backfill (regression guard)" {
|
|
189
|
+
# The lazy-deferral surface ADR-044 closed for this skill: per-call
|
|
190
|
+
# AskUserQuestion when args are missing/malformed. If it returns to
|
|
191
|
+
# Step 1, the lazy-count metric (Step 2d) will spike and the skill
|
|
192
|
+
# diverges from transition-problem / work-problem precedent.
|
|
193
|
+
run awk '/^### 1\./,/^### 2\./' "$SKILL_FILE"
|
|
194
|
+
[ "$status" -eq 0 ]
|
|
195
|
+
! echo "$output" | grep -qE "ask via .?AskUserQuestion|invoke .?AskUserQuestion"
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@test "SKILL.md Arguments section uses fail-fast (no AskUserQuestion backfill at top of file)" {
|
|
199
|
+
# The original line 20 said "If \$ARGUMENTS is empty or malformed, ask
|
|
200
|
+
# via AskUserQuestion for the incident ID and the action." Replaced
|
|
201
|
+
# with fail-fast pointer to Step 1's usage block. This regression
|
|
202
|
+
# guard catches re-introduction at the Arguments section.
|
|
203
|
+
run awk '/^## Arguments/,/^## Reversible preference/' "$SKILL_FILE"
|
|
204
|
+
[ "$status" -eq 0 ]
|
|
205
|
+
! echo "$output" | grep -qE "ask via .?AskUserQuestion"
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@test "SKILL.md Step 3 evidence gate cross-references ADR-044 category-2 (deviation-approval)" {
|
|
209
|
+
# Surface 2 keep: ADR-011's evidence-first rule IS the existing
|
|
210
|
+
# decision; "Record anyway" IS the user-approved deviation; user IS
|
|
211
|
+
# the right authority. The inline ADR-044 cat-2 cross-reference makes
|
|
212
|
+
# the framework-resolution boundary visible at the call site without
|
|
213
|
+
# changing behaviour.
|
|
214
|
+
run awk '/^### 3\./,/^### 4\./' "$SKILL_FILE"
|
|
215
|
+
[ "$status" -eq 0 ]
|
|
216
|
+
[[ "$output" == *"ADR-044"* ]]
|
|
217
|
+
[[ "$output" == *"deviation-approval"* ]] || [[ "$output" == *"category 2"* ]] || [[ "$output" == *"category-2"* ]]
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@test "SKILL.md Step 8 risk-above-appetite cross-references ADR-044 category-3 (one-time-override)" {
|
|
221
|
+
# Surface 3 keep: in incident-mitigation context the user often wants
|
|
222
|
+
# to ship despite higher risk; the rule (RISK-POLICY appetite) still
|
|
223
|
+
# stands but this specific case warrants an exception. Category-3 is
|
|
224
|
+
# the genuine surface; the cross-ref makes it visible.
|
|
225
|
+
run awk '/^### 8\./,/^### 9\./' "$SKILL_FILE"
|
|
226
|
+
[ "$status" -eq 0 ]
|
|
227
|
+
[[ "$output" == *"ADR-044"* ]]
|
|
228
|
+
[[ "$output" == *"one-time-override"* ]] || [[ "$output" == *"category 3"* ]] || [[ "$output" == *"category-3"* ]]
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@test "SKILL.md retains AskUserQuestion for Surface 2 evidence-gate + Surface 3 risk-above-appetite (positive guard)" {
|
|
232
|
+
# AskUserQuestion is removed from Surface 1 (Step 1 + Arguments) but
|
|
233
|
+
# MUST remain in Step 3 (evidence gate, ADR-044 cat-2) and Step 8
|
|
234
|
+
# (risk-above-appetite, ADR-044 cat-3). The frontmatter allowed-tools
|
|
235
|
+
# MUST keep AskUserQuestion. Negative-of-negative guard against
|
|
236
|
+
# accidentally over-removing.
|
|
237
|
+
run grep -nE "^allowed-tools:.*AskUserQuestion" "$SKILL_FILE"
|
|
238
|
+
[ "$status" -eq 0 ]
|
|
239
|
+
# Step 3 must still contain AskUserQuestion reference (the evidence
|
|
240
|
+
# gate is the cat-2 surface).
|
|
241
|
+
run awk '/^### 3\./,/^### 4\./' "$SKILL_FILE"
|
|
242
|
+
[ "$status" -eq 0 ]
|
|
243
|
+
echo "$output" | grep -qE "AskUserQuestion"
|
|
244
|
+
# Step 8 must still contain AskUserQuestion reference (risk-above-
|
|
245
|
+
# appetite is the cat-3 surface).
|
|
246
|
+
run awk '/^### 8\./,/^### 9\./' "$SKILL_FILE"
|
|
247
|
+
[ "$status" -eq 0 ]
|
|
248
|
+
echo "$output" | grep -qE "AskUserQuestion"
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@test "bats file carries the tdd-review: structural-permitted marker (P081 + P136 bridge)" {
|
|
252
|
+
# Per P136 Phase 2 inline plan: bats touched during the audit get
|
|
253
|
+
# the structural-permitted marker as the bridge until P081 Phase 2's
|
|
254
|
+
# canonical retrofit. Without the marker, future TDD agent reviews
|
|
255
|
+
# will flag the file as a P081 violation.
|
|
256
|
+
run grep -nE "tdd-review:[[:space:]]+structural-permitted" "${BATS_TEST_FILENAME}"
|
|
257
|
+
[ "$status" -eq 0 ]
|
|
258
|
+
}
|