Skip to content

Commit 53cd642

Browse files
Sterling Iveyclaude
andcommitted
fix(demo-tamper): ON CONFLICT DO NOTHING instead of INSERT OR IGNORE
Prod ships Postgres; `INSERT OR IGNORE` is SQLite-only and raised a syntax error on the first /demo/tamper hit, which surfaced as a raw 500. Swapped for `ON CONFLICT (entry_id) DO NOTHING` which works identically on both dialects (SQLite 3.24+ + Postgres 9.5+). Verified the audit_log PK is on entry_id so the conflict target is valid. Re-ran tests/test_demo_tamper.py — 8/8 still green on the local SQLite path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 504ce40 commit 53cd642

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

haldir_demo_tamper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,15 @@ def ensure_seeded() -> None:
132132
return
133133
now = time.time()
134134
for r in SEED_ROWS:
135+
# ON CONFLICT DO NOTHING works on SQLite 3.24+ AND Postgres 9.5+.
136+
# "INSERT OR IGNORE" is SQLite-only and raises a syntax error on
137+
# Postgres — bit us on prod before we caught it.
135138
conn.execute(
136-
"INSERT OR IGNORE INTO audit_log "
139+
"INSERT INTO audit_log "
137140
"(entry_id, tenant_id, session_id, agent_id, action, tool, "
138141
" details, cost_usd, timestamp, flagged, prev_hash, entry_hash) "
139-
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, '', ?)",
142+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, '', ?) "
143+
"ON CONFLICT (entry_id) DO NOTHING",
140144
(
141145
r["entry_id"], DEMO_TENANT, r["session_id"],
142146
r["agent_id"], r["action"], r["tool"],

0 commit comments

Comments
 (0)