agent: discovers executor authorizes data-planes via Snapshot and defers on staleness (4/7) - #3344
Open
bbartman wants to merge 2 commits into
Open
Conversation
This was referenced Aug 11, 2026
Open
…ers on staleness The discovers executor moves its data-plane authorization onto the Snapshot and gains the same defer-on-stale behavior as publications, completing the removal of internal.user_roles() from the discover path: - The inline SQL data-plane query is replaced by Snapshot::user_authorization plus data_plane_by_catalog_name, distinguishing the three cases the SQL conflated: an authoritative denial is the new terminal JobStatus::NotAuthorized; a denial under a Snapshot predating the discover requests an early refresh and retries; and a plane genuinely absent from an authoritative Snapshot remains NoDataPlane, with a refresh-and-recheck grace for planes registered after the Snapshot was taken. - started_at anchors staleness to the queued discover row, and AuthorizationSnapshotStale from live-spec reads reschedules via DiscoverState::awaiting_snapshot_after instead of reporting a spurious failure. DiscoverOutcome becomes Resolved / RetryStale. - Harness: add_data_plane, queue_discover, discover_job_status, and SnapshotRefresher for refreshing from 'static connector fixtures. After this change the stacked tree is identical to #3155. Split 4 of 4 from #3155.
bbartman
force-pushed
the
bmb/2781-stack-4-discovers-staleness
branch
from
August 11, 2026 18:23
b880581 to
e46072c
Compare
…stack-4-discovers-staleness
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.
What
Split 4 of 4 of #3155 (issue #2781): the discovers executor moves its
data-plane authorization onto the Snapshot and gains the same
defer-on-stale behavior as publications, completing the removal of
internal.user_roles()from the discover path.internal.user_roles()is deleted (along with its.sqlxcache entry) infavor of
Snapshot::user_authorization+data_plane_by_catalog_name.This finally distinguishes the three cases the SQL conflated:
JobStatus::NotAuthorized;early refresh and retry;
JobStatus::NoDataPlane(with a refresh-and-recheck grace for planesregistered after the Snapshot was taken).
started_atanchors to thequeued discover row;
AuthorizationSnapshotStalefrom live-spec reads(capture fetch or merge-phase collection reads) reschedules via
DiscoverState::awaiting_snapshot_after+STALE_RETRY_WAKEinstead ofreporting a spurious failure.
DiscoverOutcomebecomes an enum(
Resolved/RetryStale).add_data_plane(a second plane, so denial ≠ missing),queue_discover(caller-chosen plane, not auto-run),discover_job_status,and
SnapshotRefresher— an owned handle letting'staticconnectorfixtures refresh the Snapshot mid-RPC.
Tests
user_discovers(new integration tests):test_discover_reschedules_on_stale_data_plane_authz,test_discover_unauthorized_data_plane_is_terminal,test_discover_defers_polls_until_authoritative_snapshot,test_job_status_not_authorized_serdetest_discover_succeeds_after_late_data_plane_registration,test_discover_missing_data_plane_is_terminal_after_refreshtest_discover_reschedules_on_stale_live_spec_authz,test_discover_reschedules_on_stale_collection_authz,test_discover_preserves_live_capture_after_late_grant— the end-to-endregression: a re-discover queued just after a grant lands must preserve
the live capture (nonzero
expect_pub_id, kept bindings/interval, noinjected
auto_discover) instead of silently re-drafting a starter spectest_discover_uses_one_snapshot_across_connector_rpc—a grant revoked during the connector RPC doesn't flip decisions within
one discover.
After this PR the stack's tree is identical to #3155.
Stack