GeezerVison is showing github.com — fix(fleet-queue-backup): capture each table CREATE at read time in build_dump (#15081) by developing-today-fleet[bot] · Pull Request #15120 · developing-today/code
Conversation
Closes #15081.
What
build_dump in infra/fleet-queue-backup/bin/fq_common.py captured every table's CREATE sql once at dump start, then read the tables one by one from the live queue store over the following ~30 minutes. When a migration added a column to github_mirror_issues mid-dump (2026-11-25, 04:31 CST run), the dump paired the captured 16-column CREATE with 17-value INSERTs and the D1 import rejected the whole copy — 37 minutes in.
Fix (the issue's preferred shape 1)
- The opening schema read now fixes only the table set and the DROP order.
- Each table's CREATE is captured at the moment that table is read: new
_fresh_table_shape re-reads the CREATE (read_table_schema) beside the zero-row probe and returns the pair only when the probe's columns match the CREATE's (table_columns). A migration landing between the two reads retries (3 attempts); one that never settles fails the export at dump time, naming the drift — the issue's shape-2 outcome as the fallback instead of a corrupt dump.
_pk_columns and the emitted CREATE both use the fresh sql. Dump layout is unchanged: all CREATEs still precede all INSERTs (the per-table CREATE/INSERT lines are buffered separately and assembled in the original order).
Test
- New
infra/fleet-queue-backup/tests/test_dump_schema_drift.py: a wrapper adapter lands the migration (ALTER TABLE … ADD COLUMN + an UPDATE using it) immediately after the opening schema capture, then the dump must rebuild the source exactly (sqlite3 as oracle). Red on the old code with the production symptom — table notes has 2 columns but 3 values were supplied — green with the fix.
- Full suite: all 10 files in
infra/fleet-queue-backup/tests/ pass, including the named regression oracles test_fq_common.py and the restore-drill tests. Hermetic stdlib Python; no CI workflow covers this directory, so the suite ran on the laptop worktree (the route the fleet-queue-backup: last night's export of the queue store did not run; its unit points into a lane's worktree that was removed #14302 lane used for the same suite).
Acceptance mapping: schema captured consistently with the rows read for each table ✓ · a mid-dump column addition now produces a consistent dump (test) ✓ · regression test fails on the old code ✓ · normal-path export still verifies (existing rebuild/count tests green) ✓. The remaining acceptance proof — the next scheduled live export importing cleanly — is time-based and belongs to #14302's watch, unchanged by this PR.
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-25T13:28:22Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": null,
"model": null,
"lane_start_issues": [],
"workspace_ref": null,
"auth_subject": "archer",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [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.
…build_dump (#15081)
build_dump paired the CREATE sql captured once at dump start with
rows read from the live queue store over the following ~30 minutes.
A migration landing in between (github_mirror_issues gained a column
mid-dump on 2026-11-25) produced 17-value INSERTs against a 16-column
CREATE and the D1 import rejected the whole copy, 37 minutes in.
The opening schema read now fixes only the table set and DROP order.
Each table's CREATE is re-read beside its zero-row probe at the
moment the table is read (_fresh_table_shape): the pair retries
until they agree, and a drift that never settles fails the export at
dump time naming the drift instead of corrupting the dump. Dump
layout is unchanged (all CREATEs before all INSERTs).
Regression test: tests/test_dump_schema_drift.py plays the mid-dump
migration hermetically (column added right after the opening schema
capture) and rebuilds the source exactly; on the old code it fails
with "table notes has 2 columns but 3 values were supplied".
Suite: all 10 files in infra/fleet-queue-backup/tests/ pass
(hermetic stdlib Python; no CI workflow covers this directory, run
on the laptop worktree — the route the #14302 lane used).
Important
Review skipped
Bot user detected.
To trigger a single review, invoke the @coderabbitai review command.
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:
85a01110-e155-414f-a06b-c2bdfcc9f13a
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- 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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|