fix(drift): dedupe semantic fingerprint repeats
This commit is contained in:
@@ -18,7 +18,14 @@ import structlog
|
||||
from sqlalchemy import text
|
||||
|
||||
from src.db.base import get_db_context
|
||||
from src.models.drift import DriftInterpretation, DriftIntent, DriftItem, DriftLevel, DriftReport, DriftStatus
|
||||
from src.models.drift import (
|
||||
DriftIntent,
|
||||
DriftInterpretation,
|
||||
DriftItem,
|
||||
DriftLevel,
|
||||
DriftReport,
|
||||
DriftStatus,
|
||||
)
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
@@ -167,7 +174,12 @@ class DriftReportRepository:
|
||||
{"report_id": report_id, "narrative": narrative},
|
||||
)
|
||||
|
||||
async def get_repeat_state(self, report: DriftReport) -> dict:
|
||||
async def get_repeat_state(
|
||||
self,
|
||||
report: DriftReport,
|
||||
*,
|
||||
include_values: bool = True,
|
||||
) -> dict:
|
||||
"""Return stable fingerprint repeat state for a drift report."""
|
||||
from src.services.drift_repeat_state import build_drift_repeat_state
|
||||
|
||||
@@ -190,7 +202,11 @@ class DriftReportRepository:
|
||||
{"namespace": report.namespace},
|
||||
)
|
||||
rows = [dict(row) for row in result.mappings().all()]
|
||||
return build_drift_repeat_state(report, rows)
|
||||
return build_drift_repeat_state(
|
||||
report,
|
||||
rows,
|
||||
include_values=include_values,
|
||||
)
|
||||
|
||||
|
||||
_drift_repo: DriftReportRepository | None = None
|
||||
|
||||
Reference in New Issue
Block a user