GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw · Issue #6531 · developing-today/code

cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531

New issue
Copy link
New issue
Copy link
Closed
#6543
Closed
cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw#6531
#6543
Copy link
Labels
app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 6, 2026
Issue body actions

cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in '); — the fragment is rewritten as the whole statement and the tail passes through raw

pkgs/cold-store-reaper/scripts/repair_dump.py — the streaming repair filter between the libsql /dump download and the sqlite3 rebuild in scripts/export-turso.sh — decides where a multi-line INSERT INTO sqlite_schema(...) candidate ends purely by line shape: the first buffered line ending in '); is taken as the statement's end. A schema object's SQL can itself contain such a line (a CREATE TRIGGER whose body has a statement ending in a string literal, e.g. SELECT RAISE(ABORT, 'bad');, is the natural case — SQLite stores the CREATE text as written, newlines included). When that happens the filter splits the statement at the interior line, "repairs" the fragment as if it were the whole statement, and passes the remaining lines through unfiltered — corrupting the filtered dump so the sqlite3 rebuild fails, where the identical statement on one line repairs and loads correctly.

Evidence (file:line, origin/main 2bcd46e0dc)

  • repair_dump.py:142-161 (main): once a line starts with INSERT INTO sqlite_schema(, every later line is appended to buffered (:147) until a line ending in STATEMENT_END (b"');", :33) appears (:148), at which point the joined chunk is emitted through repair_chunk. Nothing checks that the accumulated text is actually one complete statement — the line shape is the only terminator test.
  • repair_dump.py:90-128 (repair_statement): the fragment verifies as a "complete" statement — its final literal, after quote-doubling, parses exactly to the chunk end with ");" remaining (:124-127) — because the fragment genuinely is indistinguishable from a complete statement whose SQL is just the fragment. The rewrite therefore fires on the fragment.
  • The docstring (:22-25) states the assumption outright: it "buffers only the lines of one candidate statement (which ends at a line ending in ');)" — the assumption is the bug: a line ending in '); inside the embedded SQL is not the statement's end.

Verification (laptop probe, this run)

Probe ~/git/fleet/probe-repair-dump-earlyflush/probe.py against the real script at origin/main 2bcd46e0dc. Input (the final value's SQL spans two lines; line 1 ends in '); via the trigger body's RAISE(ABORT, 'bad');):

PRAGMA writable_schema=ON;
INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql) VALUES('table','ft','ft',0,'CREATE TRIGGER tr AFTER INSERT ON ft BEGIN SELECT RAISE(ABORT, 'bad');
 INSERT INTO log VALUES('x'); END');
PRAGMA writable_schema=OFF;

Filtered output — the first line is emitted as a complete, rewritten statement (note ''bad'), the tail line passes through raw:

INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql) VALUES('table','ft','ft',0,'CREATE TRIGGER tr AFTER INSERT ON ft BEGIN SELECT RAISE(ABORT, ''bad');
 INSERT INTO log VALUES('x'); END');

Oracle (stock sqlite3 load of the filtered stream, the same rebuild export-turso.sh performs): FAILS — the orphaned tail executes as a top-level statement (OperationalError: no such table: log) and the schema row that does land carries only the truncated first line of the trigger SQL. Control: the identical statement on a single line is repaired by the same filter and loads cleanly (schema row ft present). Filter exit code is 0 in both cases — the corruption is silent.

Why it matters

This filter is the Turso export path's only defense against the libsql mis-escaping quirk (#1391); its output feeds a sqlite3 -bail rebuild of the only portable backup. A dump containing a multi-line trigger (or any schema SQL with an interior '); line end) is silently mangled: the rebuild either dies (backup export fails) or, worse, a truncated schema statement lands in the restored database. Distinct from #6525 (same file: an unterminated candidate is buffered whole — a memory failure with byte-identical output); this is the opposite terminator failure — termination too early — and it breaks correctness, not just memory.

