@windyroad/retrospective 0.27.1 → 0.27.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 (33) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +5 -2
  3. package/hooks/test/retrospective-deferral-census.bats +0 -112
  4. package/hooks/test/retrospective-readme-jtbd-currency.bats +0 -312
  5. package/scripts/test/check-ask-hygiene.bats +0 -262
  6. package/scripts/test/check-autocreate-rfc-scope.bats +0 -250
  7. package/scripts/test/check-briefing-budgets.bats +0 -349
  8. package/scripts/test/check-internal-id-leaks.bats +0 -286
  9. package/scripts/test/check-plugin-maturity-drift.bats +0 -269
  10. package/scripts/test/check-readme-jtbd-currency.bats +0 -165
  11. package/scripts/test/check-skill-md-budgets.bats +0 -336
  12. package/scripts/test/check-tarball-shipped-shims.bats +0 -284
  13. package/scripts/test/check-tickets-deferred-cause.bats +0 -330
  14. package/scripts/test/list-plugin-attribution.bats +0 -149
  15. package/scripts/test/measure-context-budget.bats +0 -298
  16. package/skills/analyze-context/test/analyze-context-skill-contract.bats +0 -142
  17. package/skills/migrate-briefing/test/migrate-briefing-contract.bats +0 -105
  18. package/skills/migrate-briefing/test/migrate-briefing-fixture.bats +0 -242
  19. package/skills/run-retro/test/run-retro-anti-pattern-clause.bats +0 -87
  20. package/skills/run-retro/test/run-retro-codification-candidates.bats +0 -168
  21. package/skills/run-retro/test/run-retro-context-usage-step-2c.bats +0 -156
  22. package/skills/run-retro/test/run-retro-pipeline-instability-scan.bats +0 -122
  23. package/skills/run-retro/test/run-retro-signal-vs-noise.bats +0 -137
  24. package/skills/run-retro/test/run-retro-skill-candidates.bats +0 -116
  25. package/skills/run-retro/test/run-retro-stage-1-fallback-gating.bats +0 -65
  26. package/skills/run-retro/test/run-retro-step-2d-r6-auto-flag.bats +0 -82
  27. package/skills/run-retro/test/run-retro-step-3-tier-3-branch-b-evidence-based.bats +0 -189
  28. package/skills/run-retro/test/run-retro-step-4a-cross-plugin-dispatch.bats +0 -114
  29. package/skills/run-retro/test/run-retro-step-4a-prior-session-evidence-drain.bats +0 -168
  30. package/skills/run-retro/test/run-retro-step-4a-recovery-path.bats +0 -84
  31. package/skills/run-retro/test/run-retro-step-4b-retro-auto-ticket-carveout.bats +0 -115
  32. package/skills/run-retro/test/run-retro-ticket-first-flow.bats +0 -161
  33. package/skills/run-retro/test/run-retro-verification-close-housekeeping.bats +0 -132
