YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(meetings): match open-meeting 409 on index name, not column
Louis Beaumont6bda9d465373
diff --git a/crates/screenpipe-db/src/migrations/20260603000000_one_open_meeting_invariant.sql b/crates/screenpipe-db/src/migrations/20260603000000_one_open_meeting_invariant.sqlindex 300669680..2fe6747b1 100644--- a/crates/screenpipe-db/src/migrations/20260603000000_one_open_meeting_invariant.sql+++ b/crates/screenpipe-db/src/migrations/20260603000000_one_open_meeting_invariant.sql@@ -20,7 +20,10 @@-- 2. Creates a partial unique index that makes a second open row-- impossible going forward. Any future regression in the detector,-- the API handler, or a pipe will surface as `UNIQUE constraint--- failed: meetings.meeting_end` instead of a silent UI duplicate.+-- failed: index 'idx_meetings_single_open'` instead of a silent UI+-- duplicate. Note SQLite names the *index* (not a column) in the error+-- for an expression index like this one — code that maps the failure to+-- 409 must match on the index name, not `meetings.meeting_end`.UPDATE meetingsSET meeting_end = strftime('%Y-%m-%dT%H:%M:%fZ', 'now'),diff --git a/crates/screenpipe-engine/src/routes/meetings.rs b/crates/screenpipe-engine/src/routes/meetings.rsindex 35c30a6ca..d74de406c 100644--- a/crates/screenpipe-engine/src/routes/meetings.rs+++ b/crates/screenpipe-engine/src/routes/meetings.rs@@ -607,8 +607,17 @@ pub(crate) async fn start_meeting_handler(// UNIQUE constraint failure. Map it to 409 Conflict so the// client knows to refresh status and retry, instead of// surfacing a generic 500.+ //+ // SQLite reports an expression-index violation by the index+ // name, not a column: `UNIQUE constraint failed: index+ // 'idx_meetings_single_open'`. Match on the index name so this+ // keeps working if columns change — `meetings.meeting_end`+ // would never match (NULLs are distinct, which is why the+ // index is on the constant expression `(1)` in the first place).let msg = e.to_string();- if msg.contains("UNIQUE constraint failed") && msg.contains("meetings") {+ if msg.contains("UNIQUE constraint failed")+ && msg.contains("idx_meetings_single_open")+ {(StatusCode::CONFLICT,JsonResponse(json!({