test: guard enumerated sections against restating their own count #29
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 406 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #29"
general
weight: 0.35
Xander-Xai
Why this is a separate PR
Follow-up to #28. That PR removed a hardcoded
六个问题from the README Interviewer Guide preface because the section lists Q1–Q7. It fixed the instance and left the class unguarded, so this adds the guard.The gap
Every existing check in
scripts/check_repo_consistency.pyvalidates evidence vocabulary, claim boundaries, offline subcommands or metric-series references. None of them cross-check a section's prose against the section's own contents. So the next question added to or removed from that list would drift the same way, silently, and nothing would fail.This is not hypothetical for this repository — the drift shipped in
f9e0aa9and was only caught by reading.What it adds
Two invariants, both derived from the text itself — no hardcoded count, heading name or document list:
1. Contiguous enumeration — an enumeration must be
1..N, so a skipped, duplicated or reordered marker is reported instead of reading as complete.2. No restated count — a section that enumerates must not hardcode how many items it has, in either documented language (
六个问题/7 个问题/six questions).False-positive control
Two deliberate restrictions keep this safe to run across every canonical document:
Q1 ·, so an inline reference or a heading such as## Q12 标准回答ininterview-architecture-baseline.mdis not read as a list item.12 个问题is never inspected.Verified empirically that
README.mdis the only canonical document containingQ<n> markers, and that no canonical document has a count phrase without an enumerator.Proof it catches the original bug
Reintroducing
六个问题on this branch:Deleting a
Q5marker:⚠️ Base branch is intentional
This PR targets
docs/fix-interviewer-guide-count, notmain.The guard correctly fails on
main, becausemainstill says六个问题above Q1–Q7. Merging #28 first makes this branch green without duplicating the one-line fix. Review order: #28 → #29.Scope
scripts/check_repo_consistency.py+tests/test_check_repo_consistency.pyVerification
| Check | Result |
|---|---|
|
python scripts/check_repo_consistency.py|Repository consistency check passed.||
ruff check .|All checks passed!||
ruff format --check .|259 files already formatted||
python -m pytest tests/ -q| 1718 passed, 15 skipped (1709 + exactly these 9 tests) ||
tests/test_check_repo_consistency.py| 322 passed (313 + 9) |