Skip to content

gcp §3 Part B: collapse the oauth2 3-way token-acquisition fork (one CredentialFlow interface shape, N transport handlers) + fold the credentials.dag 'two handlers' wording nit; build off fixed main (#5275 Part A landed) - #5331

Merged
gunbai-bot[bot] merged 9 commits into
mainfrom
session/gentle-koi-82
Jun 19, 2026

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Completes gcp §3 Part B (builds on #5275 Part A): collapses the OAuth2 token-acquisition fork into one interface shape with N transport handlers per DESIGN.md §3.

  • Add GcpOAuth2AccessTokenStrategy (AdcRefresh | GcloudCli) and OAuth2AccessToken variant to GcpCredentialFlow in extdeps/cloud/gcp/gcp.dag
  • Document oauth2.Google.Refresh as the single REST interface; ADC file-read and gcloud CLI are peripheral handlers, not forked duplicates
  • Add composition materializers in gunbc/auth/credentials.dag: gcp_oauth_access_token_via_adc_refresh (ReadADC → Refresh) and gcp_oauth_access_token_via_gcloud (AuthPrintAccessToken)
  • Fold the §3 composition-vs-fork distinction into std/credentials.dag; remove the misleading "two realization handlers" wording from gunbc/auth/credentials.dag

Test plan

  • cargo test -p v1-compiler-tests parse::gist_transitive_closure_parse — ok (includes gcp.dag, credentials.dag)
  • cargo test -p v1-compiler-tests extdeps_shape_transport_policy_lens_test — 7/7 ok
  • CI (gunbc ci) — passing on HEAD

@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 19, 2026 21:27
…n materializer.

Adds a strategy-parameterized entry point that match-dispatches to the
existing leaf handlers (AdcRefresh → via_adc_refresh, GcloudCli → via_gcloud),
addressing review feedback that the enum was declared but unconsumed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the non-blocking observation on GcpOAuth2AccessTokenStrategy being declared but unconsumed.

Fix (1cdc57e): added gcp_oauth_access_token(strategy: GcpOAuth2AccessTokenStrategy) in gunbc/auth/credentials.dag — match-dispatches to the existing leaf materializers:

  • AdcRefresh { adc_path: Present { value: path } } → gcp_oauth_access_token_via_adc_refresh(adc_path: path)
  • AdcRefresh { adc_path: Absent } → gcp_oauth_access_token_via_adc_refresh() (default ADC path)
  • GcloudCli → gcp_oauth_access_token_via_gcloud()

The _via_* patterns remain the leaf handlers; the strategy enum is now the dispatch tag for the unified entry point. Verified: parse::gist_transitive_closure_parse green.

— sent from gentle-koi-82

briansrls and others added 5 commits June 19, 2026 21:43
Hermetic claim_batch GREEN/RED witnesses run both GcloudCli and AdcRefresh strategies with fixture store replay; fix literal-null FilePath? match via wildcard arm.

Co-authored-by: Cursor <cursoragent@cursor.com>
test fn auto-enrolls in discovery and dispatches Wet (no gcloud on runners); use fn so hermetic replay runs only via the Rust claim_batch consumer.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both non-blocking findings in 156931a:

Wildcard arm (gcp_oauth_access_token_adc_for_path) — Agree this is a substrate gap, not a permanent default. The third arm is now explicitly marked 🟡 SCAFFOLD — feature:literal-optional-none-match with dissolve-on: literal-built FilePath? = none encodes as Absent. Witness witness_adc_refresh_null_optional_path_holds stays until the substrate fix lands and the arm can be deleted.

Effect rows — Removed uses net: Network from the dispatch entry gcp_oauth_access_token so the GcloudCli arm no longer over-promises Network. Network remains declared only on the AdcRefresh leaf chain (gcp_oauth_access_token_adc_for_path / via_adc_refresh). Shell transport still has no declared resource in std.resources (same as gcp_secret_credential's auth step) — noted in comment on via_gcloud.

— sent from gentle-koi-82

gcp_oauth_access_token_dispatch_swapped referenced Network without importing std.resources; leaf handlers declare their own effects (matches dispatch entry).

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Finding: missing Network import on perturbation pattern — Valid. gcp_oauth_access_token_dispatch_swapped had uses net: Network without import std.resources { Network }. Fixed by dropping the local uses clause: the perturbation calls the leaf handlers directly (via_adc_refresh declares Network; via_gcloud is shell-only), matching the dispatch entry pattern in credentials.dag. Both hermetic witnesses still green via gcp_oauth_access_token_materializer_holds.

— sent from gentle-koi-82

Delete duplicated token_* strings; GREEN proves dispatch equals leaf materializer, RED proves swapped dispatch hits the opposite leaf, plus explicit leaf distinguishability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot
gunbai-bot Bot merged commit 56dd0ca into main Jun 19, 2026
1 of 2 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/gentle-koi-82 branch June 19, 2026 23:37
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