Skip to content

fix(managed_client): wait for result ready on sync query path#28

Merged
eddietejeda merged 2 commits into
mainfrom
fix/managed-client-wait-ready
Jun 27, 2026
Merged

fix(managed_client): wait for result ready on sync query path#28
eddietejeda merged 2 commits into
mainfrom
fix/managed-client-wait-ready

Conversation

@eddietejeda

Copy link
Copy Markdown
Contributor

Problem

A real prod end-to-end run of hotdata-dlt-destination failed on every read-modify-write (merge/append) and state read:

Result ... is not ready (status='processing'); poll get_result until status='ready' before fetching as Arrow.

_query_database_scoped waited for readiness on the async path but returned the result_id immediately on the synchronous QueryResponse path. fetch_table() then fetched it as Arrow while still processing. Shared client, so hotdata-airflow was exposed too. The in-memory test masked it (fake Arrow API always ready).

Fix

The sync path now also calls _wait_result_ready() before returning. Adds a regression test that drives the sync path through processing -> ready and asserts Arrow is fetched only after readiness.

Verified by re-running the full prod e2e (replace+nested, merge dedup, incremental state-sync) — all green.

fetch_table fetched the persisted result as Arrow using the result_id
from a synchronous QueryResponse without waiting for it to reach 'ready'.
Against the live async backend the result is often still 'processing',
so Arrow fetches failed on every read-modify-write (merge/append) and
state read. The async path already waited; the sync path now does too.

Adds a regression test driving the sync path with a 'processing' ->
'ready' result, asserting Arrow is fetched only after readiness.
claude[bot]
claude Bot previously approved these changes Jun 27, 2026
Extract a single typed _poll() helper shared by the query-run and
result-ready waits (removing two near-identical loops and the magic
0.5/0.3 sleep intervals), flatten _query_database_scoped via
_await_query_run, and hoist the class constants to the top. No behavior
change; verified by the unit suite and a full prod e2e re-run.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correct, well-scoped fix. The sync QueryResponse path now waits for result readiness before the caller fetches Arrow, the polling logic is cleanly deduplicated into _poll, and the regression test exercises the actual processing -> ready path. No blocking issues.

@eddietejeda eddietejeda merged commit 83ca2f2 into main Jun 27, 2026
3 checks passed
@eddietejeda eddietejeda deleted the fix/managed-client-wait-ready branch June 27, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant