diff --git a/backend-compliance/compliance/api/agent_compliance_check_routes.py b/backend-compliance/compliance/api/agent_compliance_check_routes.py index 874ab48e..d135eca2 100644 --- a/backend-compliance/compliance/api/agent_compliance_check_routes.py +++ b/backend-compliance/compliance/api/agent_compliance_check_routes.py @@ -237,12 +237,15 @@ async def _run_compliance_check(check_id: str, req: ComplianceCheckRequest): # Apply profile context filter result = _apply_profile_filter(result, profile, doc_type) - # Add placement findings (doc found in wrong location) - for pf in placement_findings: - if pf.get("doc_type") == doc_type: - result.checks.insert(0, CheckItem(**{ - k: v for k, v in pf.items() if k != "doc_type" - })) + # Add placement findings — but only if the regex checks confirm + # the text doesn't match. If completeness >= 50%, the text IS the + # right doc_type despite missing cross-search keywords. + if result.completeness_pct < 50: + for pf in placement_findings: + if pf.get("doc_type") == doc_type: + result.checks.insert(0, CheckItem(**{ + k: v for k, v in pf.items() if k != "doc_type" + })) results.append(result) total_findings += result.findings_count