@windyroad/risk-scorer 0.11.2 → 0.11.3-preview.472

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.
@@ -310,5 +310,5 @@
310
310
  }
311
311
  },
312
312
  "name": "wr-risk-scorer",
313
- "version": "0.11.2"
313
+ "version": "0.11.3"
314
314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/risk-scorer",
3
- "version": "0.11.2",
3
+ "version": "0.11.3-preview.472",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "bin": {
6
6
  "windyroad-risk-scorer": "./bin/install.mjs"
@@ -48,7 +48,6 @@ set -uo pipefail
48
48
  PROJECT_ROOT="${1:-$(pwd)}"
49
49
  QUEUE_FILE="${PROJECT_ROOT}/.afk-run-state/risk-register-queue.jsonl"
50
50
  RISKS_DIR="${PROJECT_ROOT}/docs/risks"
51
- TEMPLATE_FILE="${RISKS_DIR}/TEMPLATE.md"
52
51
  README_FILE="${RISKS_DIR}/README.md"
53
52
 
54
53
  emit_no_op() {
@@ -63,7 +62,7 @@ if [ ! -f "$QUEUE_FILE" ] || [ ! -s "$QUEUE_FILE" ]; then
63
62
  exit 0
64
63
  fi
65
64
 
66
- if [ ! -d "$RISKS_DIR" ] || [ ! -f "$TEMPLATE_FILE" ] || [ ! -f "$README_FILE" ]; then
65
+ if [ ! -d "$RISKS_DIR" ] || [ ! -f "$README_FILE" ]; then
67
66
  emit_no_op
68
67
  exit 0
69
68
  fi
@@ -80,7 +79,7 @@ ORIGIN_MAX="${ORIGIN_MAX:-0}"
80
79
  # so R099 → 099 → "value too great for base" without the 10# prefix.
81
80
  NEXT_ID=$(( (10#$LOCAL_MAX > 10#$ORIGIN_MAX ? 10#$LOCAL_MAX : 10#$ORIGIN_MAX) + 1 ))
82
81
 
83
- DRAIN_RESULT=$(python3 - "$QUEUE_FILE" "$RISKS_DIR" "$TEMPLATE_FILE" "$README_FILE" "$NEXT_ID" "$PROJECT_ROOT" <<'PYEOF'
82
+ DRAIN_RESULT=$(python3 - "$QUEUE_FILE" "$RISKS_DIR" "$README_FILE" "$NEXT_ID" "$PROJECT_ROOT" <<'PYEOF'
84
83
  import json
85
84
  import os
86
85
  import re
@@ -88,7 +87,7 @@ import sys
88
87
  from collections import OrderedDict
89
88
  from datetime import datetime
90
89
 
91
- queue_file, risks_dir, template_file, readme_file, next_id_str, project_root = sys.argv[1:7]
90
+ queue_file, risks_dir, readme_file, next_id_str, project_root = sys.argv[1:6]
92
91
  next_id = int(next_id_str)
93
92
 
94
93
  hints = []
@@ -121,7 +120,7 @@ for h in hints:
121
120
 
122
121
  existing = {}
123
122
  for fn in os.listdir(risks_dir):
124
- if fn in ('README.md', 'TEMPLATE.md'):
123
+ if fn == 'README.md':
125
124
  continue
126
125
  m = re.match(r'^R(\d+)-(.+)\.active\.md$', fn)
127
126
  if m:
@@ -18,33 +18,13 @@ setup() {
18
18
  git config user.email "drain-test@example.com"
19
19
  git config user.name "Drain Test"
20
20
  git commit --quiet --allow-empty -m "init"
21
- # Mock template + README + a single seeded R-file
22
- # NOTE: TEMPLATE.md was wiped from canonical docs/risks/ per the 2026-05-04
23
- # user direction ("FFS WIPE THE RXXX risks ... THEY ARE WRONG"; commit 8edaf7b).
24
- # The drain script (ADR-056 Phase 2b) still gates on TEMPLATE.md existence at
25
- # line 66 and accepts the path as an unused argument; the gate is vestigial
26
- # but unchanged in this iter. Tests synthesise fixture-local TEMPLATE.md +
27
- # an old-shape R001-...active.md inline so the drain contract is exercised
28
- # end-to-end without depending on the canonical (post-wipe) state. The
29
- # divergence between the drain script's expected R-file shape (.active.md
30
- # with structured frontmatter) and the canonical post-wipe R-file shape
31
- # (bare .md without status frontmatter, slug-only body) is captured as P171
32
- # (docs/problems/171-drain-register-queue-script-and-tests-reference-
33
- # obsolete-pre-wipe-r-file-shape.open.md). This synthetic-fixture pattern
34
- # is the workaround until P171's fix lands.
21
+ # Seed README + a single R-file fixture matching the canonical .active.md
22
+ # shape. P171 resolved 2026-05-31: drain script's vestigial TEMPLATE.md gate
23
+ # was removed (it was a pre-wipe-direction residual). Canonical docs/risks/
24
+ # has NO TEMPLATE.md per the 2026-05-04 user direction (commit 8edaf7b) +
25
+ # the canonical .active.md suffix per commit 9b52610. Seeded R-file uses the
26
+ # canonical shape; tests no longer synthesize a fixture-local TEMPLATE.md.
35
27
  mkdir -p docs/risks .afk-run-state
36
- cat > docs/risks/TEMPLATE.md <<'TEMPLATE_EOF'
37
- # Risk RNNN: <title>
38
-
39
- **Status**: Active
40
- **Category**: <category>
41
- **Identified**: <YYYY-MM-DD>
42
- **Owner**: <owner>
43
-
44
- ## Description
45
-
46
- <description>
47
- TEMPLATE_EOF
48
28
  cp "$REPO_ROOT/docs/risks/README.md" docs/risks/README.md
49
29
  cat > docs/risks/R001-confidential-info-leak-via-public-repo-push.active.md <<'R001_EOF'
50
30
  # Risk R001: Confidential info leak via public repo push
@@ -325,3 +305,22 @@ EOF
325
305
  echo "$output" | grep -q '^new_risks_created=1$'
326
306
  [ -f docs/risks/R002-good-line.active.md ]
327
307
  }
308
+
309
+ @test "drain succeeds against canonical (post-wipe) docs/risks/ with NO TEMPLATE.md (P171)" {
310
+ # P171 regression coverage. The 2026-05-04 wipe direction (commit 8edaf7b)
311
+ # removed TEMPLATE.md from canonical docs/risks/; commit 9b52610 then re-
312
+ # canonicalized the R-file suffix to .active.md. The drain script previously
313
+ # gated on TEMPLATE.md existence and would silent-no-op against the canonical
314
+ # (TEMPLATE.md-absent) state. This test asserts the gate is gone: a queue with
315
+ # one hint MUST materialize a register entry even without TEMPLATE.md.
316
+ rm -f docs/risks/TEMPLATE.md
317
+ cat > .afk-run-state/risk-register-queue.jsonl <<EOF
318
+ {"ts":"2026-05-03T14:00:00Z","session_id":"s1","report_path":".risk-reports/p171.md","reason_tag":"above-appetite-residual","risk_slug":"p171-canonical-fire","slug_source":"agent","prefill":"Canonical post-wipe drain works without TEMPLATE.md."}
319
+ EOF
320
+ run bash "$SCRIPT" "$WORK_DIR"
321
+ [ "$status" -eq 0 ]
322
+ echo "$output" | grep -q '^entries_drained=1$'
323
+ echo "$output" | grep -q '^new_risks_created=1$'
324
+ echo "$output" | grep -q '^next_action=commit-staged$'
325
+ [ -f docs/risks/R002-p171-canonical-fire.active.md ]
326
+ }