Skip to content

Call GCP Monitoring, Cloud Asset, IAM and Search Console through the distilled SDK - #2861

Merged
Makisuo merged 1 commit into
mainfrom
t3/distilled-gcp
Nov 19, 2026
Merged

Makisuo merged 1 commit into
mainfrom
t3/distilled-gcp

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2858. Moves the GCP connector's Google calls and the Search Console client onto @distilled.cloud/gcp through vendor-sdk.

What changed

  • integrations/gcp/api.ts: Cloud Monitoring timeSeries.list (projects, folders or organizations by scope), Cloud Asset searchAllResources and assets.list, and IAM generateAccessToken go through the SDK. Exports, GcpApiError and its reasons are unchanged. The reader's token and quota project go in as the SDK's Credentials (X-Goog-User-Project as before).
  • google-search-console/client.ts: sites and Search Analytics go through the SDK, pinned to the host Maple has used (www.googleapis.com) with the SDK's Endpoint override.
  • Stays on plain HTTP: the OAuth token exchange (not a Google API the SDK models) and BigQuery (see below).
  • vendor-sdk.ts (the tracing fix now lives in Call Vercel teams, projects, deployments and drains through the distilled SDK #2858):
    • Per-client retry, retryInvalidResponse and a detail hook, so GCP keeps one retry, a re-read of an undecodable page and no wait on a 429.
    • A message that is only the bare status (what the SDK fills in when a body has none) is no longer taken as the vendor's words.

Behaviour to know about

  • Google's refusal reasons are kept: the SDK keeps the envelope's gRPC status, message and details, so SERVICE_DISABLED, BILLING_DISABLED and the message-read reasons come out as before.
  • BigQuery is not ported: the SDK drops error.errors[].reason, the only place BigQuery says rateLimitExceeded, quotaExceeded or billingNotEnabled on a 403 that otherwise reads like a missing role. Its job calls also use a per-call timeout and a requestId join.
  • Search Console: a non-JSON error body's text is dropped from the message when it looks like markup. Before, only a JSON error.message was used.

Bundle cost

@distilled.cloud/gcp is added to the Worker build's pure list, as alchemy's default does for every distilled package.

Measured with esbuild (--platform=neutral --conditions=worker,workerd --minify), importing only the five service modules used plus Credentials, against an effect-only baseline: +92 KB minified, +15 KB gzipped. The SDK's worker credentials entry imports node:fs/promises for Application Default Credentials. It is never called here, and Maple Workers get nodejs_compat by default.

Verification

  • vitest over services/integrations, services/cost, services/security and services/auth: 1,878 passed. The GCP leak tests and the Search Console message tests pass unchanged.

  • New GCP regression test: keeps the stored inventory when a resource search answers an empty 200. The SDK reads an empty or null body as {}; the adapter (Call Vercel teams, projects, deployments and drains through the distilled SDK #2858) now hands our schema null, so the read fails and nothing stored is removed. The test fails without that fix.

  • packages/backend typecheck: no errors. oxlint -c .oxlintrc.effect.json and oxfmt on every changed file: clean.

No UI change, so no screenshots.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Devin Review

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@maple-review-bot

This comment has been minimized.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@Makisuo
Makisuo force-pushed the t3/distilled-vercel branch from 91a3349 to 47810fd Compare November 19, 2026 14:28
@Makisuo
Makisuo force-pushed the t3/distilled-gcp branch 2 times, most recently from a175e20 to 2880c2a Compare November 19, 2026 14:32
@maple-review-bot

This comment has been minimized.

@Makisuo
Makisuo force-pushed the t3/distilled-vercel branch from 47810fd to 264743b Compare November 19, 2026 15:15
Base automatically changed from t3/distilled-vercel to main November 19, 2026 15:16
…hrough the distilled SDK

Cloud Monitoring time series, Cloud Asset search and assets, IAM
generateAccessToken and the Search Console sites and Search Analytics calls
go through @distilled.cloud/gcp via vendor-sdk. The OAuth token exchange and
BigQuery stay on plain HTTP: the SDK drops BigQuery's error.errors[].reason,
which tells a quota or billing 403 from a missing role.

vendor-sdk takes per-client retry settings, retryInvalidResponse and a
detail hook, and drops a message that is only the bare status. Marks
@distilled.cloud/gcp pure for the Worker build.
@Makisuo
Makisuo merged commit 1051642 into main Nov 19, 2026
7 checks passed
@Makisuo
Makisuo deleted the t3/distilled-gcp branch November 19, 2026 15:20
@maple-review-bot

maple-review-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. Every SDK-backed call is pinned by fetch-stub tests asserting exact URL, x-goog-user-project and refusal reasons; only the earlier doc-comment finding still stands.
1 note · tests covered · risk medium · 4/4 new units observable

Moves the GCP connector's Monitoring, Cloud Asset and IAM calls plus the Search Console client onto @distilled.cloud/gcp through vendor-sdk, with per-client retry/detail hooks. Behaviour is pinned by the existing stub tests; the one open finding (a doc comment that now sits above listTimeSeriesOf) is unfixed.

  • googleSdk wraps Monitoring, Cloud Asset and IAM Credentials with the reader's token and quota project
  • listTimeSeriesOf picks the folder, organization or project timeSeries.list operation from the scope
  • Search Console runs through the SDK with Endpoint pinned to www.googleapis.com
  • VendorSdk.make gains retry, retryInvalidResponse and a detail hook

Still open from earlier reviews

6da601f · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

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