Skip to content

[dummy_ci 5/7] Add Cocoon JWT verifier, Firestore store, Cloud Tasks scheduler, and POST /webhook - #5233

Open
ievdokdm wants to merge 1 commit into
197798-4-dummy-ci-jwks-endpointfrom
197798-5-dummy-ci-webhook
Open

ievdokdm wants to merge 1 commit into
197798-4-dummy-ci-jwks-endpointfrom
197798-5-dummy-ci-webhook

Conversation

@ievdokdm

@ievdokdm ievdokdm commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds Cocoon Ed25519 JWT verification, Firestore task persistence, Cloud Tasks scheduling, and POST /webhook to dummy_ci (RFC 610.0002 §§ 3.2.2, 4.1.3–4.1.8, 8.1.1).

Summary

  • Adds google_cloud_firestore (^0.5.5), google_cloud_tasks_v2 (^0.1.0), and google_cloud_protobuf (^0.5.5) to dummy_ci/pubspec.yaml and updates dummy_ci/pubspec.lock.
  • Adds task domain models (TaskStatus, TaskDetail, WebhookPayload, TaskRecord) and Firestore map codecs in dummy_ci/lib/src/model/task_record.dart.
  • Adds JwksClient (lib/src/auth/jwks_client.dart) with 64 KB streaming body cap, 3s timeout, TTL caching, single-flight coalescing, and 30s unknown-kid forced-refresh cooldown.
  • Adds CocoonJwtVerifier (lib/src/auth/cocoon_jwt_verifier.dart) pinning EdDSA verification via jose_plus and enforcing typ, kid, iss, aud, exp, and iat with clock skew.
  • Adds TaskStore / FirestoreTaskStore (atomic DocumentReference.create(), get(), markTaskScheduled()) and TaskScheduler / CloudTasksScheduler (google_cloud_tasks_v2 with UTC scheduleTime and OidcToken), plus fakes in lib/src/fakes/ exported via lib/testing.dart.
  • Adds WebhookHandler (POST /webhook) enforcing application/jwt, 64 KB body cap (413), JWT auth (401), payload schema (400), idempotent duplicate detection (409) with recovery when task_scheduled == false, and 200 {} without sending an in_progress callback.
  • Wires /webhook into server.dart, bin/server.dart, and tool/local_server.dart, and documents Firestore + Cloud Tasks provisioning & IAM bindings in dummy_ci/README.md.

Stack

Testing

  • dart pub get, dart format --set-exit-if-changed ., dart analyze --fatal-infos, dart test --test-randomize-ordering-seed=random --reporter expanded
  • dart compile exe bin/server.dart
  • dart --enable-asserts analyze.dart and dart run dev/cocoon_code_health/bin/check.dart

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 introduces Firestore and Cloud Tasks provisioning to the dummy_ci service, implementing a webhook handler (POST /webhook) that verifies inbound EdDSA JWTs, persists task records in Firestore, and schedules delayed runs via Cloud Tasks. Feedback on these changes highlights a potential resource leak of the HTTP client when using the default verifier in createDummyCiHandler, a race condition in the webhook handler that could lead to duplicate task scheduling, and an opportunity to resolve this by utilizing deterministic task names for built-in Cloud Tasks deduplication.

Comment thread dummy_ci/lib/src/server.dart Resolved
@ievdokdm
ievdokdm force-pushed the 197798-5-dummy-ci-webhook branch from 67a51e2 to e22e0f6 Compare December 4, 2026 00:37
@ievdokdm
ievdokdm force-pushed the 197798-4-dummy-ci-jwks-endpoint branch from c1dbd8a to d8fdd6f Compare December 4, 2026 00:37
@ievdokdm
ievdokdm force-pushed the 197798-4-dummy-ci-jwks-endpoint branch from d8fdd6f to 4cc5cc9 Compare December 4, 2026 01:07
@ievdokdm
ievdokdm force-pushed the 197798-5-dummy-ci-webhook branch from e22e0f6 to 20046ef 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