Skip to content

fix(errors): chunk the error tick's bulk statements under the bind-parameter cap - #1271

Merged
JeremyFunk merged 2 commits into
mainfrom
fix/error-tick-chunk-bulk-writes
Oct 6, 2026
Merged

JeremyFunk merged 2 commits into
mainfrom
fix/error-tick-chunk-bulk-writes

fix(errors): set lookup for resolved incidents, assert every chunk la…

0b92935
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 6, 2026 in 4m 12s

Confidence 4/5 · No issues found

🟢 Confidence 4/5 · likely safe to merge
The chunked writes rely on Effect.forEach running raw drizzle query values, which is what the new 3,100-row test verifies end to end; otherwise the transformation is mechanical.
quality 100/100 · no findings · tests covered · risk medium

persistErrorTickWindow now runs every bulk read and write in 500-row chunks inside the same transaction, so a window past the 32,767 bind-parameter cap commits and the cursor advances instead of failing forever. The transformation is mechanical and I found no defect.

  • inChunks/chunks wrap each bulk statement in persistErrorTickWindow (candidate, issue, state, incident, event, outbox writes)
  • Duplicate conflict targets stay impossible per statement because mergeScanRows deduplicates by fingerprint first
  • incidentsResolved now counts distinct flipped ids from the chunked RETURNING
What was checked
  • Parameter budget per chunked statement: widest is the 26-column issue upsert at 13,000 params (error-tick-persistence.ts:531)
  • Every statement still filters OrgId, including the chunked state-clear and stale-issue read (error-tick-persistence.ts:891)
  • Raw SQL in the incident/state refresh is unchanged apart from indentation (git diff -w on the file)

0b92935 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.