@@ -1,189 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # P247: run-retro SKILL.md Step 3 Tier 3 Branch B MUST encode the
4
- # evidence-based rotation contract — "leave-as-is" is eliminated; the
5
- # fall-through when none of the three concrete triggers (subtopic /
6
- # date / ≥3 noise entries) fire is **split-by-date as the safe default**,
7
- # mirroring Branch A's existing precedent.
8
- #
9
- # This file mirrors the architecture established for P148's Stage 1
10
- # fallback-gating clause: behavioural assertions exercise the
11
- # enforcement layer (check-briefing-budgets.sh) for the OVER /
12
- # MUST_SPLIT signal shape that drives Branch B input, plus narrow
13
- # structural backstops linking SKILL.md prose (canonical human source)
14
- # to the enforcement layer + driver-ticket evidence trail.
15
- #
16
- # Architect verdict (2026-05-18, P247): the rotation decision itself
17
- # is silent agent judgement per ADR-044 framework-mediated surface
18
- # "Briefing add / remove / rotate" — there is no script to behaviourally
19
- # exercise the rotation. The script-side behavioural coverage for the
20
- # Branch B INPUT signal (OVER without MUST_SPLIT) lives in
21
- # `packages/retrospective/scripts/test/check-briefing-budgets.bats`;
22
- # this file is the SKILL-prose backstop that confirms the prose names
23
- # the evidence-based contract terms and the driver ticket.
24
- #
25
- # # @adr ADR-037 permitted exception — narrowest justifiable scope.
26
- # # @adr ADR-044 framework-mediated surface boundary (silent agent rotation).
27
- # # @adr ADR-061 evidence-based-not-time-based principle (parent class).
28
- # # @adr ADR-013 Rule 5 (policy-authorised silent proceed).
29
- # # @adr ADR-052 behavioural-tests-default (structural backstops permitted
30
- # # for SKILL-prose-to-enforcement-layer linkage per P081).
31
- # # @ticket P247 — Branch B fictional-defer (driver).
32
- # # @ticket P246 — sibling-class at cohort-graduation surface (mirror precedent).
33
- # # @ticket P145 — predecessor at this surface (MUST_SPLIT subset already
34
- # # evidence-based; P247 generalises to OVER subset).
35
- # # @ticket P081 — behavioural-tests-preferred direction.
36
-
37
- setup() {
38
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
39
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
40
- SCRIPT="$REPO_ROOT/packages/retrospective/scripts/check-briefing-budgets.sh"
41
- FIXTURE_DIR="$(mktemp -d)"
42
- }
43
-
44
- teardown() {
45
- rm -rf "$FIXTURE_DIR"
46
- }
47
-
48
- # Helper: write a markdown file with N bytes of body content.
49
- write_briefing_entry() {
50
- local path="$1"
51
- local target_bytes="$2"
52
- : > "$path"
53
- printf '# Topic\n\n' >> "$path"
54
- local header_size
55
- header_size=$(wc -c < "$path" | tr -d ' ')
56
- local body_target=$(( target_bytes - header_size ))
57
- if [ "$body_target" -gt 0 ]; then
58
- local line="- entry text padded out to a known length for byte-budget testing. "
59
- local line_size=${#line}
60
- line+=$'\n'
61
- local line_count=$(( (body_target + line_size) / (line_size + 1) ))
62
- local i=0
63
- while [ "$i" -lt "$line_count" ]; do
64
- printf '%s' "$line" >> "$path"
65
- i=$(( i + 1 ))
66
- done
67
- fi
68
- }
69
-
70
- # ── Behavioural: Branch B INPUT signal shape ────────────────────────────────
71
- #
72
- # Branch B is defined as "file has only OVER line (ratio between 1.0× and
73
- # 2.0× ceiling)". The check-briefing-budgets.sh script is the enforcement
74
- # layer that produces this signal. These assertions confirm the signal
75
- # shape the SKILL contract reads — they exercise the script (not the
76
- # agent's rotation choice), giving Branch B its input definition.
77
-
78
- @test "Branch B input: file at 1.5x ratio emits OVER without MUST_SPLIT (Branch B selector)" {
79
- # 1.5x of default 5120 ceiling = 7680 bytes — the canonical Branch B input.
80
- mkdir -p "$FIXTURE_DIR/briefing"
81
- write_briefing_entry "$FIXTURE_DIR/briefing/branch-b-canonical.md" 7680
82
- run "$SCRIPT" "$FIXTURE_DIR/briefing"
83
- [ "$status" -eq 0 ]
84
- echo "$output" | grep -E "^OVER branch-b-canonical.md bytes=[0-9]+ threshold=5120"
85
- ! echo "$output" | grep -q "^MUST_SPLIT branch-b-canonical.md"
86
- }
87
-
88
- @test "Branch B input: file at 1.0x exactly emits OVER without MUST_SPLIT (Branch B lower edge)" {
89
- mkdir -p "$FIXTURE_DIR/briefing"
90
- printf '%.0s.' $(seq 1 5120) > "$FIXTURE_DIR/briefing/branch-b-lower-edge.md"
91
- run "$SCRIPT" "$FIXTURE_DIR/briefing"
92
- [ "$status" -eq 0 ]
93
- echo "$output" | grep -E "^OVER branch-b-lower-edge.md bytes=5120 threshold=5120"
94
- ! echo "$output" | grep -q "^MUST_SPLIT branch-b-lower-edge.md"
95
- }
96
-
97
- @test "Branch B input: file just under 2.0x (e.g. 1.96x) emits OVER without MUST_SPLIT (P247 evidence — hooks-and-gates-archive.md at 1.96x was deferred)" {
98
- # 1.96x of 5120 = 10035 bytes — the upper edge of Branch B, exactly the
99
- # case the 2026-05-17 session-4 wrap retro hit and deferred via the
100
- # now-eliminated "leave-as-is" branch.
101
- mkdir -p "$FIXTURE_DIR/briefing"
102
- printf '%.0s.' $(seq 1 10035) > "$FIXTURE_DIR/briefing/upper-edge.md"
103
- run "$SCRIPT" "$FIXTURE_DIR/briefing"
104
- [ "$status" -eq 0 ]
105
- echo "$output" | grep -E "^OVER upper-edge.md bytes=10035 threshold=5120"
106
- ! echo "$output" | grep -q "^MUST_SPLIT upper-edge.md"
107
- }
108
-
109
- @test "Branch B input: file UNDER threshold emits NEITHER signal (no Branch B action)" {
110
- # The pre-existing skip path: file below threshold = no rotation pass
111
- # entry. The SKILL contract's "Empty stdout means no files are over
112
- # budget — skip the rest of this pass" precedent is preserved.
113
- mkdir -p "$FIXTURE_DIR/briefing"
114
- write_briefing_entry "$FIXTURE_DIR/briefing/within-budget.md" 3000
115
- run "$SCRIPT" "$FIXTURE_DIR/briefing"
116
- [ "$status" -eq 0 ]
117
- ! echo "$output" | grep -q "within-budget.md"
118
- }
119
-
120
- @test "Branch B / Branch A boundary: file at exactly 2.0x emits BOTH OVER and MUST_SPLIT (Branch A selector)" {
121
- # The contract boundary: 2.0x and above is Branch A (rotation required,
122
- # no defer options eligible). 1.0x-2.0x is Branch B. The script-side
123
- # MUST_SPLIT signal is the discriminator the SKILL prose reads.
124
- mkdir -p "$FIXTURE_DIR/briefing"
125
- printf '%.0s.' $(seq 1 10240) > "$FIXTURE_DIR/briefing/exactly-2x.md"
126
- run "$SCRIPT" "$FIXTURE_DIR/briefing"
127
- [ "$status" -eq 0 ]
128
- echo "$output" | grep -E "^OVER exactly-2x.md bytes=10240 threshold=5120"
129
- echo "$output" | grep -E "^MUST_SPLIT exactly-2x.md reason=ratio-exceeds-2x"
130
- }
131
-
132
- # ── Structural backstops: SKILL.md prose contract terms (narrow per P081) ───
133
- #
134
- # These assertions link SKILL.md prose (canonical human-readable source)
135
- # to the evidence-based-rotation contract and the driver ticket. Without
136
- # these links, the prose contract could drift independently from the
137
- # enforcement layer + driver-ticket evidence trail. Per P081, the scope
138
- # is narrowed to the smallest set of tokens that prove the contract
139
- # terms exist in the prose; assertions intentionally avoid coupling to
140
- # line numbers or sentence-level structure.
141
-
142
- @test "Branch B prose: SKILL.md no longer permits the 'leave-as-is' fall-through (P247 fix verification)" {
143
- # The contract negative-assertion: the eliminated branch's literal
144
- # token "leave-as-is" must NOT appear as a permitted Branch B
145
- # rotation option. The token may legitimately appear inside a
146
- # historical-reference context (e.g. "the eliminated 'leave-as-is'
147
- # branch") — that's why we don't grep for the bare token but for the
148
- # specific surface that previously authorised the defer.
149
- ! grep -F "Else: **leave-as-is**" "$SKILL_MD"
150
- }
151
-
152
- @test "Branch B prose: SKILL.md names 'split-by-date (safe default)' as the Branch B fall-through (P247 fix verification)" {
153
- # The contract positive-assertion: the new fall-through must be named
154
- # explicitly as "split-by-date (safe default)" — the same naming
155
- # Branch A already uses, so a reader of the prose sees the alignment
156
- # without having to cross-reference Branch A's bullet.
157
- grep -F "split-by-date (safe default)" "$SKILL_MD"
158
- }
159
-
160
- @test "Branch B prose: SKILL.md cites P247 as the driver ticket (audit-trail link)" {
161
- # Audit-trail link: the prose names P247 so future readers can locate
162
- # the evidence trail (user correction quote, sibling-class relationship
163
- # to P246, the 14-file evidence from 2026-05-17 session 4 wrap retro).
164
- grep -F "P247" "$SKILL_MD"
165
- }
166
-
167
- @test "Branch B prose: SKILL.md cites P246 sibling fix as the evidence-based principle precedent (cross-class linkage)" {
168
- # Cross-class linkage: P246 (cohort-graduation surface) is the immediate
169
- # sibling fix. The Branch B prose must cite it so the evidence-based-
170
- # not-time-based principle is discoverable as a class, not a one-off
171
- # SKILL fix.
172
- grep -F "P246" "$SKILL_MD"
173
- }
174
-
175
- @test "Branch B prose: SKILL.md cites ADR-044 framework-mediated surface for silent rotation (governance link)" {
176
- # Governance link: per architect verdict, Branch B's silent-rotation
177
- # discipline is authorised by ADR-044's framework-resolution boundary
178
- # ("Briefing add / remove / rotate" line 77). The prose must cite the
179
- # ADR so a reader sees the authority for not firing AskUserQuestion
180
- # per file in Branch B's fall-through.
181
- grep -F "ADR-044" "$SKILL_MD"
182
- }
183
-
184
- @test "Branch B prose: SKILL.md cites ADR-013 Rule 5 for policy-authorised silent proceed (governance link)" {
185
- # Companion governance link: ADR-013 Rule 5 is the originating rule
186
- # for silent-proceed under policy. Branch B inherits this discipline;
187
- # the citation makes the rule chain explicit.
188
- grep -F "ADR-013 Rule 5" "$SKILL_MD"
189
- }
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # packages/retrospective/skills/run-retro/test/run-retro-step-4a-cross-plugin-dispatch.bats
4
- #
5
- # Behavioural tests for run-retro Step 4a's cross-plugin dispatch contract
6
- # to /wr-itil:transition-problem (P135 Phase 2 / R3 / ADR-044).
7
- #
8
- # Step 4a now closes verifying tickets on evidence by delegating to
9
- # /wr-itil:transition-problem <NNN> close (per ADR-014 commit grain)
10
- # WITHOUT firing AskUserQuestion. These tests assert the dispatch
11
- # contract: dispatch occurs on success; failure surfaces in summary;
12
- # unavailability is gracefully handled (not silently swallowed).
13
- #
14
- # Tests are behavioural per ADR-005 / ADR-037 / ADR-044 — they assert
15
- # what the SKILL contract DOES (mechanism + observable outcome) by
16
- # inspecting the SKILL.md text + the precedents it cites. No structural
17
- # greps of the SKILL.md content per ADR-044's deviation-default to
18
- # behavioural-by-default for skill testing.
19
- #
20
- # These contract-assertion tests are documented as the bridge until the
21
- # behavioural-test harness for LLM-interpreted skills exists (P081 Phase
22
- # 2/3 deferred; P012 harness work). Per ADR-044 Confirmation Criteria
23
- # (a), the test FILE exists and is named — the per-assertion shape
24
- # matures as the harness lands.
25
- #
26
- # tdd-review: structural-permitted (justification: skill behavioural
27
- # harness pending P012 + P081 Phase 2; SKILL.md contract assertions are
28
- # the bridge until then; expected to migrate to behavioural form once
29
- # the harness exists)
30
- #
31
- # @problem P135 Phase 2 R3
32
- # @adr ADR-044 (Decision-Delegation Contract — verification close on evidence)
33
- # @adr ADR-014 (commit grain)
34
- # @adr ADR-022 (verification-pending lifecycle)
35
- # @adr ADR-005 / ADR-037 (testing strategy — bridge during harness build)
36
- # @jtbd JTBD-001 / JTBD-006 / JTBD-201
37
-
38
- SKILL_FILE="${BATS_TEST_DIRNAME}/../SKILL.md"
39
-
40
- setup() {
41
- [ -f "$SKILL_FILE" ]
42
- }
43
-
44
- # ── Dispatch contract present in SKILL.md ──────────────────────────────────
45
-
46
- @test "Step 4a SKILL.md cites /wr-itil:transition-problem as the close-on-evidence dispatch target" {
47
- run grep -F "/wr-itil:transition-problem" "$SKILL_FILE"
48
- [ "$status" -eq 0 ]
49
- [[ "$output" == *"close"* ]]
50
- }
51
-
52
- @test "Step 4a SKILL.md names ADR-044 framework-resolution boundary as the rationale for no-AskUserQuestion close" {
53
- run grep -F "ADR-044" "$SKILL_FILE"
54
- [ "$status" -eq 0 ]
55
- }
56
-
57
- @test "Step 4a SKILL.md cites ADR-026 grounding for in-session evidence requirement" {
58
- run grep -F "ADR-026" "$SKILL_FILE"
59
- [ "$status" -eq 0 ]
60
- }
61
-
62
- @test "Step 4a SKILL.md cites ADR-014 for commit grain on the close action" {
63
- run grep -F "ADR-014" "$SKILL_FILE"
64
- [ "$status" -eq 0 ]
65
- }
66
-
67
- # ── Failure-mode contracts ──────────────────────────────────────────────────
68
-
69
- @test "Step 4a SKILL.md documents dispatch-failure handling (non-zero return surfaced, NOT marked closed)" {
70
- run grep -F "dispatch-failed" "$SKILL_FILE"
71
- [ "$status" -eq 0 ]
72
- }
73
-
74
- @test "Step 4a SKILL.md documents dispatch-unavailable handling (graceful fallback, not silent swallow)" {
75
- run grep -F "dispatch-unavailable" "$SKILL_FILE"
76
- [ "$status" -eq 0 ]
77
- }
78
-
79
- @test "Step 4a SKILL.md surfaces the close-action result in Step 5 retro summary" {
80
- run grep -F "Decision column" "$SKILL_FILE"
81
- [ "$status" -eq 0 ]
82
- }
83
-
84
- # ── Recovery-path documentation ─────────────────────────────────────────────
85
-
86
- @test "Step 4a SKILL.md cites P135 Phase 2 R5 recovery-path documentation" {
87
- # Matches the cross-reference to the recovery-path bats fixture
88
- run grep -F "run-retro-step-4a-recovery-path.bats" "$SKILL_FILE"
89
- [ "$status" -eq 0 ]
90
- }
91
-
92
- # ── Same-session exclusion preserved (P068 design unchanged) ────────────────
93
-
94
- @test "Step 4a SKILL.md preserves same-session-verifyings exclusion from close-on-evidence" {
95
- run grep -F "Same-session verifyings excluded" "$SKILL_FILE"
96
- [ "$status" -eq 0 ]
97
- }
98
-
99
- @test "Step 4a SKILL.md cites the 2026-04-27 P124 verifying-flip-back as the regression-recovery precedent" {
100
- run grep -F "P124" "$SKILL_FILE"
101
- [ "$status" -eq 0 ]
102
- }
103
-
104
- # ── Anti-pattern preserved: NEVER per-candidate AskUserQuestion ─────────────
105
-
106
- @test "Step 4a SKILL.md text no longer contains the legacy 'Close P<NNN>' / 'Leave as Verification Pending' / 'Flag for manual review' AskUserQuestion option list" {
107
- # Specific prior options were the per-candidate ask (P135 R3 corrective)
108
- # Assert the legacy 3-option block is GONE from Step 4a's section.
109
- # We bound by line number to scope to Step 4a (lines 317-360 approx) — file-wide grep
110
- # would also match the docs preserving history; this is a localised assertion.
111
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
112
- [ "$status" -eq 0 ]
113
- [[ "$output" != *"Close P<NNN>\` — description: \"Delegate to /wr-itil:manage-problem"* ]]
114
- }
@@ -1,168 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # packages/retrospective/skills/run-retro/test/run-retro-step-4a-prior-session-evidence-drain.bats
4
- #
5
- # Contract assertions for run-retro Step 4a's prior-session evidence drain
6
- # stage (P282). Step 4a's current sub-steps 1-8 scan the CURRENT session's
7
- # tool-call activity for evidence. This stage consumes durable on-disk
8
- # evidence — README Verification Queue rows whose `Likely verified?` cell
9
- # already records `yes — observed: <citations>` from a prior session — that
10
- # is structurally invisible to current-session scans.
11
- #
12
- # Background: 2026-05-26 evidence in this repo (P282 Related section) —
13
- # 8/91 `verifying/` rows had `yes — observed: …` from prior sessions; none
14
- # auto-closed; the Verification Queue grew to 134 KB exceeding the Read-tool
15
- # 25K-token whole-file cap. Closure required user prompting. The drain
16
- # closes that gap.
17
- #
18
- # Tests are behavioural per ADR-005 / ADR-037 / ADR-044 — they assert what
19
- # the SKILL contract DOES (mechanism + observable outcome) by inspecting
20
- # the SKILL.md text + the precedents it cites. Per ADR-044 Confirmation
21
- # Criteria (a), the test FILE exists and is named; the per-assertion shape
22
- # matures as the behavioural-test harness for LLM-interpreted skills lands
23
- # (P081 Phase 2/3 deferred; P012 harness work).
24
- #
25
- # tdd-review: structural-permitted (justification: skill behavioural
26
- # harness pending P012 + P081 Phase 2; SKILL.md contract assertions are
27
- # the bridge until then; behavioural fixture at the foot of this file
28
- # exercises a sample README VQ table to confirm the drain's row-detection
29
- # heuristic against a real evidence-bearing cell)
30
- #
31
- # @problem P282
32
- # @adr ADR-022 (verification-pending lifecycle)
33
- # @adr ADR-014 (commit grain)
34
- # @adr ADR-044 (decision-delegation — close-on-evidence)
35
- # @adr ADR-074 (substance-confirm-before-build — this fix passed the gate)
36
- # @jtbd JTBD-001 / JTBD-006 / JTBD-201
37
-
38
- SKILL_FILE="${BATS_TEST_DIRNAME}/../SKILL.md"
39
-
40
- setup() {
41
- [ -f "$SKILL_FILE" ] || skip "SKILL.md not found"
42
- }
43
-
44
- @test "run-retro: Step 4a documents a prior-session evidence drain stage (P282)" {
45
- # The drain stage is the headline behaviour; SKILL.md must name it.
46
- run grep -F 'Prior-session evidence drain (P282)' "$SKILL_FILE"
47
- [ "$status" -eq 0 ]
48
- }
49
-
50
- @test "run-retro: prior-session drain reads docs/problems/README.md Verification Queue" {
51
- # The cell to consume is in the README's Verification Queue table, not
52
- # in any current-session activity stream. SKILL.md must name the source.
53
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
54
- [ "$status" -eq 0 ]
55
- [[ "$output" == *"docs/problems/README.md"* ]]
56
- [[ "$output" == *"Verification Queue"* ]]
57
- }
58
-
59
- @test "run-retro: prior-session drain filters on P186 evidence-first cell shape" {
60
- # The canonical signal is `yes — observed: <citations>` per P186.
61
- # SKILL.md must cite the exact cell shape as the filter predicate so
62
- # adopters and future agents can grep for the right value.
63
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
64
- [ "$status" -eq 0 ]
65
- [[ "$output" == *"yes — observed:"* ]]
66
- [[ "$output" == *"P186"* ]]
67
- }
68
-
69
- @test "run-retro: prior-session drain preserves same-session exclusion (sub-step 8)" {
70
- # The drain MUST inherit Step 4a's same-session exclusion (sub-step 8)
71
- # so a session cannot verify its own fix via the README cell either.
72
- # The exclusion is the load-bearing constraint distinguishing "prior
73
- # session wrote the cell" from "current session wrote the cell".
74
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
75
- [ "$status" -eq 0 ]
76
- [[ "$output" == *"same-session"* ]] || [[ "$output" == *"current session"* ]]
77
- }
78
-
79
- @test "run-retro: prior-session drain delegates close via /wr-itil:transition-problem" {
80
- # Per Step 4a's existing dispatch contract (sub-steps 5-7), the close
81
- # MUST route through /wr-itil:transition-problem <NNN> close. run-retro
82
- # never renames, edits Status, or commits — the ownership boundary holds.
83
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
84
- [ "$status" -eq 0 ]
85
- [[ "$output" == *"/wr-itil:transition-problem"* ]]
86
- }
87
-
88
- @test "run-retro: prior-session drain inherits dispatch outcome contract (P135 R3)" {
89
- # The dispatch success / failure / unavailable outcomes are recorded
90
- # in the Step 5 Verification Candidates table per sub-step 7. The
91
- # drain stage MUST cite the inheritance so behaviour is uniform.
92
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
93
- [ "$status" -eq 0 ]
94
- [[ "$output" == *"sub-step 7"* ]] || [[ "$output" == *"Verification Candidates"* ]]
95
- }
96
-
97
- @test "run-retro: prior-session drain records source distinction in Decision column" {
98
- # The Decision column must distinguish drained-from-README from
99
- # current-session-dispatched closes so the user can scan the source
100
- # of each close at retro-summary review time.
101
- run awk '/Prior-session evidence drain/,/^ \*\*Composition/' "$SKILL_FILE"
102
- [ "$status" -eq 0 ]
103
- [[ "$output" == *"prior-session README cell"* ]]
104
- }
105
-
106
- @test "run-retro: prior-session drain documents the recovery path inline (P135 R5)" {
107
- # Closes are reversible via /wr-itil:transition-problem <NNN> known-error
108
- # (the verifying-flip-back path); the drain stage inherits this contract.
109
- run awk '/Prior-session evidence drain/,/\*\*Closes P282\*\*/' "$SKILL_FILE"
110
- [ "$status" -eq 0 ]
111
- [[ "$output" == *"Recovery"* ]] || [[ "$output" == *"recoverable"* ]] || [[ "$output" == *"reversible"* ]]
112
- }
113
-
114
- @test "run-retro: prior-session drain composes with current-session dispatch ordering" {
115
- # The drain fires AFTER sub-steps 5-7 dispatched current-session
116
- # evidence. The Composition note must name the ordering so future
117
- # readers don't accidentally re-order the stages.
118
- run grep -F '**Composition**' "$SKILL_FILE"
119
- [ "$status" -eq 0 ]
120
- run awk '/Prior-session evidence drain/,/\*\*Closes P282\*\*/' "$SKILL_FILE"
121
- [ "$status" -eq 0 ]
122
- [[ "$output" == *"AFTER"* ]] || [[ "$output" == *"after"* ]]
123
- }
124
-
125
- @test "run-retro: prior-session drain cites the 2026-05-26 evidence motivating the fix" {
126
- # The drain's rationale is grounded in observable repo evidence: 8 rows
127
- # carried `yes — observed:` across prior sessions and none auto-closed
128
- # until user-prompted. SKILL.md cites the evidence so future maintainers
129
- # can audit the design driver.
130
- run awk '/Prior-session evidence drain/,/\*\*Closes P282\*\*/' "$SKILL_FILE"
131
- [ "$status" -eq 0 ]
132
- [[ "$output" == *"2026-05-26"* ]] || [[ "$output" == *"134 KB"* ]] || [[ "$output" == *"8/91"* ]]
133
- }
134
-
135
- @test "run-retro: prior-session drain explicitly closes P282" {
136
- # The drain stage names P282 as the ticket it closes so the
137
- # ticket-to-behavior link is greppable. (Same convention used by
138
- # the existing Step 4a header which names P068.)
139
- run grep -F '**Closes P282**' "$SKILL_FILE"
140
- [ "$status" -eq 0 ]
141
- }
142
-
143
- # Behavioural fixture — exercises the row-detection heuristic against a
144
- # sample README VQ table. Asserts the drain's filter predicate matches
145
- # `yes — observed:` rows and skips `no — not observed` / `no — observed
146
- # regression` rows.
147
- @test "behavioural: drain filter matches yes — observed rows and skips no rows" {
148
- # Build a minimal README VQ-shaped fixture in a temp dir.
149
- TMP="$(mktemp -d)"
150
- cat > "$TMP/README.md" <<'EOF'
151
- ## Verification Queue
152
-
153
- | ID | Title | Released | Likely verified? |
154
- | --- | --- | --- | --- |
155
- | P100 | sample one | 2026-04-01 | yes — observed: cited evidence |
156
- | P101 | sample two | 2026-04-02 | no — not observed |
157
- | P102 | sample three | 2026-04-03 | yes — observed: more evidence |
158
- | P103 | sample four | 2026-04-04 | no — observed regression |
159
- EOF
160
- # The drain's row-detection predicate: the cell starts with `yes — observed:`.
161
- # Assert the fixture matches the expected row count.
162
- matched=$(grep -cE '\| yes — observed:' "$TMP/README.md")
163
- [ "$matched" -eq 2 ]
164
- # And the skip predicates match the other two.
165
- skipped=$(grep -cE '\| no — not observed|\| no — observed regression' "$TMP/README.md")
166
- [ "$skipped" -eq 2 ]
167
- rm -rf "$TMP"
168
- }
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # packages/retrospective/skills/run-retro/test/run-retro-step-4a-recovery-path.bats
4
- #
5
- # Behavioural tests for run-retro Step 4a's recovery-path documentation
6
- # (P135 Phase 2 / R5 / ADR-044).
7
- #
8
- # Step 4a closes verifying tickets on evidence WITHOUT firing
9
- # AskUserQuestion (per ADR-044 framework-resolution boundary). The
10
- # recovery contract is critical: closes are reversible, the recovery
11
- # path is documented inline in the Step 5 retro summary, and the user
12
- # can correct via authentic-correction (ADR-044 category 6) if a close
13
- # was wrong.
14
- #
15
- # These tests assert the SKILL.md documents the recovery path
16
- # alongside each close action, names the specific recovery invocation,
17
- # and cites the 2026-04-27 P124 verifying-flip-back precedent as the
18
- # real-world demonstration of the recovery path working end-to-end.
19
- #
20
- # Tests are contract-assertion bridge per ADR-044 Confirmation Criteria
21
- # (a) — same justification as the cross-plugin-dispatch fixture above.
22
- #
23
- # tdd-review: structural-permitted (justification: skill behavioural
24
- # harness pending P012 + P081 Phase 2; SKILL.md contract assertions
25
- # bridge until then; expected to migrate to behavioural form once the
26
- # harness exists)
27
- #
28
- # @problem P135 Phase 2 R5
29
- # @adr ADR-044 (Decision-Delegation Contract — closes are reversible)
30
- # @adr ADR-022 (verification-pending lifecycle)
31
- # @adr ADR-014 (commit grain on the recovery commit)
32
- # @adr ADR-005 / ADR-037 (testing strategy — bridge during harness build)
33
- # @jtbd JTBD-001 / JTBD-006 / JTBD-201
34
-
35
- SKILL_FILE="${BATS_TEST_DIRNAME}/../SKILL.md"
36
-
37
- setup() {
38
- [ -f "$SKILL_FILE" ]
39
- }
40
-
41
- # ── Recovery-path documented in Step 4a ─────────────────────────────────────
42
-
43
- @test "Step 4a SKILL.md documents the recovery path inline alongside close-on-evidence" {
44
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
45
- [ "$status" -eq 0 ]
46
- [[ "$output" == *"Recovery"* ]]
47
- }
48
-
49
- @test "Step 4a SKILL.md names the recovery skill invocation (transition-problem known-error)" {
50
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
51
- [ "$status" -eq 0 ]
52
- [[ "$output" == *"transition-problem"* ]]
53
- [[ "$output" == *"known-error"* ]]
54
- }
55
-
56
- @test "Step 4a SKILL.md cites 2026-04-27 P124 verifying-flip-back as recovery precedent" {
57
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
58
- [ "$status" -eq 0 ]
59
- [[ "$output" == *"P124"* ]]
60
- [[ "$output" == *"flip-back"* ]]
61
- }
62
-
63
- @test "Step 4a SKILL.md affirms closes are reversible" {
64
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
65
- [ "$status" -eq 0 ]
66
- [[ "$output" == *"reversible"* ]]
67
- }
68
-
69
- # ── Recovery surfaces in Step 5 summary ─────────────────────────────────────
70
-
71
- @test "Step 4a SKILL.md says the close action + recovery path lands in Step 5 retro summary" {
72
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
73
- [ "$status" -eq 0 ]
74
- [[ "$output" == *"Step 5"* ]] || [[ "$output" == *"summary"* ]]
75
- }
76
-
77
- # ── Authentic-correction surface preserved ──────────────────────────────────
78
-
79
- @test "Step 4a SKILL.md routes user disagreement through authentic-correction (ADR-044 category 6)" {
80
- run awk '/^### 4a\./,/^### 4b\./ {print}' "$SKILL_FILE"
81
- [ "$status" -eq 0 ]
82
- # Either explicit "authentic-correction" or P078 (the canonical correction surface)
83
- [[ "$output" == *"authentic-correction"* ]] || [[ "$output" == *"P078"* ]]
84
- }
@@ -1,115 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # packages/retrospective/skills/run-retro/test/run-retro-step-4b-retro-auto-ticket-carveout.bats
4
- #
5
- # P342: run-retro Step 4b stage classification must mirror the trust-
6
- # boundary established at Step 4a (verification close-on-evidence) — so
7
- # the same mechanical-stage carve-out applies whether retro fires in iter
8
- # context (work-problems Step 5 iter-prompt) OR standalone in main turn.
9
- #
10
- # The fix shape amends Step 4b stage classification:
11
- # - Mechanical-auto-ticket path: recurring class-of-behaviour /
12
- # SKILL-contract drift / hook misbehaviour / framework-gap → Stage 1
13
- # auto-creates a ticket via /wr-itil:capture-problem (or
14
- # manage-problem if capture sibling not yet available).
15
- # - Direction-setting-queue path: genuine user-judgment-bound questions
16
- # (design choice, deviation-approval, framework boundary) → queued
17
- # as outstanding_questions for orchestrator-level Step 2.5 surface
18
- # when retro runs inside an AFK iter; surfaced at retro end when
19
- # standalone.
20
- # - Ambiguous → default to mechanical-auto-ticket (per P342 trust-
21
- # boundary asymmetry preventing silent queue accumulation).
22
- #
23
- # Contract-assertion tests per ADR-037 Permitted Exception (structural
24
- # checks on prose contract; behavioural harness for SKILL.md pending
25
- # P081 Phase 2 / P012).
26
- #
27
- # @problem P342
28
- # @adr ADR-044 (Decision-Delegation Contract — mechanical-stage carve-out per Step 4a precedent)
29
- # @adr ADR-013 Rule 5 (policy-authorised silent proceed for capture-* on retro path)
30
- # @adr ADR-014 (governance skills commit own work — capture-problem commits per ticket)
31
- # @adr ADR-032 (foreground-spawns-N-background fanout pattern already documented for Stage 1)
32
- # @jtbd JTBD-006 (durable WSJF-ranked backlog accumulation)
33
- # @jtbd JTBD-201 (audit-trail integrity)
34
-
35
- SKILL_FILE="${BATS_TEST_DIRNAME}/../SKILL.md"
36
-
37
- setup() {
38
- [ -f "$SKILL_FILE" ]
39
- }
40
-
41
- # ── Step 4b carve-out subsection presence ───────────────────────────────────
42
-
43
- @test "Step 4b P342: SKILL.md names the mechanical-auto-ticket vs direction-setting-queue split" {
44
- # The fix establishes a classification split at Stage 1 routing.
45
- # Mechanical-class observations route to auto-ticket; direction-class
46
- # to outstanding_questions queue.
47
- run grep -F "mechanical-auto-ticket" "$SKILL_FILE"
48
- [ "$status" -eq 0 ]
49
- }
50
-
51
- @test "Step 4b P342: SKILL.md cites Step 4a precedent for the mechanical-stage carve-out" {
52
- # The carve-out's authority is the Step 4a verification close-on-
53
- # evidence precedent. Cite explicitly so the trust-boundary symmetry
54
- # is discoverable.
55
- run grep -nE 'Step 4a precedent|same trust[- ]boundary.*Step 4a|Step 4a.*precedent' "$SKILL_FILE"
56
- [ "$status" -eq 0 ]
57
- }
58
-
59
- @test "Step 4b P342: SKILL.md names recurring class-of-behaviour as auto-ticket route" {
60
- # Recurring class-of-behaviour / SKILL-contract drift / hook
61
- # misbehaviour / framework-gap → auto-ticket. The taxonomy must be
62
- # documented at Step 4b so the same classification fires whether retro
63
- # runs in iter context OR standalone.
64
- run grep -nE 'recurring class-of-behaviour|class-of-behaviour observation' "$SKILL_FILE"
65
- [ "$status" -eq 0 ]
66
- }
67
-
68
- @test "Step 4b P342: SKILL.md names direction-setting as outstanding_questions route" {
69
- # Direction-setting (design choice, deviation-approval, framework
70
- # boundary) → outstanding_questions when retro runs inside an AFK
71
- # iter; surfaced at retro end when standalone.
72
- run grep -nE 'direction-setting.*outstanding_questions|Direction-setting observation' "$SKILL_FILE"
73
- [ "$status" -eq 0 ]
74
- }
75
-
76
- @test "Step 4b P342: SKILL.md names ambiguous default-to-auto-ticket asymmetry" {
77
- # Per P342 trust-boundary asymmetry: ambiguous → default to auto-
78
- # ticket. This prevents the silent-queue accumulation P342 was filed
79
- # to close.
80
- run grep -nE 'Ambiguous.*auto-ticket|default to auto-ticket|ambiguous.*default.*ticket' "$SKILL_FILE"
81
- [ "$status" -eq 0 ]
82
- }
83
-
84
- # ── Cross-reference to work-problems Step 5 iter-prompt carve-out ──────────
85
-
86
- @test "Step 4b P342: SKILL.md cross-references work-problems Step 5 iter-prompt symmetry" {
87
- # The work-problems iter-prompt amendment is the sibling locus — the
88
- # same trust-boundary fires in both surfaces. Cross-reference so the
89
- # symmetry is discoverable from either side.
90
- run grep -nE 'work-problems Step 5|work-problems.*iter-prompt|Step 5 iter-prompt' "$SKILL_FILE"
91
- [ "$status" -eq 0 ]
92
- }
93
-
94
- # ── ADR-044 framework-resolution boundary citation ─────────────────────────
95
-
96
- @test "Step 4b P342: SKILL.md cites ADR-044 as the framework-resolution authority for the carve-out" {
97
- run grep -F "ADR-044" "$SKILL_FILE"
98
- [ "$status" -eq 0 ]
99
- }
100
-
101
- # ── ADR-014 commit ownership preserved ─────────────────────────────────────
102
-
103
- @test "Step 4b P342: SKILL.md preserves ADR-014 capture-* commit ownership for auto-ticket path" {
104
- # capture-problem (or manage-problem fallback) commits per ADR-014;
105
- # run-retro does not commit auto-ticket creates.
106
- run grep -F "ADR-014" "$SKILL_FILE"
107
- [ "$status" -eq 0 ]
108
- }
109
-
110
- # ── P342 ticket cross-reference ─────────────────────────────────────────────
111
-
112
- @test "Step 4b P342: SKILL.md cites P342 as the trust-boundary mirror ticket" {
113
- run grep -nE 'P342\b' "$SKILL_FILE"
114
- [ "$status" -eq 0 ]
115
- }