feat(ttp): implement evidence-shape validation and confidence range constraint

- TolerantTagger.tag validates evidence keys against EVIDENCE_SCHEMA TypedDicts;
  TypeError (programmer error) propagates instead of being swallowed
- IntelEvidence and EmailEvidence expanded from stubs to full per-provider
  key sets (total=False); IntelEvidence old stub fields replaced wholesale
- EVIDENCE_SCHEMA map added to models/ttp.py and imported by base.py
- TTPTag __table_args__ gains confidence [0,1] CheckConstraint (DB-enforced)
- xfail removed from test_confidence_outside_range_rejected_at_insert and
  test_evidence_shape_violation_propagates_as_typeerror — both now pass
- TypeError removed from _SWALLOWED_EXCS fuzz list; test_intel_evidence_keys
  updated to assert the real provider key set
This commit is contained in:
2026-05-10 07:56:52 -04:00
parent a8f6a28f3a
commit 39518e33b4
5 changed files with 92 additions and 16 deletions

View File

@@ -169,7 +169,6 @@ def test_guard_runs_before_super_init() -> None:
# ── confidence range guard (impl phase) ─────────────────────────────
@pytest.mark.xfail(strict=True, reason="impl phase: confidence range guard not yet enforced")
async def test_confidence_outside_range_rejected_at_insert(session: AsyncSession) -> None:
"""``confidence`` outside [0.0, 1.0] must be rejected. The contract
schema currently types it as bare ``float`` without a range