GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(fleet-queue-backup): Turso to D1 export with restore drill (#8584) by dezren39 · Pull Request #12686 · developing-today/code Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Warning Review limit reachedYou'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 31 minutes. View limit details
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Live-run correction and status (task 21043, worker felix, 2026-11-22 evening): The PR body says the read-only dump run against the live store would be recorded here when it completes. It did not complete: the seat's egress to the Turso endpoint is degraded enough that a full 500-row-page pass over the production store did not finish in ~15 minutes, and I stopped it rather than leave it running. What is verified against the live store: a libsql pipeline query from this seat returned the store's schema count (25 tables/views), and both vault credentials the export needs are present by name ( Nothing else in the PR changes: the D1 provisioning, first verified export, restore drill, and timer install remain venue-blocked (laptop agent leg down; api.cloudflare.com unreachable from the sandbox at 110 s), with the resume condition recorded on #8584. When the laptop leg is back, the whole live sequence is the runbook's: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 993bfc2c5e
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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.
There was an error while loading. Please reload this page.
| for _attempt in range(60): | ||
| poll = self._call( | ||
| "POST", | ||
| f"/accounts/{self.account}/d1/database/{db_id}/import", | ||
| {"action": "poll", "filename": filename}, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Start D1 ingestion before polling its bookmark
Every real export reaches this loop immediately after uploading the SQL file, without ever starting an import. The D1 import API requires an ingest request containing etag and filename, followed by polling with current_bookmark; this request instead sends poll with filename. Consequently, the uploaded dump is never ingested and the scheduled backup cannot refresh D1. Send the ingest request first, then use its returned bookmark for subsequent polls.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| schema = read_schema(client) | ||
| counts = table_counts(client, schema) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Read the source dump from one consistent snapshot
When the production queue changes during an export, these counts and the later table pages describe different database states: LibsqlClient.execute() opens and closes a separate pipeline for every statement, so no read transaction spans the dump. For example, a claim appends an event between counting events and reading its rows, causing the eventual D1 count verification to fail even though the import succeeded. Updates that preserve counts can also produce a mixed-time copy that passes verification. Keep schema, counts, and all row pages in one source snapshot rather than requiring the live broker to remain idle for the entire export.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| REPO_QUEUE_BROKER_URL=http://127.0.0.1:4899 \ | ||
| QUEUE_BROKER_TOKEN_FILE=~/restore-drill/broker-token \ | ||
| ~/tools/fleet queue claim --worker restore-drill |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Pass the client token variable in the restore drill
Following this drill with the distinct scratch token created above makes the claim authenticate with the wrong token. The queue client's direct_token() in pkgs/fleet/crates/fleet-queue/src/client/transport.rs reads REPO_QUEUE_TOKEN_FILE, not QUEUE_BROKER_TOKEN_FILE; the latter only configures the server. Thus the client uses its existing production token file, or fails if that file is absent, instead of authenticating to the scratch broker. Set REPO_QUEUE_TOKEN_FILE for both the claim and listing commands so the documented live-restore acceptance step can succeed.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if isinstance(value, (bytes, bytearray)): | ||
| return {"type": "blob", "value": base64.b64encode(bytes(value)).decode()} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use the Hrana base64 field for blob values
When a backed-up row contains a BLOB, the restore converts it to bytes and passes it through this encoder, which emits the wrong wire shape. The Hrana protocol specification defines blob values with a base64 field, not value, so the live Turso endpoint cannot decode these arguments. The corresponding python_value() branch also reads value and would raise KeyError on a valid blob response. Use base64 in both directions; the current round-trip test misses this because the encoder and decoder share the same incorrect format.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| raise RuntimeError( | ||
| f"{table}: expected {ncols} columns, found {len(colnames)}" | ||
| ) | ||
| quoted = ", ".join(f'quote("{c}")' for c in colnames) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Preserve embedded NUL characters when rendering text
If a source TEXT value contains an embedded NUL, applying quote() here silently drops that character and everything after it. For example, a text value containing before, U+0000, and after is exported as only 'before'; this is documented behavior of SQLite's quote function. Both export and restore verification compare only row counts, so the truncated backup is reported as successful. Render text through a lossless representation, such as a hex blob cast back to TEXT, or reject such values explicitly rather than silently corrupting the copy.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.