Skip to content

fix(reconciler): parameterize circuit breaker SQL query#2013

Merged
jrf0110 merged 1 commit intoconvoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/headfrom
convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/gt/toast/fae4d509
Apr 5, 2026
Merged

fix(reconciler): parameterize circuit breaker SQL query#2013
jrf0110 merged 1 commit intoconvoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/headfrom
convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/gt/toast/fae4d509

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Apr 5, 2026

Summary

Replace strftime() template literal interpolation in the circuit breaker SQL query with a JS-computed cutoff timestamp passed as a bound SQL parameter. The CIRCUIT_BREAKER_WINDOW_MINUTES constant is now used to compute the ISO 8601 cutoff in JS (new Date(Date.now() - N * 60_000).toISOString()), then passed via ? binding instead of being interpolated into the query string. Same 30-minute window, no behavioral change.

Verification

  • Reviewed the diff for correctness: toISOString() produces the same ISO 8601 format that strftime('%Y-%m-%dT%H:%M:%fZ', ...) would, and string comparison with > works identically.
  • Confirmed single-file, 3-line change with no unrelated modifications.
  • Polecat reports typecheck, lint, and format checks all pass.

Visual Changes

N/A

Reviewer Notes

  • This is a pure SQL hygiene improvement — moving from template literal interpolation to bound parameters. Although the interpolated value was a constant (not user input), bound parameters are the standard pattern per the project's SQL conventions in AGENTS.md.
  • The Date.now() call happens at function invocation time, so the cutoff is computed once per reconciler tick, which matches the previous behavior of SQLite's now being evaluated at query execution time.

Compute the cutoff timestamp in JS and pass it as a bound SQL parameter
instead of interpolating CIRCUIT_BREAKER_WINDOW_MINUTES into the query
string via a template literal. Same 30-minute window, no behavioral
change.
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 5, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • cloudflare-gastown/src/dos/town/reconciler.ts

Reviewed by gpt-5.4-20260305 · 161,774 tokens

@jrf0110 jrf0110 merged commit dbf82c3 into convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/head Apr 5, 2026
2 checks passed
@jrf0110 jrf0110 deleted the convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/gt/toast/fae4d509 branch April 5, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant