Skip to content

feat: Auto-inject platform destination on sync via cqpd_ session mint#22945

Draft
disq wants to merge 11 commits into
mainfrom
claude/platform-dest-cli-session-mint
Draft

feat: Auto-inject platform destination on sync via cqpd_ session mint#22945
disq wants to merge 11 commits into
mainfrom
claude/platform-dest-cli-session-mint

Conversation

@disq

@disq disq commented Jun 11, 2026

Copy link
Copy Markdown
Member

On cloudquery sync, discover the team's active platform tenant via cloud, mint a tenant-scoped cqpd_ token through POST /platform-destination/session, and inject a platform destination wired to every source — the cloud credential never reaches the plugin, and any failure falls through to a normal sync. Pairs with cloudquery/platform#2727 and cloudquery/cloud#8571.

@disq disq requested a review from a team as a code owner June 11, 2026 18:34
@disq disq requested a review from marianogappa June 11, 2026 18:34
@disq disq marked this pull request as draft June 11, 2026 18:36
disq added 5 commits June 12, 2026 11:24
…on cloud runs

The injected destination sets SyncSummary, but destsWantSummary/needSummary
and the otel receiver were decided before injection ran — when platform was
the only summary-wanting destination, the receiver never started and
DurationsPerTableMs arrived empty. Hoist auth + injection above that block.
Also skip injection under env.IsCloud(): cloud-run syncs compose their spec
server-side.
@disq disq force-pushed the claude/platform-dest-cli-session-mint branch from 674ed39 to 96d3f6f Compare June 12, 2026 14:10
disq added 5 commits June 19, 2026 12:33
Source-only specs were rejected with "at least one destination is
required" before auto-injection could add the platform destination,
because NewSpecReader validated up front. Defer destination validation
(NewSpecReaderWithoutValidation + SetDestinationsAndValidate) so it runs
after injection.

Also:
- resolve credentials best-effort inside MaybeInjectDestination so
  injection works for specs that pull no cloudquery-registry plugin
- accept `created` tenants in addition to `active`
- use the generated cloudquery-api-go client instead of a hand-rolled
  HTTP client for tenant discovery and session minting
The injected destination sets sync_group_id, but write_mode defaulted to
overwrite-delete-stale (the WriteMode zero value), which the validator
rejects. Set write_mode: append explicitly.
The minted session returns the bare tenant host, but the destination's
/external-syncs/* endpoints are served under /api. Append /api to the
api_url passed to the plugin.
Auto-injection no longer overwrites a user-defined `platform` destination;
it now errors so the reserved name collision is surfaced instead of
silently replacing the user's block. Also strip verbose comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants