fix(db): add the orb_reuse_counters conflict key to the self-host Postgres dialect translator - #8930
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…tgres dialect translator REPLACE_CONFLICT_KEYS requires an entry for every table used with INSERT OR REPLACE, or translateInsertOr throws "no known conflict key". Migration 0177 added orb_reuse_counters with a real INSERT OR REPLACE writer in src/orb/ingest.ts, but the map entry was missing, so a self-hosted Postgres instance's hourly ORB export threw on its first orb_reuse_counters write. Add `orb_reuse_counters: ["instance_id", "day"]`, matching the table's PRIMARY KEY. Closes JSONbored#8893 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8930 +/- ##
==========================================
- Coverage 93.84% 90.57% -3.28%
==========================================
Files 803 97 -706
Lines 80084 22531 -57553
Branches 24277 3890 -20387
==========================================
- Hits 75157 20408 -54749
+ Misses 3562 1945 -1617
+ Partials 1365 178 -1187
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 13:55:31 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
REPLACE_CONFLICT_KEYSinsrc/selfhost/pg-dialect.tsrequires an entry for every table used withINSERT OR REPLACE, ortranslateInsertOrthrowspg_dialect: INSERT OR REPLACE into '<table>' has no known conflict key. Migration0177_orb_reuse_counters.sqladdedorb_reuse_counterswith a realINSERT OR REPLACEwriter insrc/orb/ingest.ts, but the matching map entry was never added — so aself-hosted Postgres instance's hourly ORB export threw on its first
orb_reuse_counterswrite.Adds
orb_reuse_counters: ["instance_id", "day"], matching the table'sPRIMARY KEY (instance_id, day).Test plan
translateInsertOron the verbatimorb/ingest.tsstatement succeeds and producesON CONFLICT (instance_id, day) DO UPDATE SETwith key columns excluded from the SET listtranslateInsertOrthrow "no known conflict key" and the test failsnpx vitest run test/unit/selfhost-pg-dialect.test.ts— 24/24 pass;tsc --noEmitcleanCloses #8893