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: repair filter for libsql /dump's unescaped virtual-table schema literals (#1391) by dezren39 · Pull Request #1398 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Oct 27, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

What

Implements the workaround documented in #1391: a streaming repair filter between the Turso /dump download and the sqlite3 -bail rebuild in scripts/export-turso.sh.

libsql registers virtual tables via INSERT INTO sqlite_schema(...) inside a writable_schema block, emitting the embedded SQL verbatim — single quotes (an FTS5 content='chunks' is the common case) are not doubled, so the literal terminates early and every stock SQLite parser fails with near "chunks": syntax error. Any database with a quoted virtual-table definition (found live on atlas, 2026-10-27) could never be filed.

How

  • New scripts/repair_dump.py: a line-oriented, constant-memory filter (buffers only the current candidate statement, which ends at a line ending in ');). All lines pass through byte-identical except INSERT INTO sqlite_schema(...) statements whose final SQL literal is verifiably mis-escaped — parse-based detection: the literal, read with proper '' escaping, must close exactly at the statement's final quote; if it closes early or never closes, the raw SQL between the opening quote and the closing '); is re-emitted with every ' doubled, and the rewrite is re-parsed before being emitted (anything that does not verify passes through unchanged). Correctly-escaped statements and quote-free SQL pass through untouched.
  • export-turso.sh: download → repair filter → truncation guard (now applied to the filtered stream; the filter passes the trailing COMMIT; through undisturbed) → sqlite3 -bail rebuild → integrity/≥1-user-table checks, exactly as cold-store: harden turso export for GB-class databases #1383 left them. Per-DB failure isolation unchanged.

Tests

  • TestTursoExportScript (fake-server): a new atlas-shaped fixture — FTS5 external-content table registered by the exact broken writable_schema INSERT, plus its shadow tables and real FTS index rows — files successfully; the built .db has the virtual table in sqlite_master with its SQL exactly as authored, and a fresh-connection MATCH 'hello' returns the seeded row. A correctly-escaped variant files with identical registered SQL.
  • TestDumpRepairFilter (unit): broken literal → exactly the doubled-quote form; correctly-escaped, quote-free, and unrelated input byte-identical; an unterminated statement at EOF flushes unchanged for the caller's truncation guard.
  • Full pkgs/cold-store-reaper suite green; shellcheck shows only the pre-existing SC2310 infos; shfmt -i 2 -s and ruff format clean.

Refs #1391


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Muse Sweep added 2 commits October 27, 2026 11:09
Muse Sweep
cold-store: streaming repair filter for libsql /dump's unescaped sqli…
28c9195
…te_schema literals (#1391)
Muse Sweep
cold-store: tests for the turso dump repair filter (FTS5 writable_sch…
57a6aab
…ema fixture)
@dezren39
dezren39 requested a review from a team as a code owner October 27, 2026 11:09
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47af0d10-7a87-4805-9178-772bc761acac
Commits

Reviewing files that changed from the base of the PR and between 452d69e and 57a6aab.

Files selected for processing: 4
  • pkgs/cold-store-reaper/scripts/export-turso.sh
  • pkgs/cold-store-reaper/scripts/repair_dump.py
  • pkgs/cold-store-reaper/tests/test_cold_store.py
  • pkgs/cold-store-reaper/tests/test_export_turso.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T11:12:56.507119Z 57a6aab PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned dezren39 Oct 27, 2026
@dezren39
dezren39 merged commit 9f86ddb into main Oct 27, 2026
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the cold-store-turso-dump-quirk branch October 27, 2026 11:11
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 27, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57a6aabf5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/cold-store-reaper/scripts/repair_dump.py
Comment on lines +152 to +154
if line.lstrip().startswith(SCHEMA_INSERT):
if line.rstrip(b"\r\n").endswith(STATEMENT_END):
out.write(repair_chunk(line))

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 27, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Track SQL literal boundaries before recognizing schema inserts

When a text column contains multiline SQL, this check can mistake a line inside the dumped data literal for a schema statement and rewrite it. For example, dumping a text value containing a newline followed by INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql) VALUES("table","t","t",0,'CREATE VIRTUAL TABLE t USING fts5(x)'); produces a valid dump, but this filter changes the escaped quotes around the embedded CREATE statement and restoration then fails with near "CREATE": syntax error. Because the filter now runs on every export, previously exportable databases containing such text lose their backups. Track whether the stream is inside a string literal or another statement before treating a line as a repair candidate.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dezren39 dezren39 mentioned this pull request Oct 27, 2026
ci(cold-store-reaper): no workflow runs the package's test suites — 2,700+ lines of tests execute only when a human remembers #1427
Closed
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.