verify(P01): code review — quality + security
---ci---
phase: 1
milestone: v0.1
status: verify
requirements:
covered:
- REQ-VOICE-01
- REQ-VOICE-02
- REQ-VOICE-03
- REQ-VOICE-04
- REQ-SCEN-01
- REQ-STATE-01
- REQ-LLM-01
- REQ-LLM-02
- REQ-DEBRIEF-01
- REQ-ORCH-01
- REQ-ORCH-02
- REQ-SCEN-FMT-01
- REQ-NFR-LAT-01
- REQ-NFR-SAFE-01
- REQ-NFR-COST-01
partial:
- REQ-VOICE-03 (live latency number pending keys)
- REQ-LLM-01 (live gemma4:cloud call pending keys)
- REQ-LLM-02 (live deepseek no-think call pending keys)
lessons:
- P0 fix applied: renamed misspelled _DEBRIFF_LEGAL_REDIRECT -> _DEBRIEF_LEGAL_REDIRECT in customer_service guardrail (latent safety-trap; worked at runtime via consistent misspelling + call-time global resolution)
- P0 fix applied: removed dead code line in debrief._load_template (unused 'rel' variable)
- auto-generated tests/test_pending_keys.py (9 tests) for the 2 key-pending exit criteria; skip cleanly without voice-service keys
- 73 passed, 9 skipped, 0 failed; e2e smoke passes
---/ci---
This commit is contained in:
@@ -28,7 +28,6 @@ _DEFAULT_TEMPLATE_DIR = Path(__file__).resolve().parent.parent / "docs" / "debri
|
||||
def _load_template(template_id: str) -> dict[str, str]:
|
||||
"""Load a debrief prompt template by id (e.g. 'debrief/default')."""
|
||||
# template_id is 'debrief/default' → docs/debrief/default.yaml
|
||||
rel = template_id.replace("/", ".") if "/" in template_id else template_id
|
||||
path = _DEFAULT_TEMPLATE_DIR / f"{template_id.split('/')[-1]}.yaml"
|
||||
if not path.exists():
|
||||
# Fallback to the default template.
|
||||
|
||||
@@ -116,11 +116,11 @@ class CustomerServiceGuardrail(Guardrail):
|
||||
@staticmethod
|
||||
def _filter_legal(text: str) -> str:
|
||||
"""Replace legal-action recommendations with a coaching redirect."""
|
||||
return _DEBRIFF_LEGAL_REDIRECT if _DEBRIFF_LEGAL_REDIRECT else text
|
||||
return _DEBRIEF_LEGAL_REDIRECT if _DEBRIEF_LEGAL_REDIRECT else text
|
||||
|
||||
|
||||
# Coaching redirect used when a debrief recommends legal action (D-019).
|
||||
_DEBRIFF_LEGAL_REDIRECT = (
|
||||
_DEBRIEF_LEGAL_REDIRECT = (
|
||||
"Focus your coaching on the learner's communication performance, "
|
||||
"not on advising the customer to take legal action."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user