security: finalize interview-readiness RAG trust boundaries and repository truth #25
All Vouch review confidence checks passed
Residual risk 0.32 = Change Risk (0.75) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #25"
general
weight: 0.35
Xander-Xai
Refs #24
Why
This PR is the integration surface for Issue #24: a bounded enterprise-RAG security hardening pass plus repository-truth reconciliation. The documentation/evidence layer has now had its final cross-file audit, and CI status is established on the branch head, so it is ready for review.
Implemented on this branch
RESERVED_TRUST_BOUNDARY_MARKERS, six structural markers) across retrieved evidence, current user input, replayed conversation history and continuation assistant prefixes;extra_claimsshadow the claims it owns (_ACCESS_TOKEN_RESERVED_CLAIMS);rag:l2:rm:{role}:dm:{dept}:{key}), with no fallback read of legacy unscoped keys —tests/test_cache.py::test_no_legacy_unscoped_fallback;These controls are defense-in-depth. They do not claim prompt injection is solved, the model is jailbreak-proof, or RBAC is fully validated in production.
docs/security-regression-coverage.mdstates each control's boundary and the gap that remains open, and no guardrail framework was added to satisfy the checklist.Reconciled before Ready for Review
docs/interview-evidence-map.mdanddocs/repository-truth-audit.md;docs/README.mdcarries an inventory that must equal the canonical taxonomy.QdrantClient(":memory:")coverage, and neither direction is asserted alone.git diff --checkand Compose validation on the final head.Final cross-file audit corrections (documentation only, no code and no number changed)
docs/security-regression-coverage.mdrow B no longer claims byte fidelity for ingested text; the cited normalizer rewrites newlines and strips, and ingestion size-caps.tests/test_retrieval_authorization_contract.py:28already covers.PRD.mdlabels the KV per-token figure a model estimate rather than a measurement; no benchmark artifact exists and the vLLM topology has never been executed here.docs/slo-runbook.mdno longer points the SLO-3 follow-up at closed Issue #20; it points at the audit's open external-validation tracker map.Reconciliation lineage guard, and the parser bug that made it self-satisfying
COMPLETED_RECONCILIATION_ISSUES = (16, 20, 22)andCURRENT_RECONCILIATION_ISSUE = 24were already present on this branch, together with the "Reconciliation lineage invariants" section in the audit. What was not equivalent was the tracker-bullet parser those guards read through._tracker_bullets()split the## External validation tracker mapsection at list markers only. The section also contains three closing notes (Closing #20 being completed records ...,Closing #16 records ...,Closing #22 likewise records ...) as trailing prose paragraphs, so all three were glued onto whichever bullet preceded them — the #12 row.That made the lineage guard satisfiable by the note it was meant to police. Deleting the
- [#22] ... reconciliation: completed, delivered by PR #23.row left the glued noteClosing #22 likewise records only that ... was deliveredas the only bullet mentioning#22. It contains neither a_COMPLETED_MARKER_REtoken (closed|completed|merged|resolved) nor a_CURRENT_SCOPE_REmatch, soaudit_tracker_errors()returned[]— a tracker map that had lost a completed reconciliation row passed the check written to catch exactly that. Measured on the pre-fix head:The fix is in the parser, not the guard: a bullet is the contiguous run of non-blank lines that starts at a list marker, so trailing prose belongs to no bullet (
scripts/check_repo_consistency.py:_tracker_bullets). Both rows are now caught with their intended messages:Five tests pin the behaviour:
test_audit_tracker_keeps_completed_reconciliation_off_the_current_scope,test_audit_tracker_requires_the_current_reconciliation_issue_to_be_recorded,test_reconciliation_lineage_is_not_pinned_to_a_pr_number,test_completed_reconciliation_issues_must_stay_in_the_tracker_map,test_audit_tracker_bullets_stop_at_a_blank_line.Only that parser change and its tests were taken from
chore/governance-lineage-22-24; no other commit from that branch is on this one._BULLET_SPLIT_REalso matching at the\nbefore a bullet is pre-existing and left alone.Verification on final head
336e325All rows below were executed on this head, not carried over from an earlier candidate.
| Gate | Result |
|---|---|
|
python scripts/check_repo_consistency.py|Repository consistency check passed.||
python -m pytest --collect-only -q| 1724 collected ||
python -m pytest tests/ -q| 1709 passed, 15 skipped (1724 total) ||
ruff check .|All checks passed!||
ruff format --check .| 259 files already formatted ||
python -m compileall -q .| clean (exit 0) ||
git diff --check(worktree andmain...HEAD) | clean || Compose:
docker-compose.ymlalone | valid || Compose: base + each of gpu / cpu / microservices / observability | valid (all 4) |
| Compose: base + all four overlays together | valid |
| Compose: observability overlay is purely additive | passes CI's own assertion — added
grafana jaeger prometheus, removed none ||
frontend:npm ci+npm run build| 149 packages installed; build succeeded, 188 modules,index.js282.60 kB (gzip 88.00 kB) || GitHub Actions on
336e325| CI — 测试success, Security — 依赖安全扫描success, Lint — 代码风格success|Compose was validated with the
.env.examplevariables exported; without them every stack fails fast on a required variable (SERVICE_AUTH_TOKEN,MINIO_ACCESS_KEY, ...), which is intended. Thegpu,cpuandmicroservicesoverlays are not valid standalone — they need the base file for theappservice andrag-network— whileobservability.ymlhappens to validate alone. That matches CI, which only ever layers it.npm cistill reports the 4 advisories already disclosed indocs/repository-truth-audit.md— 1 moderatebaseline-browser-mapping, 3 high (browserslist,nanoid,postcss) — confirmed againstnpm auditon this head. Remediation is open work, not a gate.Evidence boundaries that must remain unchanged without new external evidence
HISTORICAL_PRODUCTION; they are not repository benchmark results.Scope guard
No Kubernetes/Helm, Kafka, GraphRAG, Agent/MCP feature addition, microservice rewrite, vector-store migration, SSO/OIDC platform build, or invented benchmark/quality/performance result in this PR.