@windyroad/itil 0.7.1-preview.122 → 0.7.2-preview.127
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
|
@@ -153,7 +153,13 @@ local_max=$(ls docs/problems/*.md 2>/dev/null | sed 's/.*\///' | grep -oE '^[0-9
|
|
|
153
153
|
# without requiring a fetch in this step (Step 0 preflight is the place
|
|
154
154
|
# where the fetch happens). Default base is `main`; if the user is on
|
|
155
155
|
# another branch, swap accordingly.
|
|
156
|
-
|
|
156
|
+
#
|
|
157
|
+
# `--name-only` is required (P056): without it, each ls-tree line is
|
|
158
|
+
# `<mode> <type> <sha>\t<path>` and the 40-char blob SHA can contain
|
|
159
|
+
# three-digit runs that `grep -oE '[0-9]{3}'` false-matches (observed
|
|
160
|
+
# `origin_max=997` on 2026-04-20 opening P055). `sed` strips the path
|
|
161
|
+
# prefix so the anchored `grep -oE '^[0-9]+'` only picks up filename IDs.
|
|
162
|
+
origin_max=$(git ls-tree --name-only origin/main docs/problems/ 2>/dev/null | sed 's|^docs/problems/||' | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
157
163
|
|
|
158
164
|
# Take the max of the two and increment.
|
|
159
165
|
next=$(printf '%03d' $(( $(echo -e "${local_max:-0}\n${origin_max:-0}" | sort -n | tail -1) + 1 )))
|
|
@@ -271,8 +277,12 @@ Pre-flight checks before allowing transition:
|
|
|
271
277
|
|
|
272
278
|
If any check fails, report which checks failed and ask the user to address them before transitioning.
|
|
273
279
|
|
|
280
|
+
> **Staging trap (P057).** `git mv` stages only the rename — it does NOT pick up subsequent `Edit`-tool content changes. After the `Edit` tool modifies the renamed file (Status field, `## Fix Released` section, etc.), re-stage it explicitly: `git add <new>`. Without the explicit re-stage, the transition commit captures the rename-only change and the content edit leaks into the next commit, corrupting the audit trail. This rule applies to every `git mv` block below (Open → Known Error, Known Error → Verification Pending, Verification Pending → Closed) and to the supersession rename in `create-adr` Step 6.
|
|
281
|
+
|
|
274
282
|
```bash
|
|
275
283
|
git mv docs/problems/<NNN>-<title>.open.md docs/problems/<NNN>-<title>.known-error.md
|
|
284
|
+
# ... use the Edit tool to update the Status field ...
|
|
285
|
+
git add docs/problems/<NNN>-<title>.known-error.md
|
|
276
286
|
```
|
|
277
287
|
|
|
278
288
|
Update the "Status" field in the file to "Known Error".
|
|
@@ -283,12 +293,16 @@ When the fix for a Known Error ships, transition the ticket in a single commit:
|
|
|
283
293
|
|
|
284
294
|
```bash
|
|
285
295
|
git mv docs/problems/<NNN>-<title>.known-error.md docs/problems/<NNN>-<title>.verifying.md
|
|
296
|
+
# ... use the Edit tool to update Status and add the `## Fix Released` section ...
|
|
297
|
+
git add docs/problems/<NNN>-<title>.verifying.md
|
|
286
298
|
```
|
|
287
299
|
|
|
288
300
|
Then edit the file:
|
|
289
301
|
- Update the "Status" field to "Verification Pending"
|
|
290
302
|
- Add a `## Fix Released` section with: release marker (version, commit SHA, or date), one-sentence fix summary, "Awaiting user verification" line, and any exercise evidence from the releasing session.
|
|
291
303
|
|
|
304
|
+
Re-stage the `.verifying.md` file explicitly after the `Edit` tool runs (P057). The second `git add` above is NOT redundant — `git mv` alone stages only the rename, not the subsequent content edit.
|
|
305
|
+
|
|
292
306
|
Both the `git mv` and the file edits belong in the same commit as the fix implementation per ADR-014 (governance skills commit their own work). The `.verifying.md` suffix signals to every downstream consumer (work-problems classifier, review step 9d, README rendering) that the remaining work is user-side verification — no file-body scan needed.
|
|
293
307
|
|
|
294
308
|
**Verification Pending → Closed** (user confirms):
|
|
@@ -297,9 +311,11 @@ Only the user can make this call. When they explicitly confirm the fix works in
|
|
|
297
311
|
|
|
298
312
|
```bash
|
|
299
313
|
git mv docs/problems/<NNN>-<title>.verifying.md docs/problems/<NNN>-<title>.closed.md
|
|
314
|
+
# ... use the Edit tool to update the Status field to "Closed" ...
|
|
315
|
+
git add docs/problems/<NNN>-<title>.closed.md
|
|
300
316
|
```
|
|
301
317
|
|
|
302
|
-
Update the "Status" field to "Closed". Reference the problem ID in the closure commit message (e.g., "Closes P008"). Step 9d's verification prompt is the structured path that fires this transition during `manage-problem review`.
|
|
318
|
+
Update the "Status" field to "Closed". Reference the problem ID in the closure commit message (e.g., "Closes P008"). Step 9d's verification prompt is the structured path that fires this transition during `manage-problem review`. Re-stage the `.closed.md` file explicitly after the Edit (P057 staging trap).
|
|
303
319
|
|
|
304
320
|
### 8. For list: Show summary
|
|
305
321
|
|
|
@@ -462,7 +478,7 @@ After any operation, report:
|
|
|
462
478
|
- Any quality check warnings
|
|
463
479
|
|
|
464
480
|
Commit the completed work per ADR-014 (governance skills commit their own work):
|
|
465
|
-
1. `git add` all created/modified files for this operation
|
|
481
|
+
1. `git add` all created/modified files for this operation — **including any file renamed via `git mv` that was then modified by the `Edit` tool** (P057 staging trap — `git mv` alone stages only the rename, not the subsequent content edit). `git add -u` is a safe catch-all for tracked modifications.
|
|
466
482
|
2. Satisfy the commit gate — two paths are valid (either produces a bypass marker):
|
|
467
483
|
- **Primary**: delegate to the `wr-risk-scorer:pipeline` subagent-type via the Agent tool (subagent_type: `wr-risk-scorer:pipeline`)
|
|
468
484
|
- **Fallback**: if the `wr-risk-scorer:pipeline` subagent-type is not available in the current tool set (e.g., this skill is itself running inside a spawned subagent), invoke the `/wr-risk-scorer:assess-release` skill via the Skill tool. Per ADR-015 it wraps the same pipeline subagent and the `PostToolUse:Agent` hook writes an equivalent bypass marker. Do not silently skip the gate because the primary path is unavailable — the fallback exists specifically to close this gap (see P035).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
# Doc-lint guard: manage-problem SKILL.md must document the re-stage-after-Edit
|
|
3
|
+
# requirement for every `git mv` block that is followed by a content edit.
|
|
4
|
+
#
|
|
5
|
+
# Structural assertion — Permitted Exception to the source-grep ban (ADR-005 / P011).
|
|
6
|
+
# The tests assert that the skill specification document warns authors that
|
|
7
|
+
# `git mv` alone stages only the rename, and subsequent Edit-tool modifications
|
|
8
|
+
# must be re-staged explicitly (`git add <new>`) before commit — otherwise the
|
|
9
|
+
# commit captures a rename-only change and the content edit leaks into the
|
|
10
|
+
# next commit, corrupting the audit trail (P054 / P046 incident, 2026-04-19).
|
|
11
|
+
#
|
|
12
|
+
# Cross-reference:
|
|
13
|
+
# P057: docs/problems/057-git-mv-plus-edit-staging-ordering-trap.*.md
|
|
14
|
+
# ADR-014: docs/decisions/014-governance-skills-commit-their-own-work.proposed.md
|
|
15
|
+
# ADR-022: docs/decisions/022-problem-lifecycle-verification-pending-status.proposed.md
|
|
16
|
+
# @jtbd JTBD-002 (ship with confidence — audit trail)
|
|
17
|
+
# @jtbd JTBD-006 (progress the backlog while I'm away — audit trail)
|
|
18
|
+
|
|
19
|
+
setup() {
|
|
20
|
+
TEST_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")" && pwd)"
|
|
21
|
+
REPO_ROOT="$(cd "${TEST_DIR}/../../../../.." && pwd)"
|
|
22
|
+
SKILL_FILE="${REPO_ROOT}/packages/itil/skills/manage-problem/SKILL.md"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@test "manage-problem SKILL.md exists (P057 precondition)" {
|
|
26
|
+
[ -f "$SKILL_FILE" ]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@test "manage-problem SKILL.md warns that git mv stages only the rename (P057)" {
|
|
30
|
+
# The document must explicitly state that `git mv` stages the rename into
|
|
31
|
+
# the index but does NOT pick up subsequent Edit-tool content changes.
|
|
32
|
+
run grep -inE "git mv.*(only the rename|rename only|not .*content|stages only)" "$SKILL_FILE"
|
|
33
|
+
[ "$status" -eq 0 ]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@test "manage-problem SKILL.md instructs re-staging the renamed file after Edit (P057)" {
|
|
37
|
+
# Authors must be told to run `git add <new>` (or equivalent) after editing
|
|
38
|
+
# the renamed file, before commit.
|
|
39
|
+
run grep -inE "re-stage|re‑stage|\`git add\`.*after|after.*\`git add\`|git add <new>|git add .*\.verifying\.md|git add .*\.known-error\.md" "$SKILL_FILE"
|
|
40
|
+
[ "$status" -eq 0 ]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@test "manage-problem SKILL.md cites P057 on the re-stage requirement (P057)" {
|
|
44
|
+
# Traceability: the new guidance must cite P057 so reviewers can chase
|
|
45
|
+
# the fix back to the incident that motivated it.
|
|
46
|
+
run grep -n "P057" "$SKILL_FILE"
|
|
47
|
+
[ "$status" -eq 0 ]
|
|
48
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
# Doc-lint guard: manage-problem SKILL.md Step 3 origin-max lookup must use
|
|
3
|
+
# `git ls-tree --name-only` to avoid false-matching blob SHA digits (P056).
|
|
4
|
+
#
|
|
5
|
+
# Structural assertion — Permitted Exception to the source-grep ban
|
|
6
|
+
# (ADR-005 / P011). Default `git ls-tree` output shape is
|
|
7
|
+
# `<mode> <type> <sha>\t<path>`. A `grep -oE '[0-9]{3}'` over that line
|
|
8
|
+
# can match digits inside the 40-char blob SHA and return a wrong
|
|
9
|
+
# `origin_max` (observed 997 on 2026-04-20 when opening P055). `--name-only`
|
|
10
|
+
# drops mode/type/SHA columns leaving only the path, restoring the
|
|
11
|
+
# invariant ADR-019 and P043 presume.
|
|
12
|
+
#
|
|
13
|
+
# Cross-reference:
|
|
14
|
+
# P056: docs/problems/056-ticket-creator-next-id-lookup-blob-sha-false-match.*.md
|
|
15
|
+
# P043 (closed): next-ID collision guard in ticket-creator skills
|
|
16
|
+
# ADR-019: docs/decisions/019-afk-orchestrator-preflight.*.md
|
|
17
|
+
# @jtbd JTBD-002 (ship with confidence — audit trail)
|
|
18
|
+
# @jtbd JTBD-006 (progress the backlog while I'm away — collision-free IDs)
|
|
19
|
+
|
|
20
|
+
setup() {
|
|
21
|
+
TEST_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")" && pwd)"
|
|
22
|
+
REPO_ROOT="$(cd "${TEST_DIR}/../../../../.." && pwd)"
|
|
23
|
+
SKILL_FILE="${REPO_ROOT}/packages/itil/skills/manage-problem/SKILL.md"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@test "manage-problem SKILL.md exists (P056 precondition)" {
|
|
27
|
+
[ -f "$SKILL_FILE" ]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@test "manage-problem SKILL.md origin-max lookup uses git ls-tree --name-only (P056)" {
|
|
31
|
+
# The fix: `git ls-tree --name-only` drops mode/type/SHA columns so the
|
|
32
|
+
# digit-extraction regex cannot match SHA hex runs.
|
|
33
|
+
run grep -nE "git ls-tree --name-only .* docs/problems" "$SKILL_FILE"
|
|
34
|
+
[ "$status" -eq 0 ]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@test "manage-problem SKILL.md does not keep the buggy bare git ls-tree pattern (P056)" {
|
|
38
|
+
# Regression guard: `git ls-tree <ref> docs/problems/` without `--name-only`
|
|
39
|
+
# piped directly into a digit regex is the bug. Any remaining pipeline of
|
|
40
|
+
# this shape in a bash code block is a regression.
|
|
41
|
+
run grep -nE "git ls-tree [^-].* docs/problems/ .*\| *grep -oE '\[0-9\]\{3\}'" "$SKILL_FILE"
|
|
42
|
+
[ "$status" -ne 0 ]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@test "manage-problem SKILL.md cites P056 on the origin-max fix (P056)" {
|
|
46
|
+
# Traceability: the fix must cite P056 so reviewers can chase the
|
|
47
|
+
# correction back to the incident that motivated it.
|
|
48
|
+
run grep -n "P056" "$SKILL_FILE"
|
|
49
|
+
[ "$status" -eq 0 ]
|
|
50
|
+
}
|