Skip to content

Add Cloud Tasks lock to orchestrator to prevent duplicate execution#113

Open
victor-paunescu wants to merge 1 commit into
mainfrom
cloud_tasks_lock
Open

Add Cloud Tasks lock to orchestrator to prevent duplicate execution#113
victor-paunescu wants to merge 1 commit into
mainfrom
cloud_tasks_lock

Conversation

@victor-paunescu

Copy link
Copy Markdown
Contributor

No description provided.

@gps-readability-bot

Copy link
Copy Markdown

Still need readability approvals from:

@gps-readability-bot

Copy link
Copy Markdown

Still need readability approvals from:

@gps-readability-bot

Copy link
Copy Markdown

Still need readability approvals from:

christophervoelpel added a commit to christophervoelpel/scene-machine that referenced this pull request Jun 17, 2026
…oogle-marketing-solutions#113 Cloud Tasks lock

Pre-merge review and hardening:
- Split the build and runtime service accounts. The app and worker now run as a
  dedicated runtime service account that does not hold artifactregistry.writer,
  so a compromised app cannot push or overwrite container images.
- Enforce a content-type allow-list on the signed-upload endpoint.
- Remove the unnecessary storage target-apply from the firestore-only deploy
  phase so it cannot abort and leave the deny-all rules undeployed.
- Route the raw Cloud Run and service-account IAM grants through the retry
  wrapper, and give the worker a finite gunicorn timeout.
- Fix the generation flow in the UI: do not resume until the global config has
  loaded, keep the in-flight marker when only URL signing fails, make
  render-resume per-execution, guard a malformed signed-URL expiry, and tolerate
  a single missing URL in a batch sign request.
- Reject an empty template update and surface an expired status-viewer session.
- Update the storage-rules test to match the deny-all rules, remove README
  trailing whitespace, and add a diff-check CI step.
- Add regression tests for the above.

Keep the PR google-marketing-solutions#113 fix from regressing:
- Port the Cloud Tasks duplicate-execution lock. The worker acquires and
  releases a per-task Firestore lock and the deploy enables its TTL, so this
  rewrite of orch.py and deploy.sh does not drop the fix when it lands after
  PR google-marketing-solutions#113.
christophervoelpel added a commit to christophervoelpel/scene-machine that referenced this pull request Jun 17, 2026
…ions#113 Cloud Tasks lock

The lock added in PR google-marketing-solutions#113 reads executionId, nodeId, groupId and
workflowDefinition from the task payload, so the older test that posted the
pre-lock payload shape raised a KeyError and returned 500 (red Python CI).

- Update test_worker_url_overrides_host_for_trigger_action to send a valid
  Cloud Tasks payload and acquire the lock.
- Add tests for the lock behavior: a duplicate delivery is skipped with
  'Already Triggered', a retryable failure releases the lock and returns 429,
  and a non-retryable failure keeps the lock.
- Validate the task payload in the handler so a malformed body returns a clean
  400 instead of a 500, and add a test for it.

This keeps the PR google-marketing-solutions#113 duplicate-execution protection as the source of truth
rather than weakening it to satisfy the stale test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants