Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: defer rollout creation for database creation plans (#18692)
boojack002bce5dcd47
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vueindex 5c8114ac2a..b34a73f964 100644--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue@@ -369,7 +369,8 @@ const create = async () => {const { createdIssue } = await experimentalCreateIssueByPlan(project,issueCreate,- planCreate+ planCreate,+ { skipRollout: true });router.push({name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex f543892657..3026382c81 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -161,8 +161,8 @@ const handlePerformAction = async (action: UnifiedAction) => {}break;case "ROLLOUT_START":- // For export/create plans without rollout, create and run all tasks- if (context.value.isExportPlan && !rollout.value) {+ // For deferred rollout plans without rollout, create and run all tasks+ if (context.value.hasDeferredRollout && !rollout.value) {await handleCreateRollout({ runAllTasks: true });return;}diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.tsindex ebb87608cc..ded4e18ab5 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts@@ -72,8 +72,8 @@ export const ISSUE_STATUS_RESOLVE: ActionDefinition = {priority: 50,isVisible: (ctx) => {- // Export plans auto-resolve when export completes, never show manual resolve- if (ctx.isExportPlan) return false;+ // Deferred rollout plans auto-resolve when task completes, never show manual resolve+ if (ctx.hasDeferredRollout) return false;return (ctx.issueStatus === IssueStatus.OPEN &&(ctx.approvalStatus === Issue_ApprovalStatus.APPROVED ||diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.tsindex 50e41ea2e9..cca8cd2781 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts@@ -11,8 +11,8 @@ export const ROLLOUT_CREATE: ActionDefinition = {priority: 55,isVisible: (ctx) => {- // Export plans use ROLLOUT_START to create rollout and run tasks together- if (ctx.isExportPlan) return false;+ // Deferred rollout plans use ROLLOUT_START to create rollout and run tasks together+ if (ctx.hasDeferredRollout) return false;if (ctx.isIssueOnly) return false;if (ctx.plan.hasRollout) return false;if (!ctx.issue) return false;@@ -40,8 +40,8 @@ export const ROLLOUT_START: ActionDefinition = {priority: 60,isVisible: (ctx) => {- // Export plans: rollout is created on-demand when user clicks Export button- if (ctx.isExportPlan) {+ // Deferred rollout plans: rollout is created on-demand when user clicks action button+ if (ctx.hasDeferredRollout) {if (!ctx.issue || !ctx.issueApproved) return false;// Show if no rollout yet (will create it) or has startable tasksif (!ctx.rollout) return ctx.permissions.runTasks;diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.tsindex 539b809b18..8402fa2f9b 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts@@ -156,6 +156,12 @@ export function buildActionContext(input: ContextBuilderInput): ActionContext {const isExportPlan = plan.specs.some((spec) => spec.config?.case === "exportDataConfig");+ // Plans where rollout is created on-demand when user clicks action button+ const hasDeferredRollout = plan.specs.some(+ (spec) =>+ spec.config?.case === "exportDataConfig" ||+ spec.config?.case === "createDatabaseConfig"+ );const isCreator =currentUserEmail === extractUserId(plan.creator || "") ||(issue ? currentUserEmail === extractUserId(issue.creator) : false);@@ -244,6 +250,7 @@ export function buildActionContext(input: ContextBuilderInput): ActionContext {isCreating,isIssueOnly,isExportPlan,+ hasDeferredRollout,isCreator,issueApproved,exportArchiveReady: computeExportArchiveReady(diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.tsindex 7c7a7cb7c4..962696e7f3 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts@@ -62,6 +62,8 @@ export interface ActionContext {isCreating: boolean;isIssueOnly: boolean;isExportPlan: boolean;+ // Plans where rollout is created on-demand (export, create database)+ hasDeferredRollout: boolean;isCreator: boolean;issueApproved: boolean; // approval is APPROVED or SKIPPEDexportArchiveReady: boolean;diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vueindex d01bea803b..b1aca276ff 100644--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue@@ -41,10 +41,19 @@{{ databaseName }}</span></div>++ <!-- Task Status (only when rollout exists) -->+ <div v-if="createDatabaseTask" class="flex items-center gap-2">+ <span class="text-sm font-medium text-gray-600"+ >{{ $t("common.status") }}:</span+ >+ <TaskStatus :status="createDatabaseTask.status" size="small" />+ </div></div>+ <!-- Task Run Table (only when rollout exists and has task runs) --><div- v-if="createDatabaseTask && taskRunsForCreateDatabase.length > 0"+ v-if="rollout && createDatabaseTask && taskRunsForCreateDatabase.length > 0"class="mt-4"><TaskRunTable@@ -73,6 +82,7 @@import { computed, watchEffect } from "vue";import { extractCoreDatabaseInfoFromDatabaseCreateTask } from "@/components/IssueV1/logic/utils";import MonacoEditor from "@/components/MonacoEditor/MonacoEditor.vue";+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";import TaskRunTable from "@/components/RolloutV1/components/TaskRunTable.vue";import {DatabaseV1Name,@@ -90,9 +100,9 @@ import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";import { isValidInstanceName } from "@/types/v1/instance";import { getSheetStatement } from "@/utils";import { extractInstanceResourceName } from "@/utils/v1/instance";-import { usePlanContextWithRollout } from "../..";+import { usePlanContext } from "../..";-const { plan, rollout, taskRuns } = usePlanContextWithRollout();+const { plan, rollout, taskRuns } = usePlanContext();const { project } = useCurrentProjectV1();const environmentStore = useEnvironmentV1Store();const instanceStore = useInstanceV1Store();@@ -129,7 +139,7 @@ const databaseName = computed(() => {return createDatabaseConfig.value.database || "";});-// Find the task related to this create database spec+// Find the task related to this create database spec (only exists after rollout is created)const createDatabaseTask = computed(() => {if (!rollout.value || !createDatabaseSpec.value) return null;@@ -144,7 +154,7 @@ const createDatabaseTask = computed(() => {return null;});-// Get the sheet name from the task payload+// Get the sheet name from the task payload (when rollout exists)const sheetName = computed(() => {if (!createDatabaseTask.value) return null;@@ -176,6 +186,11 @@ const sheet = computed(() => {});const createStatement = computed(() => {+ // Before rollout: show placeholder message+ if (!rollout.value) {+ return "-- Statement will be shown after rollout is created";+ }+if (!createDatabaseTask.value) {return "-- No task found for this create database spec";}@@ -194,7 +209,7 @@ const createStatement = computed(() => {// Get task runs for this specific create database taskconst taskRunsForCreateDatabase = computed(() => {- if (!createDatabaseTask.value) return [];+ if (!rollout.value || !createDatabaseTask.value) return [];const taskName = createDatabaseTask.value.name;return taskRuns.value.filter((taskRun) =>diff --git a/frontend/src/store/modules/v1/experimental-issue.ts b/frontend/src/store/modules/v1/experimental-issue.tsindex cce2a60c86..b868b0fb75 100644--- a/frontend/src/store/modules/v1/experimental-issue.ts+++ b/frontend/src/store/modules/v1/experimental-issue.ts@@ -145,10 +145,15 @@ export const experimentalFetchIssueByUID = async (return composeIssue(rawIssue);};+export interface CreateIssueByPlanOptions {+ skipRollout?: boolean;+}+export const experimentalCreateIssueByPlan = async (project: Project,issueCreate: Issue,- planCreate: Plan+ planCreate: Plan,+ options?: CreateIssueByPlanOptions) => {const newPlan = planCreate;const request = create(CreatePlanRequestSchema, {@@ -166,6 +171,12 @@ export const experimentalCreateIssueByPlan = async (const newCreatedIssue =await issueServiceClientConnect.createIssue(issueRequest);const createdIssue = newCreatedIssue;++ // Skip rollout creation for plans that create rollout on-demand (e.g., database creation)+ if (options?.skipRollout) {+ return { createdPlan, createdIssue, createdRollout: undefined };+ }+const rolloutRequest = create(CreateRolloutRequestSchema, {parent: createdPlan.name,});