Skip to content

feat(aci): Track service account and org token creators on workflows - #130482

Merged
DominikB2014 merged 2 commits into
feat/workflow-engine-non-user-creatorfrom
feat/workflow-non-user-creator
Nov 17, 2026
Merged

DominikB2014 merged 2 commits into
feat/workflow-engine-non-user-creatorfrom
feat/workflow-non-user-creator

Conversation

@DominikB2014

@DominikB2014 DominikB2014 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #129550 (detectors).

This adds service account and org auth tokens ids, so we can track whos created resources. Eventually this will help serve optional guardrails that will allow creators to modify/delete their own resources but not others.

Generated description

Workflows only recorded a user creator, so ones created by service accounts or org auth tokens had no author.

Refs ENG-8937

Add created_by_service_account_id / created_by_org_auth_token_id to
Workflow with an at-most-one-creator check constraint, and record the
creator from the workflow validator.
@DominikB2014
DominikB2014 requested review from a team as code owners November 9, 2026 19:24
@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

ENG-8937

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 9, 2026
@sentry

sentry Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 804 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

…ow-non-user-creator

# Conflicts:
#	migrations_lockfile.txt
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0126_add_detector_non_user_creator.py src/sentry/workflow_engine/migrations/0127_add_workflow_non_user_creator.py

for 0126_add_detector_non_user_creator in workflow_engine

--
-- Add field created_by_org_auth_token_id to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by_org_auth_token_id" bigint NULL;
--
-- Add field created_by_service_account_id to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by_service_account_id" bigint NULL;
--
-- Create constraint workflow_engine_detector_single_creator on model detector
--
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_detector_single_creator" CHECK ((("created_by_service_account_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_service_account_id" IS NULL))) NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_detector_single_creator";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_org_auth_token_id_14fce493" ON "workflow_engine_detector" ("created_by_org_auth_token_id");
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_service_account_id_8ac26027" ON "workflow_engine_detector" ("created_by_service_account_id");

for 0127_add_workflow_non_user_creator in workflow_engine

--
-- Add field created_by_org_auth_token_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by_org_auth_token_id" bigint NULL;
--
-- Add field created_by_service_account_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by_service_account_id" bigint NULL;
--
-- Create constraint workflow_engine_workflow_single_creator on model workflow
--
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_workflow_single_creator" CHECK ((("created_by_service_account_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_service_account_id" IS NULL))) NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_workflow_single_creator";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_org_auth_token_id_fb9da085" ON "workflow_engine_workflow" ("created_by_org_auth_token_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_service_account_id_738c24e3" ON "workflow_engine_workflow" ("created_by_service_account_id");

@DominikB2014
DominikB2014 marked this pull request as draft November 12, 2026 17:57
@DominikB2014
DominikB2014 marked this pull request as ready for review November 16, 2026 17:14
@DominikB2014
DominikB2014 merged commit 9f9a90f into feat/workflow-engine-non-user-creator Nov 17, 2026
88 of 89 checks passed
@DominikB2014
DominikB2014 deleted the feat/workflow-non-user-creator branch November 17, 2026 15:02

This branch was successfully deployed

1 active deployment
Preview — 22ab313a Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants