feat(adapters): google-cloudtasks-style — full Cloud Tasks v2 surface - #99
Merged
Conversation
New reference adapter simulating the Google Cloud Tasks API (v2 REST): - locations: get/list, cmekConfig get/update - queues: create/get/list/patch/delete, :pause/:resume/:purge, IAM trio (etag-checked setIamPolicy), name/state filter subset, updateMask semantics (bare path replaces, dotted path sets a leaf) - tasks: create (full validation incl. body-vs-method, url scheme, de-duplication with 24h tombstones), get/list/delete, :run (post-dispatch status then completion), :buffer (generated and caller-chosen IDs, URL built from queue httpTarget uriOverride) - Service defaults for rateLimits/retryConfig on create; derived maxBurstSize; BASIC/FULL response views - Authored profile failing-worker: tasks.run records a 500 and reschedules per the queue's retryConfig (doubling curve, maxAttempts and maxRetryDuration exhaustion) — deterministic retry/backoff testing - VM test suite over a virtual clock (16 tests); conformance matrix entry (99 adapters)
…styped fields Review follow-up: every client-supplied field that reaches arithmetic or slicing is now type-checked (null = proto-JSON absent, wrong type = 400 INVALID_ARGUMENT, never a handler 500): queue/task names, scheduleTime, httpRequest.url, relativeUri, rateLimits/retryConfig/httpTarget object shapes (validated at queue write so tasks:buffer can never trip on stored state), CMEK kmsKey. Also: uriOverride.port renders as an integer (8080, not 8080.0 — the value round-trips through the store as a float), port <= 0 clears it; tests pin the exact virtual-clock retry schedule (+10s, +30s) instead of directional checks, assert the previously-vacuous first create, and cover the adversarial matrix plus port rendering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new reference adapter simulating the Google Cloud Tasks API (
cloudtasks.googleapis.com/v2, REST), covering the full documented v2 surface — 16 endpoints across three resources.Surface
projects.locations —
get,list(canonical GCP region set, pageSize/pageToken),getCmekConfig/updateCemekConfig({name, kmsKey}).queues —
create(queueId query param or name-derived; service defaults for rateLimits/retryConfig; derived output-only maxBurstSize; caps enforced),get,list(lexicographic, pageSize ≤ 9800,name/statefilter subset with=/!=/:),patch(AIP-134 updateMask: bare path replaces the message, dotted path sets a leaf;staterejected),delete(cascades to tasks),:pause/:resume(idempotent),:purge(deletes tasks created before the purge moment, stampspurgeTime),:getIamPolicy/:setIamPolicy(etag-checked → 409 ABORTED)/:testIamPermissions.tasks —
create(exactly-one-of httpRequest/appEngineHttpRequest, URL scheme, body-vs-method, relativeUri, ID charset, past scheduleTime clamped, task de-duplication incl. 24h tombstones for deleted/executed names),get/list/delete,:run(ignores scheduleTime/queue state/rate limits; returns post-dispatch status, then completes and deletes the task — re-runs 404 like the real API),:buffer(both forms; URL assembled from the queue httpTarget uriOverride).Views:
BASIC(default) omits request bodies;FULLreturns everything. Errors are the canonical{"error": {code, message, status}}envelope (INVALID_ARGUMENT / NOT_FOUND / ALREADY_EXISTS / ABORTED / UNAUTHENTICATED). Malformed JSON gets the real API's "Invalid JSON payload received.".Authored profile
failing-worker—tasks.runmodels a worker answering HTTP 500: the attempt is recorded (responseStatus, counters) and the task reschedules per the queue's retryConfig (min/max backoff, doublings;maxAttemptsandmaxRetryDurationexhaustion → permanent failure + tombstone). Deterministic retry/backoff path for clients, same pattern as sqs-style'sthrottled.Tests & verification
go test ./...,gofmt -l,go vetclean; adapter lint clean; boot + parse QC guards pass (99 adapters).CONFORMANCE.md+README.mdcount regenerated (99).