@windyroad/risk-scorer 0.17.2 → 0.17.3

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.
@@ -1,136 +0,0 @@
1
- #!/usr/bin/env bats
2
- # Doc-lint guard: /wr-risk-scorer:create-risk MUST accept --slug and --prefill
3
- # flags for orchestrator-driven prefilled invocation per ADR-059 verdict F2.
4
- # Flag-driven path skips AskUserQuestion and writes the entry deterministically
5
- # under ADR-013 Rule 5 (catalog framing in RISK-POLICY.md IS the policy
6
- # authorisation). Existing AskUserQuestion-driven authoring path preserved
7
- # for human invocation (no flags).
8
- #
9
- # Structural assertions — Permitted Exception to the source-grep ban (ADR-005 / P011).
10
- # SKILL.md is a specification document; behavioural verification of LLM-driven
11
- # skills is out of scope for bats. The contract document is what consuming
12
- # orchestrators (work-problems Step 6.4 drain, install-updates Step 6.5
13
- # bootstrap auto-trigger, etc.) rely on.
14
- #
15
- # Cross-reference:
16
- # ADR-059: docs/decisions/059-pipeline-consume-catalog-and-bootstrap-from-reports.proposed.md
17
- # ADR-056: docs/decisions/056-risk-register-back-channel-write-contract.proposed.md (queue source)
18
- # ADR-026: docs/decisions/026-agent-output-grounding.proposed.md (sentinel pattern)
19
- # ADR-013: docs/decisions/013-structured-user-interaction-for-governance-decisions.proposed.md (Rule 5)
20
- # P168: docs/problems/168-risk-scorer-doesnt-consume-catalog-or-bootstrap.known-error.md
21
- # @jtbd JTBD-001 (enforce governance without slowing down — auto-write closes missed-class hazard)
22
- # @jtbd JTBD-006 (AFK-safety — flag-driven path is non-interactive)
23
-
24
- setup() {
25
- SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
26
- SKILL="${SKILL_DIR}/SKILL.md"
27
- }
28
-
29
- # ──────────────────────────────────────────────────────────────────────────────
30
- # Flag-driven path section exists; cites ADR-059
31
- # ──────────────────────────────────────────────────────────────────────────────
32
-
33
- @test "create-risk SKILL.md defines orchestrator flag-driven path section" {
34
- run grep -qE "^### 1b. Orchestrator flag-driven path|Orchestrator flag-driven path" "$SKILL"
35
- [ "$status" -eq 0 ]
36
- }
37
-
38
- @test "create-risk SKILL.md cites ADR-059 in the flag-driven section" {
39
- run grep -q "ADR-059" "$SKILL"
40
- [ "$status" -eq 0 ]
41
- }
42
-
43
- # ──────────────────────────────────────────────────────────────────────────────
44
- # Flags: --slug and --prefill (required); --report-path (optional)
45
- # ──────────────────────────────────────────────────────────────────────────────
46
-
47
- @test "create-risk SKILL.md accepts --slug flag" {
48
- run grep -q -- "--slug" "$SKILL"
49
- [ "$status" -eq 0 ]
50
- }
51
-
52
- @test "create-risk SKILL.md accepts --prefill flag" {
53
- run grep -q -- "--prefill" "$SKILL"
54
- [ "$status" -eq 0 ]
55
- }
56
-
57
- @test "create-risk SKILL.md accepts --report-path flag (optional)" {
58
- run grep -q -- "--report-path" "$SKILL"
59
- [ "$status" -eq 0 ]
60
- }
61
-
62
- # ──────────────────────────────────────────────────────────────────────────────
63
- # Deterministic-write defaults under flag-driven path
64
- # ──────────────────────────────────────────────────────────────────────────────
65
-
66
- @test "create-risk SKILL.md sets pending-review Status under flag-driven path" {
67
- run grep -q "Active (auto-scaffolded — pending review)" "$SKILL"
68
- [ "$status" -eq 0 ]
69
- }
70
-
71
- @test "create-risk SKILL.md uses ADR-026 sentinel for ungrounded scoring" {
72
- run grep -q "not estimated — no prior data" "$SKILL"
73
- [ "$status" -eq 0 ]
74
- }
75
-
76
- @test "create-risk SKILL.md sets pending review Curation field" {
77
- run grep -qE "Curation.*pending review|pending review .auto-scaffolded" "$SKILL"
78
- [ "$status" -eq 0 ]
79
- }
80
-
81
- # ──────────────────────────────────────────────────────────────────────────────
82
- # Source Evidence block (required for flag-driven path per ADR-026 grounding)
83
- # ──────────────────────────────────────────────────────────────────────────────
84
-
85
- @test "create-risk SKILL.md requires Source Evidence block under flag-driven path" {
86
- run grep -q "## Source Evidence" "$SKILL"
87
- [ "$status" -eq 0 ]
88
- }
89
-
90
- @test "create-risk SKILL.md cites .risk-reports/ in Source Evidence shape" {
91
- run grep -q ".risk-reports/" "$SKILL"
92
- [ "$status" -eq 0 ]
93
- }
94
-
95
- # ──────────────────────────────────────────────────────────────────────────────
96
- # AskUserQuestion handling: skipped under flags, preserved without flags
97
- # ──────────────────────────────────────────────────────────────────────────────
98
-
99
- @test "create-risk SKILL.md skips AskUserQuestion under flag-driven path" {
100
- # Per CLAUDE.md P132 (inverse-P078) — the framework has resolved the decision
101
- # via ADR-056 queue + ADR-013 Rule 5 policy authorisation; no per-class consent gate.
102
- run grep -qE "[Ss]kip AskUserQuestion|SKIP step 2|skips AskUserQuestion" "$SKILL"
103
- [ "$status" -eq 0 ]
104
- }
105
-
106
- @test "create-risk SKILL.md preserves AskUserQuestion path for human invocation" {
107
- run grep -qE "preserved for human invocation|interactive authoring path preserved|no.*flags" "$SKILL"
108
- [ "$status" -eq 0 ]
109
- }
110
-
111
- # ──────────────────────────────────────────────────────────────────────────────
112
- # Slug-collision handling: append to existing file's Source Evidence block
113
- # ──────────────────────────────────────────────────────────────────────────────
114
-
115
- @test "create-risk SKILL.md handles slug collision via Source Evidence append" {
116
- run grep -qE "slug.collision|slug is the dedupe key|append.*Source Evidence" "$SKILL"
117
- [ "$status" -eq 0 ]
118
- }
119
-
120
- # ──────────────────────────────────────────────────────────────────────────────
121
- # Policy authorisation: ADR-013 Rule 5
122
- # ──────────────────────────────────────────────────────────────────────────────
123
-
124
- @test "create-risk SKILL.md cites ADR-013 Rule 5 for the flag-driven authorisation" {
125
- run grep -qE "ADR-013 Rule 5|Rule 5.*policy-authorised|policy.authorisation.*RISK-POLICY" "$SKILL"
126
- [ "$status" -eq 0 ]
127
- }
128
-
129
- # ──────────────────────────────────────────────────────────────────────────────
130
- # Per-action invocation pattern: orchestrator dedupes by slug
131
- # ──────────────────────────────────────────────────────────────────────────────
132
-
133
- @test "create-risk SKILL.md describes orchestrator dedupe-by-slug pattern" {
134
- run grep -qE "dedupe by slug|dedupe.*slug|once per unique slug" "$SKILL"
135
- [ "$status" -eq 0 ]
136
- }