turnstone/app/services/diagnose
pyr0ball 84e0cf5245 feat: Stage 4 — FalsePositiveSuppressor for multi-agent diagnose pipeline (issue #29)
- Implements FalsePositiveSuppressor using embedding cosine similarity
- Lazy corpus embedding via get_embedder() with module-level cache keyed by db_path
- Cache invalidated automatically when the resolved incident corpus changes
- Suppresses hypotheses with novelty_score below configurable threshold (default 0.85)
- Full fallback path (novelty=1.0, no suppression) when model_id empty, embedding
  service unavailable, or no resolved incidents found in DB
- Graceful handling of missing incidents table and DB query failures
- Numpy bool_ leakage prevented by explicit float()/bool() coercion at assignment
- Pure-Python cosine fallback for environments without numpy
- 9 new tests (all mocked, no real model downloads): passthrough, suppress, no-suppress,
  empty list, ranking, empty corpus, DB failure, service unavailable, cache invalidation
- 350 total tests passing (341 pre-existing + 9 new)

Closes: #29
2026-05-25 14:28:31 -07:00
..
__init__.py fix: frozen dataclasses, clean __all__, improve exception logging in diagnose package 2026-05-25 12:31:07 -07:00
classifier.py feat: Stage 2 — SeverityClassifier for multi-agent diagnose pipeline (issue #29) 2026-05-25 13:27:17 -07:00
hypothesizer.py fix: defensive coercion for LLM confidence and cluster fields in hypothesizer 2026-05-25 14:00:30 -07:00
legacy.py fix: frozen dataclasses, clean __all__, improve exception logging in diagnose package 2026-05-25 12:31:07 -07:00
models.py fix: frozen dataclasses, clean __all__, improve exception logging in diagnose package 2026-05-25 12:31:07 -07:00
pipeline.py feat: Stage 1 — TimelineReconstructor for multi-agent diagnose pipeline (issue #29) 2026-05-25 12:54:15 -07:00
suppressor.py feat: Stage 4 — FalsePositiveSuppressor for multi-agent diagnose pipeline (issue #29) 2026-05-25 14:28:31 -07:00
timeline.py refactor: split TimelineReconstructor.reconstruct into helpers, fix magic number + error handling 2026-05-25 13:22:18 -07:00