Skip to content

Conversation

@saponifi3d
Copy link
Contributor

Description

As we continue to spec out the migrations for issue alerts / metric alerts, we found a few more data model changes.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 13, 2024
@codecov
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/workflow_engine/models/json_config.py 68.75% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #80710      +/-   ##
==========================================
+ Coverage   78.48%   80.35%   +1.87%     
==========================================
  Files        7215     7217       +2     
  Lines      319812   319880      +68     
  Branches    44045    20741   -23304     
==========================================
+ Hits       251012   257055    +6043     
- Misses      62411    62433      +22     
+ Partials     6389      392    -5997     

@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 15, 2024

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0013_aci_model_updates_from_milestones.py ()

--
-- Add field config to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "config" jsonb DEFAULT '{}'::jsonb NULL;
ALTER TABLE "workflow_engine_detector" ALTER COLUMN "config" DROP DEFAULT;
--
-- Add field created_by to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by" bigint NULL;
--
-- Add field description to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "description" text NULL;
--
-- Custom state/database change combination
--

                    ALTER TABLE "workflow_engine_detector" ADD COLUMN "enabled" boolean NOT NULL DEFAULT true;
                    
--
-- Add field project to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "project_id" bigint NULL;
--
-- Add field config to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "config" jsonb DEFAULT '{}'::jsonb NULL;
ALTER TABLE "workflow_engine_workflow" ALTER COLUMN "config" DROP DEFAULT;
--
-- Add field created_by to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by" bigint NULL;
--
-- Custom state/database change combination
--

                    ALTER TABLE "workflow_engine_workflow" ADD COLUMN "enabled" boolean NOT NULL DEFAULT true;
                    
--
-- Add field environment to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "environment_id" bigint NULL;
--
-- Add field owner_team to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_team_id" bigint NULL;
--
-- Add field owner_user_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_user_id" bigint NULL;
--
-- Alter field required on action
--
ALTER TABLE "workflow_engine_action" ALTER COLUMN "required" DROP NOT NULL;
--
-- Alter field organization on detector
--
SET CONSTRAINTS "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" IMMEDIATE; ALTER TABLE "workflow_engine_detector" DROP CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
ALTER TABLE "workflow_engine_detector" ALTER COLUMN "organization_id" DROP NOT NULL;
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_9ec3075e" ON "workflow_engine_detector" ("created_by");
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_project_id_275be9df" ON "workflow_engine_detector" ("project_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_a98158f7" ON "workflow_engine_workflow" ("created_by");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_environment_id_905d91b4" ON "workflow_engine_workflow" ("environment_id");
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te" FOREIGN KEY ("owner_team_id") REFERENCES "sentry_team" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_team_id_c401e7b8" ON "workflow_engine_workflow" ("owner_team_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_user_id_1ef7b270" ON "workflow_engine_workflow" ("owner_user_id");

@codecov
Copy link

codecov bot commented Nov 15, 2024

Bundle Report

Changes will increase total bundle size by 700 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 31.95MB 700 bytes (0.0%) ⬆️

@saponifi3d saponifi3d force-pushed the jcallender/aci-model-cleanup branch from 946517f to 7f4c7b2 Compare November 15, 2024 23:07
@saponifi3d saponifi3d force-pushed the jcallender/aci-model-cleanup branch 2 times, most recently from e1419e0 to 54245f9 Compare November 16, 2024 00:38
from jsonschema import ValidationError, validate


class JSONConfigBase(models.Model):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had added tests for this here: 8abfecc - but removed them cause it was causing a bunch of other failures. any recommendations on how to fix these?

@saponifi3d saponifi3d requested a review from wedamija November 21, 2024 01:21
@saponifi3d saponifi3d force-pushed the jcallender/aci-model-cleanup branch from 8abfecc to f9fc70c Compare November 21, 2024 21:12
@github-actions
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0014_model_additions_for_milestones.py ()

--
-- Add field config to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "config" jsonb DEFAULT '{}'::jsonb NOT NULL;
--
-- Add field created_by_id to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by_id" bigint NULL;
--
-- Add field description to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "description" text NULL;
--
-- Add field enabled to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "enabled" boolean DEFAULT true NOT NULL;
--
-- Add field project to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "project_id" bigint NULL;
--
-- Add field config to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "config" jsonb DEFAULT '{}'::jsonb NOT NULL;
--
-- Add field created_by_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by_id" bigint NULL;
--
-- Add field enabled to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "enabled" boolean DEFAULT true NOT NULL;
--
-- Add field environment to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "environment_id" bigint NULL;
--
-- Add field owner_team to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_team_id" bigint NULL;
--
-- Add field owner_user_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_user_id" bigint NULL;
--
-- Alter field required on action
--
ALTER TABLE "workflow_engine_action" ALTER COLUMN "required" DROP NOT NULL;
--
-- Alter field organization on detector
--
SET CONSTRAINTS "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" IMMEDIATE; ALTER TABLE "workflow_engine_detector" DROP CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
ALTER TABLE "workflow_engine_detector" ALTER COLUMN "organization_id" DROP NOT NULL;
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
--
-- Alter field when_condition_group on workflow
--
-- (no-op)
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_id_311a9ce7" ON "workflow_engine_detector" ("created_by_id");
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_project_id_275be9df" ON "workflow_engine_detector" ("project_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_id_84c30bc9" ON "workflow_engine_workflow" ("created_by_id");
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_work_environment_id_905d91b4_fk_sentry_en" FOREIGN KEY ("environment_id") REFERENCES "sentry_environment" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_work_environment_id_905d91b4_fk_sentry_en";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_environment_id_905d91b4" ON "workflow_engine_workflow" ("environment_id");
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te" FOREIGN KEY ("owner_team_id") REFERENCES "sentry_team" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_team_id_c401e7b8" ON "workflow_engine_workflow" ("owner_team_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_user_id_1ef7b270" ON "workflow_engine_workflow" ("owner_user_id");

@saponifi3d saponifi3d enabled auto-merge (squash) November 21, 2024 21:29
@saponifi3d saponifi3d merged commit 6506266 into master Nov 21, 2024
50 checks passed
@saponifi3d saponifi3d deleted the jcallender/aci-model-cleanup branch November 21, 2024 21:38
iamrajjoshi pushed a commit that referenced this pull request Nov 24, 2024
## Description
As we continue to spec out the migrations for issue alerts / metric
alerts, we found a few more data model changes.

---------

Co-authored-by: Cathy Teng <cathy.teng@sentry.io>
harshithadurai pushed a commit that referenced this pull request Nov 25, 2024
## Description
As we continue to spec out the migrations for issue alerts / metric
alerts, we found a few more data model changes.

---------

Co-authored-by: Cathy Teng <cathy.teng@sentry.io>
evanh pushed a commit that referenced this pull request Nov 25, 2024
## Description
As we continue to spec out the migrations for issue alerts / metric
alerts, we found a few more data model changes.

---------

Co-authored-by: Cathy Teng <cathy.teng@sentry.io>
andrewshie-sentry pushed a commit that referenced this pull request Dec 2, 2024
## Description
As we continue to spec out the migrations for issue alerts / metric
alerts, we found a few more data model changes.

---------

Co-authored-by: Cathy Teng <cathy.teng@sentry.io>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants