From 187b8c15003f2e41b998500ea6b93a93ef84f16c Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Fri, 28 Aug 2026 02:43:21 -0400 Subject: [PATCH] Declare and create the calls(system_id, started_at) index dedup needs Dedup was failing on essentially every inbound call in production. dedup.py queries system_id == X with a started_at range; that composite index was neither declared in firestore.indexes.json nor present in the live c2-server database, so the query returned FAILED_PRECONDITION, dedup swallowed it as a warning, and every duplicate check degraded to "not a duplicate". While AI is off that only cost duplicate call documents. With a window open it would have paid Whisper and Gemini twice for every double-heard transmission, and fed Gate B5's cost measurement a figure that is wrong for a reason unrelated to the pipeline being measured. Two documents for one transmission is also the exact input shape that produces a spurious second incident. The index is created on c2-server and building. This declares it in source so the file and the live database agree. Refs server-26#84, #33, #45. Co-Authored-By: Claude Opus 5 --- infra/firestore/firestore.indexes.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/infra/firestore/firestore.indexes.json b/infra/firestore/firestore.indexes.json index 3a8216c..3308fb7 100644 --- a/infra/firestore/firestore.indexes.json +++ b/infra/firestore/firestore.indexes.json @@ -30,6 +30,15 @@ { "fieldPath": "ended_at", "order": "ASCENDING" } ] }, + { + "//": "c2-core internal/dedup.py:84 — system_id == X AND started_at within a +/- window. Was live-failing on essentially every inbound call (server-26#84): dedup caught the FAILED_PRECONDITION and degraded to \"not a duplicate\", so double-heard transmissions were stored twice and would have been transcribed and correlated twice the moment an AI window opened. Created directly on c2-server 2026-08-28.", + "collectionGroup": "calls", + "queryScope": "COLLECTION", + "fields": [ + { "fieldPath": "system_id", "order": "ASCENDING" }, + { "fieldPath": "started_at", "order": "ASCENDING" } + ] + }, { "//": "c2-core internal/vocabulary_learner.py:290 — system_id == X AND ended_at >= cutoff. Backend only; was live but undeclared until 2026-08-23.", "collectionGroup": "calls",