fix(intent): mirror 'expired' status predicate in roux_ingest ON CONFLICT - #117
Conversation
…LICT PR #115 / migration 0018 added `AND status <> 'expired'` to the partial unique index `cc_intents_roux_ingest_message_id_uidx` but did not update the upsert's ON CONFLICT WHERE clause in createRouxIngestIntentIdempotent. PostgreSQL requires predicate equality to match an index to ON CONFLICT — the mismatch caused the upsert to fail with "no unique or exclusion constraint matching the ON CONFLICT specification", breaking the Roux ingest path. Verified against a fresh Neon branch: - pre-fix: SQLSTATE 42P10 (no matching constraint) - post-fix: ON CONFLICT resolves cleanly to the index Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesRoux ingest conflict predicate
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
To use Codex here, create a Codex account and connect to github. |
Summary
PR #115 / migration
0018_intent_decay.sqladdedAND status <> 'expired'to the partial unique indexcc_intents_roux_ingest_message_id_uidxbut did not update the matching ON CONFLICT WHERE clause increateRouxIngestIntentIdempotent(meta/intent.ts).PostgreSQL requires predicate equality between the index and the ON CONFLICT clause — the drift caused the upsert to fail with
42P10: there is no unique or exclusion constraint matching the ON CONFLICT specification, breaking the Roux ingest path.Change
One-line addition to the WHERE clause:
ON CONFLICT ((payload->'source'->>'message_id')) WHERE intent_type = 'roux_ingest' AND payload->'source'->>'message_id' IS NOT NULL + AND status <> 'expired' DO NOTHINGValidation
Verified against a fresh Neon branch (
br-curly-art-akoofx5s) on projectcool-bar-13270800:NeonDbError: there is no unique or exclusion constraint matching the ON CONFLICT specification(SQLSTATE 42P10)Note on workspace-studio-ingest tests
The 4 failing tests in
tests/routes/workspace-studio-ingest.spec.tsfail withError: This context has no ExecutionContext(Honoc.executionCtx.waitUntilin test env) — this is an unrelated test-infra issue, not the ON CONFLICT bug. The same 4 tests fail onmainand on this branch with the fix applied (7/11 pass in both cases). Scope of this PR is intentionally limited to the predicate mirror per instructions; the executionCtx issue can be addressed separately.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit