fix(payload): actionable error from cloudsync_payload_chunks when uninitialized#54
Open
andinux wants to merge 2 commits into
Open
fix(payload): actionable error from cloudsync_payload_chunks when uninitialized#54andinux wants to merge 2 commits into
andinux wants to merge 2 commits into
Conversation
…nitialized Querying the cloudsync_payload_chunks vtab on a database where cloudsync was never initialized surfaced a bare "SQL logic error": the internal statements over cloudsync_changes failed at step time and the error code propagated out of xFilter without ever setting the outer vtab's zErrMsg. The /check endpoint hit this on nodes not configured for cloudsync. Guard xFilter with the same is-initialized check (and message) used by cloudsync_payload_apply, propagate inner-statement messages onto the vtab, and stop ignoring watermark MAX() step failures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…re path The Failure Path Test only checked that a lastFailure object existed. Now that cloudsync_payload_chunks propagates its error, the server forwards "cloudsync is not initialized" for the check job too (previously a bare "SQL logic error"), so assert the message on all three surfaces: the send lastFailure JSON, the non-retryable SQL error raised by receive_changes, and the sync JSON. Goes green once the node runs 1.1.1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
When the
/checkendpoint queriescloudsync_payload_chunkson a database that is initialized for cloudsync locally but not configured on the cloud node, the server receives a misleading error:while
cloudsync_payload_applyin the same scenario already returns the actionable message:Root cause
cloudsync_payload_chunksis a virtual table whosexFilterruns internal statements over the eponymouscloudsync_changesvtab. On an unconfigured database those statements prepare fine but fail at step time, and the error code propagated out ofxFilterwithout ever setting the outer vtab'szErrMsg, so SQLite surfaced the generic "SQL logic error". The watermarkMAX(db_version)query even discarded its step error entirely, silently scanning an empty window.Fix
payload_chunks_filternow starts with the samecloudsync_context_is_initializedguard used bycloudsync_payload_applyand raises: "cloudsync is not initialized: call SELECT cloudsync_init('<table_name>') to enable sync on a table before querying cloudsync_payload_chunks."payload_chunks_step_sourcecopies the inner statement's error message onto the vtab'szErrMsg, so any other inner error (e.g. "cloudsync has no tables configured") reaches the caller instead of being masked.No PostgreSQL changes: the PG SRF errors through
ereport/SPI with its own messages, and the extension version stays at 1.1 (patch bump only), so no migration script is needed.Tests
Payload Chunks Uninitialized: runs the/check-style query on a database withoutcloudsync_initand asserts the actionable message. All 148 SQLite unit tests pass; PostgreSQL full suite passes with 0 failures.Failure Path Testnow asserts the forwarded "cloudsync is not initialized" message on all three surfaces (sendlastFailureJSON, the non-retryable SQL error raised byreceive_changes, and the sync JSON) instead of only checking that alastFailureobject exists. Note: this test stays red against server nodes still running the 1.1.0 extension (they forward the old "SQL logic error" text) and goes green once the node runs 1.1.1./checkquery on an uninitialized db now returns the actionable message.An independent review pass approved the change; noted follow-up (not in scope): on PostgreSQL,
cloudsync_payload_chunkson an unconfigured node silently returns zero chunks rather than erroring — parity there is a separate product decision.Versioning
CLOUDSYNC_VERSIONbumped to 1.1.1 (bug shipped in released 1.1.0)## [1.1.1] - 2026-07-10🤖 Generated with Claude Code