Acceptance criteria

  • A candidate statement is not terminated by an interior line ending in '); when more of the statement follows: the two-line probe statement above (and equivalents) is repaired as one statement and the filtered stream loads in stock sqlite3 with the full schema SQL intact.
  • Byte-identical output is preserved in every currently-correct case: mis-escaped literals still repaired, valid literals untouched, unterminated-at-EOF still flushed unchanged (existing TestDumpRepairFilter in tests/test_export_turso.py passes unchanged).
  • A new regression test in TestDumpRepairFilter pins the case: a multi-line schema statement whose embedded SQL contains an interior line ending in '); round-trips through the filter and a sqlite3 rebuild.
  • The docstring's statement-end description matches the implemented termination rule.

Filed by the new-issue-creator (lane A) after verification this run; not a duplicate of #1391 (the mis-escaping quirk) or #6525 (the same filter's unbounded-buffer memory issue — this one terminates too early and corrupts output).

Activity

Next
  1. developing-today commented on Nov 6, 2026

    @developing-today
    developing-todayBot
    on Nov 6, 2026 – with developing.today
    Contributor
    More actions

    CODE-1983

  2. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)
    queue/queuedHas a queued queue task
    status/needs-triageNot yet triaged; needs a first look
    on Nov 6, 2026
  3. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-a
    • Session / ID: cron new-issue-creator-code-a run 2026-11-06 08:35 CST
    • Found via: filed this run
    • Task: issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 filed and enqueued for triage on queue repo-health-code-pilot. Verified this run on the laptop primary at origin/main 2bcd46e with probe ~/git/fleet/probe-repair-dump-earlyflush/probe.py against the real scripts/repair_dump.py: a two-line sqlite_schema statement whose embedded trigger SQL has an interior line ending in '); is split at that line — the fragment is quote-doubled and emitted as the whole statement, the tail passes through raw, and the filtered stream fails the stock sqlite3 rebuild (control: the identical statement on one line repairs and loads cleanly). Distinct from issue cold-store-reaper(repair_dump): an unterminated sqlite_schema candidate is buffered whole — the 'constant-memory' filter grows to the size of the remaining dump #6525 (same filter, unterminated-candidate memory growth; output byte-identical there).
    • Expectation: triage confirms and routes a fix: termination must not fire on an interior '); line; existing TestDumpRepairFilter cases stay byte-identical.
    • Links: issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 · issue cold-store-reaper(repair_dump): an unterminated sqlite_schema candidate is buffered whole — the 'constant-memory' filter grows to the size of the remaining dump #6525 · issue Upstream quirk: libsql /dump does not escape single quotes in sqlite_schema INSERTs for virtual tables (FTS5) — cold-store reaper works around it #1391
  4. dezren39
    added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 6, 2026
  5. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-q
    • Session / ID: task 11187
    • Found via: queue claim
    • Task: Triage/work item for issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 handed off to the opencode claimant per execution-lane assignment (assigned_lane=opencode); parked 1200s for claimant binding. Attempts 1/6.
    • Expectation: opencode claimant launches the bound session and drives task 11187 to a terminal state.
    • Links: cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531
  6. 12 remaining items

  7. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: OpenChamber scheduled lane (repo-worker-code, lane aea12c82-c5af-4e5a-9b66-f8e360f87177)
    • Session / ID: task 11206
    • Task: small_fix; worktree ~/git/fleet/queue-11206, branch queue/11206-6531-repair-dump-early-flush.
  8. developing-today
    added
    status:in-review
    on Nov 6, 2026
  9. dezren39
    removed
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    on Nov 6, 2026
  10. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: OpenChamber scheduled lane (repo-worker-code, lane aea12c82-c5af-4e5a-9b66-f8e360f87177)
    • Session / ID: task 11206
    • Task: fix implemented; PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 (Fixes #6531); full cold-store-reaper tests pass locally.
    • Expectation: merge when PR checks are green.
  11. dezren39
    added
    queue/queuedHas a queued queue task
    on Nov 7, 2026
  12. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-r
    • Session / ID: task 11212
    • Found via: queue claim
    • Task: Triage issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 (repair_dump multi-line schema statement split) — a prior fix note names PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543; verify that PR and the current-main state first, then route what remains
    • Expectation: effort xs triage (20 min); done = verdict with fresh evidence on issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 and routing for any remainder
    • Links: issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531, PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543
  13. dezren39
    added a commit that references this issue on Nov 8, 2026

    Merge pull request #6543 from developing-today/queue/11206-6531-repai…

    f752e0a
  14. dezren39
    closed this as completedin #6543on Nov 8, 2026
  15. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-m
    • Session / ID: task 11212
    • Found via: queue claim
    • Task: Triage of issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 (cold-store-reaper repair_dump: multi-line schema statement terminated at an interior ');' line) at current main.
    • Expectation: effort/xs — triage only; verify state and route what remains.
    • Links: PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 (merged, sha f752e0a), fix task 11206, sibling issue cold-store-reaper(repair_dump): an unterminated sqlite_schema candidate is buffered whole — the 'constant-memory' filter grows to the size of the remaining dump #6525

    Triage verdict (2026-11-07): already done — fix landed while this triage was in flight.

    • Issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 was confirmed and routed on 2026-11-06 (task 11187 triage verdict; fix task 11206), and PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 implemented it: ends_statement() in pkgs/cold-store-reaper/scripts/repair_dump.py now ends a candidate only when the buffered text parses as a complete statement or the next line begins a new top-level statement (or EOF); docstring updated to match; regression tests in TestDumpRepairFilter pin the interior-');' case with a stock-sqlite3 load oracle.
    • I re-read PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543's full diff this pass: it matches the issue's acceptance criteria, its basic checks (scripts-test 3.12 and 3.14) were SUCCESS, it was MERGEABLE with no Codex findings and no review changes requested.
    • PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 merged at 2026-11-08T00:25:58Z (sha f752e0a) and issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 is CLOSED. Nothing remains for issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531. Sibling issue cold-store-reaper(repair_dump): an unterminated sqlite_schema candidate is buffered whole — the 'constant-memory' filter grows to the size of the remaining dump #6525 (same filter, unterminated-candidate buffering) is a distinct fix and is being routed separately (task 11210, handed off to the opencode claimant this shift).
    • Double-pickup record (for the fleet monitor): lane code-r posted a pickup note naming task 11212 at 2026-11-08T00:24:48Z, after this lane's claim and claimed-checkpoint; my claim's heartbeat stayed live throughout (lane_id code-m, lease extended to 00:40:13Z). The PR merge above landed during that overlap. No competing work was produced by this lane — this note and the queue completion are its only outputs.
  16. dezren39
    removed
    queue/queuedHas a queued queue task
    on Nov 8, 2026
  17. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-r
    • Session / ID: task 11212
    • Found via: queue claim
    • Task: Triage of issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 — the fix already existed as PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 (from task 11206) but had sat unmerged since 2026-11-06; reviewed it fresh and merged it
    • Expectation: done — PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543 merged (merge commit f752e0a), issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531 closed
    • Links: PR cold-store-reaper(repair_dump): don't terminate a schema statement at an interior ');' line (#6531) #6543, issue cold-store-reaper(repair_dump): a multi-line schema statement is terminated by the first interior line ending in ');' — the fragment is rewritten as the whole statement and the tail passes through raw #6531

    Review evidence: diff matches the issue's intent (statement end is now decided by parsing the buffered literal / next-top-level-statement, not line shape alone; docstring updated); new tests cover the two-line trigger statement in both mis-escaped and correctly-escaped forms with a stock sqlite3 load oracle; CI on the PR was green (basic: scripts-test 3.12 and 3.14 SUCCESS); no Codex review findings were posted on PR #6543; the PR's documented known limit (a mis-escaped statement whose interior '); line is followed by an unindented continuation line) is recorded in its body and remains a theoretical remainder, not a blocker for the reported case.

  18. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.