Conversation
There was a problem hiding this comment.
🤖 AI Review
The offset-based rewrite preserves splitter behavior and removes the identified quadratic accumulation path. Both Claude findings are confirmed as nits: the performance test relies on Vitest's implicit timeout, and the non-obvious offset/performance invariant is undocumented. Codex reported no findings, and no correctness or security defects were found.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| ⚪ NIT | apps/cli/src/command-internal/sql-split.unit.test.ts:164 |
test-coverage |
claude | The performance regression test relies on Vitest's implicit default timeout instead of declaring its intended performance bound. |
| ⚪ NIT | apps/cli/src/command-internal/sql-split.ts:242 |
maintainability |
claude | The code does not document that slicing by start/end offsets avoids quadratic accumulation and that state-held offsets remain relative to the current token. |
Stats
Claude findings: 2 · Codex findings: 0 · Confirmed: 2 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
jgoux
left a comment
There was a problem hiding this comment.
Cross-review with Claude Fable reached consensus after two rounds: no actionable findings introduced by this PR. Token-relative offsets, Unicode iteration, statement boundaries, and EOF behavior are preserved. No inline findings remain.
Validation: all 59 splitter assertions passed in an isolated Bun harness (test-runner import adapted from Vitest to bun:test); 20,000 generated SQL/Unicode inputs matched the base across all four exports; direct Bun measurements confirmed the large-block speedup. The normal local package test command was blocked by dependency setup. The PR CI checks are passing. The added tests verify large-input correctness; a durable automated performance bound was not established.
…large-seed-file-and-an-anonymous
TL;DR
fixes
db resetstalling on a seed with a largeDO $$block or/* */comment.prob
the statement splitter built each statement one character at a time, and on every character inside a
$$body or block comment it sliced the tail of that string.in bun each slice copies the whole statement so far
so splitting grew quadratically and a 1 MB
DO $$block took about 15 seconds. seeds, migrations anddb pushall go through this splitter...sol
tracking start and end offsets and slicing the original input instead,
so the split stays linear and the same 1 MB block takes about 40 ms. the split output is unchanged....
ref: