fix(review-loop-run): counts parses count-by-severity block with scope + format branches (2026-09-13 fix, 40/40 tests)
Was live via ~/sbin symlink but never committed. Baseline for bug 5352fe72. Claude-Session: https://claude.ai/code/session_01G3SkMRBRWXyiGuMGs8WVas
This commit is contained in:
10
tests/fixtures/review-loop-run/bullet-list.md
vendored
Normal file
10
tests/fixtures/review-loop-run/bullet-list.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Review
|
||||
|
||||
Some findings above.
|
||||
|
||||
## Summary
|
||||
|
||||
- CRITICAL: 0
|
||||
- HIGH: 1
|
||||
- MEDIUM: 2
|
||||
- LOW: 0
|
||||
16
tests/fixtures/review-loop-run/heading-numbers.md
vendored
Normal file
16
tests/fixtures/review-loop-run/heading-numbers.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Review
|
||||
|
||||
## Finding 3 — HTTP 404 on /widgets
|
||||
|
||||
### MEDIUM: endpoint returns wrong status
|
||||
|
||||
Some prose mentioning 42 and HIGH severity inline that is not a real count.
|
||||
|
||||
## Count by severity
|
||||
|
||||
| Severity | Count |
|
||||
|----------|-------|
|
||||
| CRITICAL | 0 |
|
||||
| HIGH | 0 |
|
||||
| MEDIUM | 1 |
|
||||
| LOW | 0 |
|
||||
5
tests/fixtures/review-loop-run/inline-bold.md
vendored
Normal file
5
tests/fixtures/review-loop-run/inline-bold.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Review
|
||||
|
||||
## Count by severity
|
||||
|
||||
CRITICAL: 0. **HIGH**: 2. MEDIUM: 0. LOW: 0.
|
||||
15
tests/fixtures/review-loop-run/no-count-block.md
vendored
Normal file
15
tests/fixtures/review-loop-run/no-count-block.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Review
|
||||
|
||||
### CRITICAL: auth bypass on /admin
|
||||
|
||||
Detailed explanation of the bypass.
|
||||
|
||||
### HIGH: missing input validation
|
||||
|
||||
Detailed explanation.
|
||||
|
||||
### HIGH: race condition in worker pool
|
||||
|
||||
Detailed explanation.
|
||||
|
||||
No explicit count-by-severity section is present in this file.
|
||||
10
tests/fixtures/review-loop-run/table.md
vendored
Normal file
10
tests/fixtures/review-loop-run/table.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Review
|
||||
|
||||
## Count by severity
|
||||
|
||||
| Severity | Count |
|
||||
|----------|-------|
|
||||
| CRITICAL | 0 |
|
||||
| HIGH | 0 |
|
||||
| MEDIUM | 1 |
|
||||
| LOW | 3 |
|
||||
@@ -58,6 +58,28 @@ printf '## CRITICAL findings\n### C1 CRITICAL x\n### H1 HIGH y\n' > "$TMP/heads.
|
||||
out=$("$SCRIPT" counts "$TMP/heads.md"); rc=$?
|
||||
assert_exit "heading fallback exits 4" 4 "$rc"
|
||||
|
||||
FIXTURES="$REPO_ROOT/tests/fixtures/review-loop-run"
|
||||
out=$("$SCRIPT" counts "$FIXTURES/bullet-list.md"); rc=$?
|
||||
assert_exit "bullet-list block exits 4" 4 "$rc"
|
||||
assert_contains "bullet-list counts" "CRITICAL=0 HIGH=1 MEDIUM=2 LOW=0" "$out"
|
||||
|
||||
out=$("$SCRIPT" counts "$FIXTURES/table.md"); rc=$?
|
||||
assert_exit "table block exits 0" 0 "$rc"
|
||||
assert_contains "table counts" "CRITICAL=0 HIGH=0 MEDIUM=1 LOW=3" "$out"
|
||||
|
||||
out=$("$SCRIPT" counts "$FIXTURES/inline-bold.md"); rc=$?
|
||||
assert_exit "inline bold exits 4" 4 "$rc"
|
||||
assert_contains "inline bold counts" "CRITICAL=0 HIGH=2 MEDIUM=0 LOW=0" "$out"
|
||||
|
||||
out=$("$SCRIPT" counts "$FIXTURES/heading-numbers.md"); rc=$?
|
||||
assert_exit "heading with HTTP 404 exits 0" 0 "$rc"
|
||||
assert_contains "heading-numbers ignores 404/42, uses own count block" "CRITICAL=0 HIGH=0 MEDIUM=1 LOW=0" "$out"
|
||||
|
||||
out=$("$SCRIPT" counts "$FIXTURES/no-count-block.md"); rc=$?
|
||||
assert_exit "no count block derives, exits 4" 4 "$rc"
|
||||
assert_contains "no count block counts" "CRITICAL=1 HIGH=2 MEDIUM=0 LOW=0" "$out"
|
||||
assert_contains "no count block marked derived" "(derived)" "$out"
|
||||
|
||||
echo "review-loop-run — status"
|
||||
printf 'x\nexit=0\n' > "$REVIEW_LOOP_RUN_DIR/t-r1-stdout.txt"
|
||||
out=$("$SCRIPT" status --name t 2>&1); rc=$?
|
||||
|
||||
Reference in New Issue
Block a user