Skip to content

[dummy_ci 7/7] Add POST /complete-run worker, OIDC auth, Ed25519 KMS signer, and Cocoon callback - #5235

Open
ievdokdm wants to merge 1 commit into
197798-6-dummy-ci-status-logsfrom
197798-7-dummy-ci-complete-run
Open

ievdokdm wants to merge 1 commit into
197798-6-dummy-ci-status-logsfrom
197798-7-dummy-ci-complete-run

Conversation

@ievdokdm

@ievdokdm ievdokdm commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds the Cloud Tasks POST /complete-run worker, Google RS256 OIDC authentication, Cloud KMS Ed25519 callback JWT signing, uniform-random terminal outcome generation, and Cocoon callback delivery to dummy_ci (RFC 610.0002 §§ 3.2.5, 4.2, 8.1.2).

Summary

  • Implements OidcVerifier / GoogleOidcVerifier (lib/src/auth/oidc_verifier.dart) verifying Google RS256 OIDC JWTs against https://www.googleapis.com/oauth2/v3/certs (iss, aud, exp/iat skew, email, email_verified), plus FakeOidcVerifier exported from lib/testing.dart.
  • Implements Ed25519JwtSigner (lib/src/auth/ed25519_jwt_signer.dart) selecting the highest numeric enabled Cloud KMS key version, computing its RFC 7638 kid, signing via CloudKmsService.asymmetricSign, and omitting any top-level version claim per RFC 4.2.1 / 8.1.2.
  • Implements OutcomeGenerator (lib/src/service/outcome_generator.dart) picking a uniform-random terminal outcome across all 6 RFC terminal states with logically aligned terminal details[] and Markdown message.
  • Implements CocoonCallbackClient (lib/src/service/cocoon_callback_client.dart) posting application/jwt with a 30s timeout and classifying 2xx (delivered), 409/non-retryable 4xx (permanent failure), and 5xx/408/429/timeout/network errors (retryable failure).
  • Adds saveTerminalOutcome and markCallbackDelivered to TaskStore / FirestoreTaskStore / FakeTaskStore.
  • Implements CompleteRunHandler (POST /complete-run) with OIDC auth, idempotent outcome persistence before callback delivery so retries never re-roll outcomes, and Cloud Tasks retry signaling (503 on retryable errors, 200 on delivered/permanent/duplicate/missing).
  • Wires /complete-run into server.dart and tool/local_server.dart.
  • Adds full unit tests plus test/e2e_flow_test.dart exercising the entire loop in-process (GET /api/v1/jwks -> signed POST /webhook -> GET /status -> POST /complete-run -> verifying outbound callback JWT against dummy_ci's own /api/v1/jwks -> GET /status -> GET /logs/<uid>/<testName>).
  • Finalizes dummy_ci/README.md with complete Cloud Run env var configuration, example Cocoon dev partner_config Firestore document, and end-to-end smoke-test instructions.

Stack

Testing

  • dart pub get, dart format --set-exit-if-changed ., dart analyze --fatal-infos, dart test --test-randomize-ordering-seed=random --reporter expanded (85 tests passing, including e2e_flow_test.dart)
  • dart compile exe bin/server.dart
  • dart --enable-asserts analyze.dart, dart run dev/cocoon_code_health/bin/check.dart, and license header verification

Towards flutter/flutter#197798

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request implements the end-to-end Pluggable CI callback flow for dummy_ci, including OIDC verification for inbound Cloud Tasks, synthetic terminal outcome generation, Ed25519 JWT signing via Cloud KMS, and callback delivery to Cocoon. Feedback suggests optimizing Ed25519JwtSigner by caching the resolved key version and JWK to avoid redundant KMS API calls. Additionally, CompleteRunHandler should propagate database update failures as retryable errors (e.g., 503 Service Unavailable) instead of silently swallowing them, ensuring eventual consistency when marking callbacks as delivered or settled.

@ievdokdm
ievdokdm force-pushed the 197798-6-dummy-ci-status-logs branch from e22d890 to a09848a Compare December 4, 2026 00:37
@ievdokdm
ievdokdm force-pushed the 197798-7-dummy-ci-complete-run branch from 1171217 to 0b7db5a Compare December 4, 2026 00:37
@ievdokdm
ievdokdm force-pushed the 197798-6-dummy-ci-status-logs branch from a09848a to c33c25a Compare December 4, 2026 01:07
@ievdokdm
ievdokdm force-pushed the 197798-7-dummy-ci-complete-run branch from 0b7db5a to afff686 Compare December 4, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant