fix(review): quick FT path enforces 3-state exclusivity + twin propagation; changelog + twin caveat

set_false_trigger now clears reviewed_real when flagging false_trigger=True
(mirrors update_event_review's exclusivity), and the quick
PATCH /db/events/{id}/false_trigger endpoint now calls
propagate_review_to_twins after the flag write, matching the sidecar PATCH
path's try/except-with-log.warning pattern. Previously the quick path could
leave both flags set and never touched twins.

Also corrects the v0.25.0 CHANGELOG bullet (exclusivity was not actually
enforced on the quick path until this commit) and adds a caveat comment on
find_twins about rare clamped/saturated-PVS false-positive twin matches.
This commit is contained in:
2026-08-25 00:55:38 +00:00
parent 4a581e0e67
commit 37043a47e9
4 changed files with 74 additions and 10 deletions
+10 -1
View File
@@ -1957,7 +1957,10 @@ def db_set_false_trigger(
value: bool = Query(..., description="True to flag as false trigger, False to clear"),
) -> dict:
"""
Set or clear the false_trigger flag on a single event.
Set or clear the false_trigger flag on a single event. Enforces the
same 3-state exclusivity as the sidecar review PATCH (flagging false_trigger
clears reviewed_real) and propagates the resulting flags to the event's
histogram/waveform twin(s), same as the sidecar path.
Used by the terra-view event review UI.
Returns 404 if the event_id is not found.
@@ -1965,6 +1968,12 @@ def db_set_false_trigger(
found = _get_db().set_false_trigger(event_id, value)
if not found:
raise HTTPException(status_code=404, detail=f"Event {event_id} not found")
try:
_get_db().propagate_review_to_twins(event_id)
except Exception as exc:
log.warning("twin review-propagation failed for %s: %s", event_id, exc)
return {"status": "ok", "event_id": event_id, "false_trigger": value}