From 123111bc9d46a3cb1f791515224f80e775fa6430 Mon Sep 17 00:00:00 2001 From: Lacky1234union Date: Sat, 3 Oct 2026 15:02:04 +0300 Subject: [PATCH] test(core): check acute recall after scrub() pipeline Refs #4 Co-Authored-By: Claude Opus 5.5 --- tests/test_safety.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_safety.py b/tests/test_safety.py index cec5c6f..d2cfeb4 100644 --- a/tests/test_safety.py +++ b/tests/test_safety.py @@ -6,6 +6,7 @@ from pathlib import Path import pytest import yaml +from app.core.privacy import scrub from app.core.safety import ( CrisisScript, SafetyResult, @@ -40,6 +41,12 @@ def test_acute_recall_is_100_percent(case: dict) -> None: assert check(ScrubbedText(case["text"])).level == RiskLevel.ACUTE +@pytest.mark.parametrize("case", ACUTE, ids=_ids(ACUTE)) +def test_acute_recall_survives_scrub(case: dict) -> None: + # Real pipeline: scrub() runs first, so PII placeholders must not break crisis detection. + assert check(scrub(case["text"])).level == RiskLevel.ACUTE + + @pytest.mark.parametrize("case", NOT_ACUTE, ids=_ids(NOT_ACUTE)) def test_non_acute_cases_match_label(case: dict) -> None: # Exact level documents the calibration; the hard requirement is "never ACUTE" for these.