@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,122 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # P074: run-retro SKILL.md documents a Pipeline-instability scan step
4
- # (Step 2b) that inspects session activity for tool-level friction
5
- # signals and funnels each detection into Step 4's problem-ticket
6
- # creation path. Shape mirrors P068's Step 4a (evidence-scan + ADR-026
7
- # grounding + interactive/AFK branches).
8
- #
9
- # Doc-lint structural test (Permitted Exception per ADR-005). Asserts
10
- # SKILL.md wording for: the step header, the placement between Step 2
11
- # and Step 4, the six signal categories enumerated in the RCA, the
12
- # ADR-026 grounding requirement, the interactive AskUserQuestion
13
- # contract (ADR-013 Rule 1), the AFK fallback (ADR-013 Rule 6), the
14
- # ownership-delegation boundary to /wr-itil:manage-problem, and the
15
- # Step 5 summary integration.
16
-
17
- setup() {
18
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
19
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
20
- }
21
-
22
- @test "run-retro: SKILL.md contains Step 2b Pipeline-instability scan (P074)" {
23
- run grep -F '### 2b. Pipeline-instability scan (P074)' "$SKILL_MD"
24
- [ "$status" -eq 0 ]
25
- }
26
-
27
- @test "run-retro: Step 2b enumerates all six signal categories" {
28
- run grep -F 'Hook-protocol friction' "$SKILL_MD"
29
- [ "$status" -eq 0 ]
30
- run grep -F 'Skill-contract violations' "$SKILL_MD"
31
- [ "$status" -eq 0 ]
32
- run grep -F 'Release-path instability' "$SKILL_MD"
33
- [ "$status" -eq 0 ]
34
- run grep -F 'Subagent-delegation friction' "$SKILL_MD"
35
- [ "$status" -eq 0 ]
36
- run grep -F 'Repeat-work friction' "$SKILL_MD"
37
- [ "$status" -eq 0 ]
38
- run grep -F 'Session-wrap silent drops' "$SKILL_MD"
39
- [ "$status" -eq 0 ]
40
- }
41
-
42
- @test "run-retro: Step 2b requires specific-citation grounding (ADR-026)" {
43
- run grep -F 'ADR-026' "$SKILL_MD"
44
- [ "$status" -eq 0 ]
45
- run grep -F 'specific citations' "$SKILL_MD"
46
- [ "$status" -eq 0 ]
47
- }
48
-
49
- @test "run-retro: Step 2b interactive AskUserQuestion contract per ADR-013 Rule 1" {
50
- run grep -F 'ADR-013 Rule 1' "$SKILL_MD"
51
- [ "$status" -eq 0 ]
52
- run grep -F 'Create new ticket' "$SKILL_MD"
53
- [ "$status" -eq 0 ]
54
- run grep -F 'Append to P<NNN>' "$SKILL_MD"
55
- [ "$status" -eq 0 ]
56
- run grep -F 'Skip — false positive' "$SKILL_MD"
57
- [ "$status" -eq 0 ]
58
- }
59
-
60
- @test "run-retro: Step 2b AFK fallback defers ticket creation per ADR-013 Rule 6" {
61
- run grep -F 'ADR-013 Rule 6' "$SKILL_MD"
62
- [ "$status" -eq 0 ]
63
- run grep -F 'Pipeline Instability' "$SKILL_MD"
64
- [ "$status" -eq 0 ]
65
- }
66
-
67
- @test "run-retro: Step 2b delegates ticket creation to /wr-itil:manage-problem" {
68
- run grep -F '/wr-itil:manage-problem' "$SKILL_MD"
69
- [ "$status" -eq 0 ]
70
- run grep -F 'run-retro surfaces the detection' "$SKILL_MD"
71
- [ "$status" -eq 0 ]
72
- }
73
-
74
- @test "run-retro: Step 2b dedup checks existing tickets before creating" {
75
- run grep -F 'Dedup against existing tickets' "$SKILL_MD"
76
- [ "$status" -eq 0 ]
77
- run grep -F 'docs/problems/*.open.md' "$SKILL_MD"
78
- [ "$status" -eq 0 ]
79
- run grep -F 'docs/problems/*.known-error.md' "$SKILL_MD"
80
- [ "$status" -eq 0 ]
81
- }
82
-
83
- @test "run-retro: Step 2b ADR-032 supersession note documents post-supersession context handling" {
84
- # ADR-027 was superseded by ADR-032 (2026-04-21). The former
85
- # "ADR-027 compatibility note" was rewritten to an ADR-032 supersession
86
- # note that records the obviation of any Step-0 subagent migration.
87
- # Structural grep retained for now (P081 anti-pattern; convert to
88
- # behavioural fixture in a follow-up — tracked separately).
89
- run grep -F 'ADR-032 supersession note' "$SKILL_MD"
90
- [ "$status" -eq 0 ]
91
- run grep -F 'No Step-0 subagent migration applies' "$SKILL_MD"
92
- [ "$status" -eq 0 ]
93
- }
94
-
95
- @test "run-retro: Step 2b placement between Step 2 reflection and Step 4 ticket creation" {
96
- # Section 2b must appear after 2 and before 4.
97
- pos_2=$(grep -n '^### 2\. Reflect on this session' "$SKILL_MD" | head -1 | cut -d: -f1)
98
- pos_2b=$(grep -n '^### 2b\. Pipeline-instability scan' "$SKILL_MD" | head -1 | cut -d: -f1)
99
- pos_4=$(grep -n '^### 4\. Create or update problem tickets' "$SKILL_MD" | head -1 | cut -d: -f1)
100
- [ -n "$pos_2" ]
101
- [ -n "$pos_2b" ]
102
- [ -n "$pos_4" ]
103
- [ "$pos_2" -lt "$pos_2b" ]
104
- [ "$pos_2b" -lt "$pos_4" ]
105
- }
106
-
107
- @test "run-retro: Step 5 summary adds a Pipeline Instability section" {
108
- run grep -F '### Pipeline Instability' "$SKILL_MD"
109
- [ "$status" -eq 0 ]
110
- }
111
-
112
- @test "run-retro: Pipeline Instability summary table columns match Step 2b output" {
113
- run grep -F '| Signal | Category | Citations | Decision |' "$SKILL_MD"
114
- [ "$status" -eq 0 ]
115
- }
116
-
117
- @test "run-retro: Step 2b documents interaction with P068 Step 4a shape (shared evidence-scan pattern)" {
118
- run grep -F 'P068' "$SKILL_MD"
119
- [ "$status" -eq 0 ]
120
- run grep -F 'evidence-scan' "$SKILL_MD"
121
- [ "$status" -eq 0 ]
122
- }
@@ -1,137 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # P105: run-retro SKILL.md documents a signal-vs-noise pass (Step 1.5) that
4
- # scores every briefing entry per retro cycle, drives Critical Points curation,
5
- # and gates deletion behind a batched user-confirmation queue.
6
- #
7
- # Doc-lint structural test (Permitted Exception per ADR-005). Asserts
8
- # SKILL.md wording for: the step header, placement between Step 1 and Step 2,
9
- # the three scoring rules (signal +2, noise -1, decay -1), the HTML comment
10
- # persistence format, the ADR-026 grounding requirement, the threshold
11
- # actions (promote/keep/delete), the Tier 1 budget guard, the delete-queue
12
- # AskUserQuestion contract (ADR-013 Rule 1), the AFK fallback (ADR-013 Rule 6),
13
- # the Step 3 agent-driven promotion update, and the Step 5 summary integration.
14
-
15
- setup() {
16
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
17
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
18
- }
19
-
20
- @test "run-retro: SKILL.md contains Step 1.5 Briefing signal-vs-noise pass (P105)" {
21
- run grep -F '### 1.5. Briefing signal-vs-noise pass (P105)' "$SKILL_MD"
22
- [ "$status" -eq 0 ]
23
- }
24
-
25
- @test "run-retro: Step 1.5 placement between Step 1 and Step 2" {
26
- pos_1=$(grep -n '^### 1\. ' "$SKILL_MD" | head -1 | cut -d: -f1)
27
- pos_1_5=$(grep -n '^### 1\.5\. ' "$SKILL_MD" | head -1 | cut -d: -f1)
28
- pos_2=$(grep -n '^### 2\. ' "$SKILL_MD" | head -1 | cut -d: -f1)
29
- [ -n "$pos_1" ]
30
- [ -n "$pos_1_5" ]
31
- [ -n "$pos_2" ]
32
- [ "$pos_1" -lt "$pos_1_5" ]
33
- [ "$pos_1_5" -lt "$pos_2" ]
34
- }
35
-
36
- @test "run-retro: Step 1.5 documents all three scoring events" {
37
- run grep -F 'Signal | +2' "$SKILL_MD"
38
- [ "$status" -eq 0 ]
39
- run grep -F 'Noise | -1' "$SKILL_MD"
40
- [ "$status" -eq 0 ]
41
- run grep -F 'Decay | -1' "$SKILL_MD"
42
- [ "$status" -eq 0 ]
43
- }
44
-
45
- @test "run-retro: Step 1.5 documents the HTML comment persistence format" {
46
- run grep -F 'signal-score:' "$SKILL_MD"
47
- [ "$status" -eq 0 ]
48
- run grep -F 'last-classified:' "$SKILL_MD"
49
- [ "$status" -eq 0 ]
50
- run grep -F 'first-written:' "$SKILL_MD"
51
- [ "$status" -eq 0 ]
52
- }
53
-
54
- @test "run-retro: Step 1.5 requires ADR-026 grounding for classifications" {
55
- run grep -F 'ADR-026' "$SKILL_MD"
56
- [ "$status" -eq 0 ]
57
- run grep -F 'specific citation' "$SKILL_MD"
58
- [ "$status" -eq 0 ]
59
- run grep -F 'Bare classifications are forbidden' "$SKILL_MD"
60
- [ "$status" -eq 0 ]
61
- }
62
-
63
- @test "run-retro: Step 1.5 documents promote threshold (score >= +3)" {
64
- run grep -F '>= +3' "$SKILL_MD"
65
- [ "$status" -eq 0 ]
66
- run grep -F 'Promote to Critical Points' "$SKILL_MD"
67
- [ "$status" -eq 0 ]
68
- }
69
-
70
- @test "run-retro: Step 1.5 documents delete queue threshold (score <= -3)" {
71
- run grep -F '<= -3' "$SKILL_MD"
72
- [ "$status" -eq 0 ]
73
- run grep -F 'delete queue' "$SKILL_MD"
74
- [ "$status" -eq 0 ]
75
- }
76
-
77
- @test "run-retro: Step 1.5 delete queue is silent — no AskUserQuestion (ADR-044 / P132; reconciled by P393)" {
78
- # Step 1.5 deletes are SILENT (framework-mediated per ADR-044 "Briefing add/remove/rotate"
79
- # + the CLAUDE.md P132 worked-example "run-retro Step 1.5 silent classification, Step 3
80
- # briefing removals"). The superseded "single batched AskUserQuestion to confirm deletes"
81
- # prose was a self-contradiction against Step 3's "Removals are silent" clause; reconciled
82
- # to silent-delete by P393. This asserts the reconciled contract.
83
- run grep -F 'Silent removal' "$SKILL_MD"
84
- [ "$status" -eq 0 ]
85
- run grep -F 'Delete handling — silent' "$SKILL_MD"
86
- [ "$status" -eq 0 ]
87
- run grep -F 'do NOT reintroduce it' "$SKILL_MD"
88
- [ "$status" -eq 0 ]
89
- # negative: the superseded delete-confirmation prompt must NOT return
90
- run grep -F 'Delete briefing entries?' "$SKILL_MD"
91
- [ "$status" -ne 0 ]
92
- }
93
-
94
- @test "run-retro: Step 1.5 AFK fallback defers delete queue to retro summary (ADR-013 Rule 6)" {
95
- run grep -F 'Non-interactive / AFK fallback (ADR-013 Rule 6)' "$SKILL_MD"
96
- [ "$status" -eq 0 ]
97
- run grep -F 'Do NOT auto-delete' "$SKILL_MD"
98
- [ "$status" -eq 0 ]
99
- run grep -F 'Signal-vs-Noise Pass' "$SKILL_MD"
100
- [ "$status" -eq 0 ]
101
- }
102
-
103
- @test "run-retro: Step 1.5 documents the Tier 1 budget guard" {
104
- run grep -F 'Tier 1 budget guard' "$SKILL_MD"
105
- [ "$status" -eq 0 ]
106
- run grep -F '2 KB' "$SKILL_MD"
107
- [ "$status" -eq 0 ]
108
- }
109
-
110
- @test "run-retro: Step 1.5 cites ADR-040 for the Critical Points budget" {
111
- run grep -F 'ADR-040' "$SKILL_MD"
112
- [ "$status" -eq 0 ]
113
- }
114
-
115
- @test "run-retro: Step 1.5 classification is policy-authorised silent (ADR-013 Rule 5)" {
116
- run grep -F 'policy-authorised per ADR-013 Rule 5' "$SKILL_MD"
117
- [ "$status" -eq 0 ]
118
- run grep -F 'agent owns silent classification' "$SKILL_MD"
119
- [ "$status" -eq 0 ]
120
- }
121
-
122
- @test "run-retro: Step 3 acknowledges agent-driven promotion from Step 1.5 score" {
123
- run grep -F 'agent-driven per Step 1.5' "$SKILL_MD"
124
- [ "$status" -eq 0 ]
125
- run grep -F 'signal-score' "$SKILL_MD"
126
- [ "$status" -eq 0 ]
127
- }
128
-
129
- @test "run-retro: Step 5 summary adds a Signal-vs-Noise Pass section" {
130
- run grep -F '### Signal-vs-Noise Pass (P105)' "$SKILL_MD"
131
- [ "$status" -eq 0 ]
132
- }
133
-
134
- @test "run-retro: Signal-vs-Noise Pass summary table columns match Step 1.5 output" {
135
- run grep -F '| Entry | Topic file | Old score | New score | Classification | Citation |' "$SKILL_MD"
136
- [ "$status" -eq 0 ]
137
- }
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env bats
2
- # Doc-lint guard: run-retro SKILL.md must include the skill-recommendation branch.
3
- #
4
- # Structural assertion — Permitted Exception to the source-grep ban (ADR-005 / P011).
5
- # These tests do not assert hook behaviour; they assert that the skill specification
6
- # document includes the skill-candidate branch added in P044.
7
- #
8
- # Cross-reference:
9
- # P044 (docs/problems/044-run-retro-does-not-recommend-new-skills.known-error.md)
10
- # ADR-013 Rule 1 / Rule 6 (docs/decisions/013-structured-user-interaction-for-governance-decisions.proposed.md)
11
- # @jtbd JTBD-001 (enforce governance without slowing down)
12
- # @jtbd JTBD-101 (extend the suite with clear patterns)
13
-
14
- setup() {
15
- SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
16
- SKILL_FILE="${SKILL_DIR}/SKILL.md"
17
- }
18
-
19
- @test "SKILL.md exists and has frontmatter" {
20
- [ -f "$SKILL_FILE" ]
21
- run head -1 "$SKILL_FILE"
22
- [ "$status" -eq 0 ]
23
- [ "$output" = "---" ]
24
- }
25
-
26
- @test "SKILL.md Step 2 includes the skill-candidate reflection category (P044, updated by P050)" {
27
- # P044 fix: Step 2 must prompt for recurring workflows that would be better
28
- # as skills. P050 generalises this to a codification category, with "skill"
29
- # retained as one worked example within the shape list. This test accepts
30
- # either the original P044 phrasing OR the P050 generalised phrasing that
31
- # still names "skill" as a shape.
32
- run grep -in "recurring workflow.*better as a skill\|would be better as a skill\|recurring pattern.*better codified\|\*\*Skill\*\* — " "$SKILL_FILE"
33
- [ "$status" -eq 0 ]
34
- }
35
-
36
- @test "SKILL.md includes a Step 4b Recommend new skills branch (P044)" {
37
- # P044 fix: a dedicated output branch for skill candidates, distinct from Step 4
38
- # (problem tickets) and Step 5 (summary).
39
- run grep -n "Recommend new skills\|Step 4b" "$SKILL_FILE"
40
- [ "$status" -eq 0 ]
41
- }
42
-
43
- @test "SKILL.md Step 4b uses AskUserQuestion (ADR-013 Rule 1)" {
44
- # ADR-013 Rule 1: the skill-candidate decision branch must use AskUserQuestion,
45
- # not prose '(a)/(b)/(c)' enumeration. Architect review flagged this as the
46
- # gotcha to avoid when implementing P044.
47
- run grep -n "AskUserQuestion" "$SKILL_FILE"
48
- [ "$status" -eq 0 ]
49
- }
50
-
51
- @test "SKILL.md Step 4b header matches ADR-013 structured-interaction pattern (P044, updated by P050)" {
52
- # P044 used "Skill candidate" as the AskUserQuestion header. P050 generalises
53
- # to "Codification candidate" with "Skill" as one shape option. Accept either —
54
- # both preserve the ADR-013 Rule 1 structured-interaction shape.
55
- run grep -in "Skill candidate\|Codification candidate" "$SKILL_FILE"
56
- [ "$status" -eq 0 ]
57
- }
58
-
59
- @test "SKILL.md Step 4b names the structured options for skill-shaped candidates (P044, updated by P050, reframed by P075)" {
60
- # P044 required three specific option labels (Create a new skill / Track as
61
- # a problem / Skip — not skill-worthy). P050 generalised to "Skill — create
62
- # stub". P075 reframes Step 4b as a two-stage flow: Stage 1 tickets
63
- # mechanically (the former "Track as a problem" decision disappears
64
- # because ticketing is no longer a user choice); Stage 2 asks the
65
- # fix-strategy question with four options. P044's recommend-new-skills
66
- # intent now rides in Stage 2 Option 1 (`Skill — create stub`). The
67
- # former "Skip — not skill-worthy / not codify-worthy" path becomes
68
- # Stage 2 Option 4 (`Self-contained work — no codification stub`) with a
69
- # Rule 6 audit note preventing silent-skip. Accept all three forms across
70
- # the P044 / P050 / P075 lineage.
71
- run grep -in "Create a new skill\|Skill — create stub\|Skill - create stub" "$SKILL_FILE"
72
- [ "$status" -eq 0 ]
73
- # Stage 1 ticketing delegation is mechanical post-P075; assert the
74
- # delegation path is named in SKILL.md so the P044 "Track as a problem
75
- # ticket" enforcement intent still has a visible home.
76
- run grep -in "Track as a problem ticket\|Problem — invoke manage-problem\|/wr-itil:manage-problem\|/wr-itil:capture-problem" "$SKILL_FILE"
77
- [ "$status" -eq 0 ]
78
- # The skip-equivalent path. P075 renamed this to "Self-contained work" so
79
- # P044's escape-hatch pain pattern does not leak; keep the legacy strings
80
- # in the regex for backward compatibility across the P044 / P050 / P075
81
- # lineage.
82
- run grep -in "Skip — not skill-worthy\|Skip - not skill-worthy\|Skip — not codify-worthy\|Skip - not codify-worthy\|Self-contained work — no codification stub\|Self-contained work - no codification stub" "$SKILL_FILE"
83
- [ "$status" -eq 0 ]
84
- }
85
-
86
- @test "SKILL.md Step 4b has non-interactive fallback per ADR-013 Rule 6" {
87
- # ADR-013 Rule 6: if AskUserQuestion is unavailable, flag candidates instead of
88
- # silently choosing. P044 implementation uses "flagged — not actioned" wording.
89
- run grep -n "non-interactive\|Rule 6" "$SKILL_FILE"
90
- [ "$status" -eq 0 ]
91
- }
92
-
93
- @test "SKILL.md Step 5 summary template has a Skill / Codification Candidates slot (P044, updated by P050)" {
94
- # P044 fix: the summary template must include a Skill Candidates section so
95
- # recommendations are visible in the session audit alongside BRIEFING changes
96
- # and problem tickets. P050 generalises this to a unified "Codification
97
- # Candidates" table with a Shape column; skill-shaped candidates still appear
98
- # (as Shape: skill rows). Accept either heading.
99
- run grep -n "### Skill Candidates\|### Codification Candidates" "$SKILL_FILE"
100
- [ "$status" -eq 0 ]
101
- }
102
-
103
- @test "SKILL.md does not contain 'Options: (a)' prose option list (ADR-013)" {
104
- # ADR-013 Rule 1: user-facing decisions must use AskUserQuestion, not prose
105
- # "Options: (a)/(b)/(c)". This matches the narrow pattern used by
106
- # manage-problem-no-prose-options.bats so criteria lists using (a)/(b)/(c)
107
- # as internal enumeration (which are fine) don't trip the test.
108
- run grep -n "Options: (a)" "$SKILL_FILE"
109
- [ "$status" -ne 0 ]
110
- }
111
-
112
- @test "SKILL.md does not contain 'Your call:' prose option prompt (ADR-013)" {
113
- # ADR-013 Rule 1: mirrors the manage-problem regression guard.
114
- run grep -n "Your call:" "$SKILL_FILE"
115
- [ "$status" -ne 0 ]
116
- }
@@ -1,65 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # P148: run-retro SKILL.md Step 4b Stage 1 MUST carry a tightened
4
- # AFK-branch fallback-gating clause that (a) names `cause: skill_unavailable`
5
- # as the only valid fallback gate, (b) enumerates the rationalisation
6
- # anti-patterns the agent is forbidden to use, and (c) cites the
7
- # advisory script that mechanically enforces the cause allowlist.
8
- #
9
- # # Test shape: minimal structural backstop (ADR-037 permitted exception)
10
- #
11
- # Per P081 (structural-content tests are wasteful — behavioural preferred),
12
- # the LOAD-BEARING test for this fix lives at
13
- # `packages/retrospective/scripts/test/check-tickets-deferred-cause.bats`
14
- # (behavioural — exercises the script against fixture retro summary
15
- # directories with good / bad / legacy / mixed cause column shapes).
16
- #
17
- # This file is a TINY structural backstop that links the SKILL.md prose
18
- # (canonical human-readable source) to the script (mechanical enforcement).
19
- # Without this link, the prose contract and the script contract could
20
- # drift independently — agents reading the prose would see one set of
21
- # valid causes, the script would enforce a different set. The structural
22
- # assertion confirms the prose names the same allowlist token (`skill_unavailable`)
23
- # and the same script path the prose tells the reader to consult.
24
- #
25
- # Architect verdict (2026-04-29): keep the prose as canonical, the
26
- # script as mechanical enforcement, and ONE structural assertion linking
27
- # them. P081 narrows ADR-037's permitted exception; this file's three
28
- # assertions are the architect-approved minimum.
29
- #
30
- # # @adr ADR-037 permitted exception — narrowest justifiable scope.
31
- # # @adr ADR-044 framework-mediated surface boundary cited in SKILL.md.
32
- # # @ticket P148 — Stage 1 fallback-gating tightening (driver).
33
- # # @ticket P145 — sibling defer-pattern at Tier 3 rotation (composing surface).
34
- # # @ticket P081 — behavioural-tests-preferred direction (justifies tiny scope).
35
-
36
- setup() {
37
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
38
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
39
- }
40
-
41
- @test "Stage 1 AFK branch names 'cause: skill_unavailable' as the only valid fallback gate (P148)" {
42
- # Links SKILL.md prose to the script's allowlist. If the prose adds
43
- # a second valid cause without an matching script update, this
44
- # assertion still passes — the goal is "the prose names the canonical
45
- # token", not "the prose names the entire allowlist exhaustively".
46
- run grep -F 'cause: skill_unavailable' "$SKILL_MD"
47
- [ "$status" -eq 0 ]
48
- }
49
-
50
- @test "Stage 1 AFK branch references the advisory script by path (P148)" {
51
- # Without this reference, a reader of the SKILL.md prose has no path
52
- # to the mechanical enforcement layer. The script reference IS the
53
- # affordance to the tooling.
54
- run grep -F 'check-tickets-deferred-cause.sh' "$SKILL_MD"
55
- [ "$status" -eq 0 ]
56
- }
57
-
58
- @test "Stage 1 AFK branch cites P148 as the anti-pattern driver (P148)" {
59
- # Audit-trail link: the anti-pattern enumeration's authority is the
60
- # 2026-04-29 user correction recorded on P148. This assertion confirms
61
- # the prose names the driver ticket so future readers can locate the
62
- # evidence trail.
63
- run grep -F 'P148' "$SKILL_MD"
64
- [ "$status" -eq 0 ]
65
- }
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env bats
2
- #
3
- # packages/retrospective/skills/run-retro/test/run-retro-step-2d-r6-auto-flag.bats
4
- #
5
- # Behavioural tests for Step 2d's R6-numeric-gate auto-flag contract
6
- # (P135 follow-up / ADR-044 Reassessment Trigger). When the R6 gate
7
- # fires (lazy count ≥2 across 3 consecutive retros), Step 2d MUST
8
- # auto-queue a deviation-candidate so the framework reminds itself
9
- # that Phase 4 enforcement-hook work is warranted.
10
- #
11
- # tdd-review: structural-permitted (justification: skill behavioural
12
- # harness pending P012 + P081 Phase 2; SKILL.md contract assertions
13
- # bridge until then; expected to migrate to behavioural form once
14
- # the harness exists)
15
- #
16
- # @problem P135 (ADR-044 Reassessment / Phase 4 gating)
17
- # @adr ADR-044 (Decision-Delegation Contract — R6 numeric gate)
18
- # @adr ADR-005 / ADR-037 (testing strategy)
19
- # @jtbd JTBD-001 / JTBD-006
20
-
21
- SKILL_FILE="${BATS_TEST_DIRNAME}/../SKILL.md"
22
-
23
- setup() {
24
- [ -f "$SKILL_FILE" ]
25
- }
26
-
27
- @test "Step 2d documents R6 numeric gate auto-flag mechanism (P135 Reassessment Trigger)" {
28
- run grep -F "R6 numeric gate auto-flag" "$SKILL_FILE"
29
- [ "$status" -eq 0 ]
30
- }
31
-
32
- @test "Step 2d invokes check-ask-hygiene.sh to detect R6 condition" {
33
- run grep -F "check-ask-hygiene.sh" "$SKILL_FILE"
34
- [ "$status" -eq 0 ]
35
- }
36
-
37
- @test "Step 2d R6 condition explicit: lazy count >=2 across 3 consecutive retros" {
38
- run grep -F "≥2 across 3 consecutive retros" "$SKILL_FILE"
39
- [ "$status" -eq 0 ]
40
- }
41
-
42
- @test "Step 2d auto-queues a deviation-candidate when R6 fires" {
43
- run grep -F "auto-queue a deviation-candidate" "$SKILL_FILE"
44
- [ "$status" -eq 0 ]
45
- }
46
-
47
- @test "Step 2d auto-flag deviation-candidate cites P135 + ADR-044" {
48
- # Bound to Step 2d section
49
- run awk '/^### 2d\./,/^### 3\./ {print}' "$SKILL_FILE"
50
- [ "$status" -eq 0 ]
51
- [[ "$output" == *"P135"* ]]
52
- [[ "$output" == *"ADR-044"* ]]
53
- }
54
-
55
- @test "Step 2d auto-flag specifies the proposed_shape: amend (Phase 4 enforcement hook)" {
56
- run awk '/^### 2d\./,/^### 3\./ {print}' "$SKILL_FILE"
57
- [ "$status" -eq 0 ]
58
- [[ "$output" == *"proposed_shape:"* ]]
59
- [[ "$output" == *"amend"* ]]
60
- [[ "$output" == *"Phase 4 enforcement hook"* ]]
61
- }
62
-
63
- @test "ADR-044 Reassessment cites R6 numeric gate as the explicit trigger" {
64
- ADR_FILE="${BATS_TEST_DIRNAME}/../../../../../docs/decisions/044-decision-delegation-contract.proposed.md"
65
- [ -f "$ADR_FILE" ]
66
- run grep -F "R6 numeric gate fires" "$ADR_FILE"
67
- [ "$status" -eq 0 ]
68
- }
69
-
70
- @test "ADR-044 Reassessment explicitly cross-references Step 2d's auto-queue mechanism" {
71
- ADR_FILE="${BATS_TEST_DIRNAME}/../../../../../docs/decisions/044-decision-delegation-contract.proposed.md"
72
- [ -f "$ADR_FILE" ]
73
- run grep -F "auto-queue a deviation-candidate" "$ADR_FILE"
74
- [ "$status" -eq 0 ]
75
- }
76
-
77
- @test "ADR-044 Reassessment names 'framework reminds itself' as the no-manual-tracking property" {
78
- ADR_FILE="${BATS_TEST_DIRNAME}/../../../../../docs/decisions/044-decision-delegation-contract.proposed.md"
79
- [ -f "$ADR_FILE" ]
80
- run grep -F "framework reminds itself" "$ADR_FILE"
81
- [ "$status" -eq 0 ]
82
- }