fix: keep live collection running during DuckDB history import - #1178
Merged
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_f1c87d25-995a-4331-9ec4-7a9f4ee73f2e) |
Codex Review SummaryThis 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A large first DuckDB import kept Core offline beyond the old updater's 30-minute limit, which could restore only the old image over changed data. On the physical box, we stopped that updater before it rolled back. Core now imports the catalog, site history and energy accounting first, then starts live collection while SQLite raw samples and Parquet import in the background. The API and UI show incomplete history until all sources pass verification.
Addresses #1164. Keep that release blocker open until the candidate passes physical-box checks.
Validation:
make verifypassed; web tests passed, 591/591.No merge, release or physical-box change is part of this PR work. The local timeout above did not stop the production import. The previous full-data hash review belongs to an earlier synchronous implementation and is not claimed as proof of this patch.
Coordination: #1171 owns snapshot restore paths in the updater; this PR leaves those functions alone. #1176 changes a separate API parsing hunk. #1175 and #1177 do not share edited files with this change.
Note
High Risk
Changes first-boot DuckDB migration, persistent history layout, and self-update failure behavior—mistakes can strand sites or lose history without a matching backup restore.
Overview
Fixes the failure mode where a long first DuckDB migration let the updater roll back only the Core image and leave mismatched data (#1164).
Updater & startup guard: Core with self-update enabled now calls
GET /capabilitieson the updater socket before config or state open, requiring protocol 1 andpreserve_core_on_readiness_failure. On readiness timeout or failure, the updater no longer auto-reverts the image; it persistsprevious_image_id, extends the Core wait to six hours, and fails with guidance to restore from a verified backup. Docs describe updater-first install and recovery if the sidecar stops mid-migration.Background history import: Core seeds catalog, site history, and energy accounting, then starts the API and live collection while SQLite
ts_samplesand cold Parquet import in bounded, resumable chunks.HistoryMigrationStatusdrives bootboot.html, health JSON, dashboard banners, and Update Center during startup. History stays incomplete until every source verifies; full backups and raw retention are blocked until import finishes. Parquet stages in a separate DuckDB file; the primary uses a rotating native connector so buffer release waits for closed SQL connections, with live-writer maintenance and explicit sequence-based catalog IDs.UI: Treats API
503+error: startingas boot/migration progress (not “self-update disabled”); another client’s in-flight update can resume in Update Center.Reviewed by Cursor Bugbot for commit 7b17737. Bugbot is set up for automated code reviews on this repo. Configure here.