@windyroad/risk-scorer 0.12.0 → 0.12.2-preview.539

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.12.0"
313
+ "version": "0.12.2"
314
314
  }
@@ -171,7 +171,7 @@ _write_matching_hash() {
171
171
 
172
172
  @test "Band B with no hash file: passes but does NOT slide (no invariance proof)" {
173
173
  printf '3' > "$SCORE_FILE"
174
- _backdate "$SCORE_FILE" 3
174
+ _backdate "$SCORE_FILE" 2
175
175
  rm -f "$HASH_FILE"
176
176
  BEFORE_MTIME=$(_mtime "$SCORE_FILE")
177
177
  sleep 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/risk-scorer",
3
- "version": "0.12.0",
3
+ "version": "0.12.2-preview.539",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "bin": {
6
6
  "windyroad-risk-scorer": "./bin/install.mjs"
@@ -306,6 +306,39 @@ EOF
306
306
  [ -f docs/risks/R002-good-line.active.md ]
307
307
  }
308
308
 
309
+ @test "P309/P171 — three unrepresented slugs drain to three register files + queue truncated" {
310
+ # P309 regression coverage (fold-fixed by P171, commit 9e91508).
311
+ # Replays the original P309 observation: a 3-entry queue with three slugs
312
+ # that have no matching docs/risks/ register file. Prior to the P171 fix,
313
+ # this returned entries_drained=0 / new_risks_created=0 / next_action=none
314
+ # AND did not truncate the queue — entries accumulated indefinitely off-
315
+ # ledger. Post-fix, the drain MUST materialise all three register files,
316
+ # truncate the queue, and emit next_action=commit-staged.
317
+ rm -f docs/risks/TEMPLATE.md
318
+ cat > .afk-run-state/risk-register-queue.jsonl <<EOF
319
+ {"ts":"2026-05-24T10:00:00Z","session_id":"s1","report_path":".risk-reports/2026-05-24-r1.md","reason_tag":"above-appetite-residual","risk_slug":"p309-unrepresented-slug-a","slug_source":"agent","prefill":"First unrepresented slug — should mint a new register entry."}
320
+ {"ts":"2026-05-25T10:00:00Z","session_id":"s2","report_path":".risk-reports/2026-05-25-r2.md","reason_tag":"above-appetite-residual","risk_slug":"p309-unrepresented-slug-b","slug_source":"agent","prefill":"Second unrepresented slug — should mint a second new register entry."}
321
+ {"ts":"2026-05-25T11:00:00Z","session_id":"s2","report_path":".risk-reports/2026-05-25-r3.md","reason_tag":"above-appetite-residual","risk_slug":"p309-unrepresented-slug-c","slug_source":"agent","prefill":"Third unrepresented slug — should mint a third new register entry."}
322
+ EOF
323
+ run bash "$SCRIPT" "$WORK_DIR"
324
+ [ "$status" -eq 0 ]
325
+ echo "$output" | grep -q '^entries_drained=3$'
326
+ echo "$output" | grep -q '^new_risks_created=3$'
327
+ echo "$output" | grep -q '^evidence_appended=0$'
328
+ echo "$output" | grep -q '^next_action=commit-staged$'
329
+ # Three register files materialised with sequential IDs (R002, R003, R004
330
+ # because R001 is in the seeded README fixture).
331
+ [ -f docs/risks/R002-p309-unrepresented-slug-a.active.md ]
332
+ [ -f docs/risks/R003-p309-unrepresented-slug-b.active.md ]
333
+ [ -f docs/risks/R004-p309-unrepresented-slug-c.active.md ]
334
+ # Queue truncated — entries no longer accumulate off-ledger.
335
+ [ ! -s .afk-run-state/risk-register-queue.jsonl ]
336
+ # README Register table picks up all three new rows.
337
+ grep -q 'R002-p309-unrepresented-slug-a' docs/risks/README.md
338
+ grep -q 'R003-p309-unrepresented-slug-b' docs/risks/README.md
339
+ grep -q 'R004-p309-unrepresented-slug-c' docs/risks/README.md
340
+ }
341
+
309
342
  @test "drain succeeds against canonical (post-wipe) docs/risks/ with NO TEMPLATE.md (P171)" {
310
343
  # P171 regression coverage. The 2026-05-04 wipe direction (commit 8edaf7b)
311
344
  # removed TEMPLATE.md from canonical docs/risks/; commit 9b52610 then re-