Skip to content

fix: multiple rolled back states#4012

Merged
chronark merged 6 commits intomainfrom
09-23-fix_multiple_rolled_back_states
Sep 24, 2025
Merged

fix: multiple rolled back states#4012
chronark merged 6 commits intomainfrom
09-23-fix_multiple_rolled_back_states

Conversation

@chronark
Copy link
Collaborator

@chronark chronark commented Sep 23, 2025

What does this PR do?

This PR refactors the rollback functionality by moving the rollback state from the deployment to the project level. Instead of marking deployments with an isRolledBack flag, we now store a reference to the rolled back deployment in the project record with a new rolledBackDeploymentID field.

The changes include:

  • Adding a rolledBackDeploymentID field to the projects table
  • Removing the isRolledBack field from deployments
  • Updating the UI to check for rolled back status using the project's reference
  • Updating the rollback workflow to set the project's rolled back deployment ID
  • Fixing color schemes for status badges to use non-alpha color tokens

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)

How should this be tested?

  • Deploy a project
  • Rollback to a previous deployment
  • Verify the rolled back deployment shows the correct status in the UI
  • Verify the live deployment is correctly updated
  • Check that the status badges display with the correct colors

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • New Features

    • Rolled-back deployments are now tracked at the project level and highlighted in the deployments list.
    • Projects auto-refresh every 5 seconds for up-to-date deployment states.
  • Bug Fixes

    • Prevented runtime errors when no deployment is selected in the deployments table.
  • Style

    • Updated status badge color for rolled-back state.
    • Improved row styling to distinguish failed and rolled-back deployments.
  • Chores

    • Consolidated rollback tracking and update flow at the project level.

@changeset-bot
Copy link

changeset-bot bot commented Sep 23, 2025

⚠️ No Changeset found

Latest commit: ad45355

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
dashboard Ready Ready Preview Comment Sep 23, 2025 4:14pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
engineering Ignored Ignored Preview Sep 23, 2025 4:14pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

📝 Walkthrough

Walkthrough

Removes per-deployment isRolledBack and introduces project-level rolledBackDeploymentId across DB schema, generated types/queries, Go services, tRPC, collections, and UI; UI logic and hooks now derive rolled-back state from project. Adds UpdateProjectDeployments and removes per-deployment rollback queries.

Changes

Cohort / File(s) Summary
Dashboard UI — badges and table
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/components/env-status-badge.tsx, apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx, apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts
Badge styling token tweak; deployments list now uses project.rolledBackDeploymentId to determine rolled-back state; getRowClassName signature extended to accept rolledBackDeploymentId and applies rolled-back styles.
Dashboard hook
apps/dashboard/app/(app)/projects/[projectId]/deployments/hooks/use-deployments.ts
Hook return now exposes project (so callers can read project.rolledBackDeploymentId).
Project creation UI
apps/dashboard/app/(app)/projects/_components/create-project/create-project-dialog.tsx
New projects inserted with rolledBackDeploymentId: null.
Collections (Zod schemas)
apps/dashboard/lib/collections/deploy/deployments.ts, apps/dashboard/lib/collections/deploy/projects.ts
Removed Deployment.isRolledBack from deployments schema; added nullable Project.rolledBackDeploymentId; projects collection sets refetchInterval: 5000.
tRPC routers / API mapping
apps/dashboard/lib/trpc/routers/deploy/deployment/list.ts, apps/dashboard/lib/trpc/routers/deploy/project/list.ts
Deployment list stops selecting isRolledBack; project list now selects and maps rolledBackDeploymentId.
Internal DB schema (Drizzle + SQL)
internal/db/src/schema/deployments.ts, internal/db/src/schema/projects.ts, go/pkg/db/schema.sql
Removed deployments.is_rolled_back; added projects.rolled_back_deployment_id.
SQL queries / SQLC generated additions
go/pkg/db/queries/project_update_deployments.sql, go/pkg/db/project_update_deployments.sql_generated.go, go/pkg/db/queries/project_find_by_id.sql, go/pkg/db/project_find_by_id.sql_generated.go
Added UpdateProjectDeployments query and generated method/params; FindProjectById now returns RolledBackDeploymentID.
SQLC generated removals
go/pkg/db/queries/deployment_update_rollback.sql, go/pkg/db/deployment_update_rollback.sql_generated.go, go/pkg/db/queries/project_update_live_deployment_id.sql, go/pkg/db/project_update_live_deployment_id.sql_generated.go
Removed UpdateDeploymentRollback and UpdateProjectLiveDeploymentId queries and their generated types/methods.
SQLC querier interface
go/pkg/db/querier_generated.go
Dropped UpdateDeploymentRollback; added UpdateProjectDeployments.
Go services — deployment flows
go/apps/ctrl/services/deployment/deploy_workflow.go, go/apps/ctrl/services/deployment/rollback.go
Reworked ready/rollback steps to use StepVoid and propagate errors; replaced per-deployment rollback flag updates with UpdateProjectDeployments (sets live + rolled-back IDs).
Go DB models
go/pkg/db/models_generated.go, go/pkg/db/project_find_by_id.sql_generated.go
Removed Deployment.IsRolledBack; added Project.RolledBackDeploymentID (sql.NullString) in generated models and query rows.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Dashboard UI
  participant API as tRPC / Go Services
  participant DB as Database

  rect rgba(220,240,255,0.12)
    note right of UI: Deployment ready/complete flow
    User->>UI: mark deployment ready
    UI->>API: mark deployment ready
    API->>DB: UPDATE deployments (status, updated_at)
    DB-->>API: OK
    API->>DB: UpdateProjectDeployments(live_id, rolled_back_id?, updated_at)
    DB-->>API: OK
    API-->>UI: success
  end

  rect rgba(255,235,220,0.12)
    note right of UI: Rollback flow (source -> target)
    User->>UI: trigger rollback
    UI->>API: request rollback
    API->>DB: UpdateProjectDeployments(live=target, rolled_back=source, updated_at)
    DB-->>API: OK
    API-->>UI: done
  end

  rect rgba(225,255,225,0.12)
    note right of UI: Rendering rolled-back state
    UI->>API: fetch project + deployments
    API-->>UI: { project.rolledBackDeploymentId, deployments[] }
    UI->>UI: isRolledBack := deployment.id == project.rolledBackDeploymentId
    UI-->>User: render table rows with rolled-back styling
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

Core Team, UI

Suggested reviewers

  • perkinsjr
  • mcstepp
  • imeyer
  • ogzhanolguncu
  • MichaelUnkey

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix: multiple rolled back states" is concise and directly related to the main change (preventing multiple deployments from being marked as rolled back by moving the rolled-back state to the project). It clearly communicates intent and is short enough for history scanning, though it could be marginally more specific by referencing the project-level rolledBackDeploymentId change.
Description Check ✅ Passed The PR description follows the repository template: it provides a clear "What does this PR do?" summary, marks the Type of change, includes a detailed "How should this be tested" section, and presents a completed checklist along with notes about UI and DB changes. The only minor omission is the explicit "Fixes #" line requested by the template and an explicit note about running DB migrations or migration steps for reviewers; otherwise the description is sufficiently complete for review and testing.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 09-23-fix_multiple_rolled_back_states

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8111e14 and ad45355.

📒 Files selected for processing (1)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/components/env-status-badge.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/components/env-status-badge.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

chronark commented Sep 23, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chronark chronark marked this pull request as ready for review September 23, 2025 10:10
@github-actions
Copy link
Contributor

github-actions bot commented Sep 23, 2025

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (7)
internal/db/src/schema/projects.ts (1)

22-24: Add a typed relation for rolledBackDeploymentId.

Define a relation like activeDeployment for better type-safety and DX.

Add this to projectsRelations:

 export const projectsRelations = relations(projects, ({ one, many }) => ({
   workspace: one(workspaces, {
     fields: [projects.workspaceId],
     references: [workspaces.id],
   }),
   deployments: many(deployments),
   activeDeployment: one(deployments, {
     fields: [projects.liveDeploymentId],
     references: [deployments.id],
   }),
+  rolledBackDeployment: one(deployments, {
+    fields: [projects.rolledBackDeploymentId],
+    references: [deployments.id],
+  }),
   // environments: many(projectEnvironments),
 }));
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/components/env-status-badge.tsx (1)

13-15: Color tokens switched to “A” (alpha) variants — contradicts “non‑alpha” goal.

To meet the PR objective, use non‑A tokens.

Apply:

-        live: "text-featureA-11 bg-featureA-4",
-        rolledBack: "text-warningA-11 bg-warningA-4",
+        live: "text-feature-11 bg-feature-4",
+        rolledBack: "text-warning-11 bg-warning-4",

Also consider aligning enabled/disabled to non‑alpha for consistency:

-        enabled: "text-successA-11 bg-successA-3",
-        disabled: "text-warningA-11 bg-warningA-3",
+        enabled: "text-success-11 bg-success-3",
+        disabled: "text-warning-11 bg-warning-3",

Also applies to: 20-20

apps/dashboard/lib/collections/deploy/projects.ts (1)

47-48: Polling interval: verify impact on larger workspaces

Refetching every 5s across big workspaces can add load. Consider gating by document visibility or reducing frequency if not on the deployments page.

If useful, I can draft a small guard (e.g., use Page Visibility API) to disable background polling. Want that?

go/pkg/db/project_update_deployments.sql_generated.go (1)

38-45: Check RowsAffected to detect lost CAS

Surface an error if no row was updated (stale expected live).

-	_, err := db.ExecContext(ctx, updateProjectDeployments,
+	res, err := db.ExecContext(ctx, updateProjectDeployments,
 		arg.LiveDeploymentID,
 		arg.RolledBackDeploymentID,
 		arg.UpdatedAt,
 		arg.ID,
+		arg.ExpectedLiveDeploymentID,
 	)
-	return err
+	if err != nil {
+		return err
+	}
+	n, _ := res.RowsAffected()
+	if n == 0 {
+		return fmt.Errorf("update conflict: project live_deployment_id changed")
+	}
+	return nil

Note: implement in SQL (queries/project_update_deployments.sql) and regenerate.

go/apps/ctrl/services/deployment/rollback.go (1)

176-181: Align error message with operation

Message mentions “live deployment id” only; it now updates both pointers.

-		return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("failed to update project's live deployment id: %w", err))
+		return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("failed to update project deployments: %w", err))
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx (2)

300-301: Narrow useMemo deps to avoid unnecessary recalculations

Depend on stable scalars instead of the whole objects.

-  }, [selectedDeployment?.deployment.id, isCompactView, liveDeployment, project]);
+  }, [
+    selectedDeployment?.deployment.id,
+    isCompactView,
+    liveDeployment?.id,
+    project?.rolledBackDeploymentId,
+  ]);

309-309: keyExtractor likely targets the wrong shape

Rows are { deployment, environment? } (per Column typing). Use the nested deployment id.

-      keyExtractor={(deployment) => deployment.id}
+      keyExtractor={(row) => row.deployment.id}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd2a508 and 5ac10bc.

📒 Files selected for processing (24)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/components/env-status-badge.tsx (1 hunks)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx (4 hunks)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts (1 hunks)
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/hooks/use-deployments.ts (1 hunks)
  • apps/dashboard/app/(app)/projects/_components/create-project/create-project-dialog.tsx (1 hunks)
  • apps/dashboard/lib/collections/deploy/deployments.ts (0 hunks)
  • apps/dashboard/lib/collections/deploy/projects.ts (2 hunks)
  • apps/dashboard/lib/trpc/routers/deploy/deployment/list.ts (0 hunks)
  • apps/dashboard/lib/trpc/routers/deploy/project/list.ts (3 hunks)
  • go/apps/ctrl/services/deployment/deploy_workflow.go (1 hunks)
  • go/apps/ctrl/services/deployment/rollback.go (1 hunks)
  • go/pkg/db/deployment_update_rollback.sql_generated.go (0 hunks)
  • go/pkg/db/models_generated.go (1 hunks)
  • go/pkg/db/project_find_by_id.sql_generated.go (3 hunks)
  • go/pkg/db/project_update_deployments.sql_generated.go (1 hunks)
  • go/pkg/db/project_update_live_deployment_id.sql_generated.go (0 hunks)
  • go/pkg/db/querier_generated.go (2 hunks)
  • go/pkg/db/queries/deployment_update_rollback.sql (0 hunks)
  • go/pkg/db/queries/project_find_by_id.sql (1 hunks)
  • go/pkg/db/queries/project_update_deployments.sql (1 hunks)
  • go/pkg/db/queries/project_update_live_deployment_id.sql (0 hunks)
  • go/pkg/db/schema.sql (1 hunks)
  • internal/db/src/schema/deployments.ts (1 hunks)
  • internal/db/src/schema/projects.ts (1 hunks)
💤 Files with no reviewable changes (6)
  • apps/dashboard/lib/collections/deploy/deployments.ts
  • go/pkg/db/project_update_live_deployment_id.sql_generated.go
  • go/pkg/db/queries/project_update_live_deployment_id.sql
  • apps/dashboard/lib/trpc/routers/deploy/deployment/list.ts
  • go/pkg/db/queries/deployment_update_rollback.sql
  • go/pkg/db/deployment_update_rollback.sql_generated.go
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: mcstepp
PR: unkeyed/unkey#3952
File: apps/dashboard/app/(app)/projects/[projectId]/deployments/components/rollback-dialog.tsx:70-79
Timestamp: 2025-09-12T17:57:18.337Z
Learning: In the deployment rollback functionality, self-rollback scenarios are prevented at the UI level in the actions menu through the `canRollback` condition which includes `!("active" in deployment && deployment.active)`, making additional checks in the dialog component redundant.
📚 Learning: 2025-07-25T19:09:43.284Z
Learnt from: mcstepp
PR: unkeyed/unkey#3662
File: apps/dashboard/lib/trpc/routers/deployment/list.ts:11-11
Timestamp: 2025-07-25T19:09:43.284Z
Learning: In apps/dashboard/lib/trpc/routers/deployment/list.ts, the listDeployments procedure intentionally queries the versions table rather than a deployments table. The user mcstepp indicated that renaming the table would require a database migration, which was deferred for the current PR focused on UI features.

Applied to files:

  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts
  • internal/db/src/schema/deployments.ts
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx
  • apps/dashboard/lib/trpc/routers/deploy/project/list.ts
🧬 Code graph analysis (7)
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts (2)
go/pkg/db/models_generated.go (1)
  • Deployment (569-587)
apps/dashboard/lib/collections/deploy/deployments.ts (1)
  • Deployment (39-39)
go/apps/ctrl/services/deployment/deploy_workflow.go (4)
go/pkg/hydra/step.go (1)
  • StepVoid (303-311)
go/pkg/db/deployment_update_status.sql_generated.go (1)
  • UpdateDeploymentStatusParams (19-23)
go/pkg/db/models_generated.go (1)
  • DeploymentsStatusReady (200-200)
go/pkg/db/project_update_deployments.sql_generated.go (1)
  • UpdateProjectDeploymentsParams (22-27)
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx (2)
apps/dashboard/app/(app)/projects/[projectId]/deployments/hooks/use-deployments.ts (1)
  • useDeployments (8-120)
apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts (1)
  • getRowClassName (49-69)
go/pkg/db/project_find_by_id.sql_generated.go (1)
go/pkg/db/types/null_string.go (1)
  • NullString (10-10)
apps/dashboard/lib/trpc/routers/deploy/project/list.ts (2)
apps/dashboard/lib/collections/deploy/projects.ts (1)
  • projects (42-108)
internal/db/src/schema/projects.ts (1)
  • projects (8-34)
go/pkg/db/querier_generated.go (2)
go/pkg/partition/db/database.go (1)
  • DBTX (10-10)
go/pkg/db/project_update_deployments.sql_generated.go (1)
  • UpdateProjectDeploymentsParams (22-27)
go/apps/ctrl/services/deployment/rollback.go (1)
go/pkg/db/project_update_deployments.sql_generated.go (1)
  • UpdateProjectDeploymentsParams (22-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Build / Build
  • GitHub Check: Test Packages / Test
🔇 Additional comments (16)
go/pkg/db/queries/project_find_by_id.sql (1)

11-11: LGTM — projection updated to include rolled_back_deployment_id.

Keeps FindProjectById aligned with the new schema.

apps/dashboard/app/(app)/projects/_components/create-project/create-project-dialog.tsx (1)

43-44: rolledBackDeploymentId exists in schema — no action required.
internal/db/src/schema/projects.ts defines rolledBackDeploymentId and apps/dashboard/lib/collections/deploy/projects.ts declares it as z.string().nullable(), so create-project's rolledBackDeploymentId: null is compatible.

go/pkg/db/queries/project_update_deployments.sql (1)

1-7: Approve — single atomic project update in use; legacy rollback updater not found

UpdateProjectDeployments is generated (go/pkg/db/project_update_deployments.sql_generated.go) and invoked from go/apps/ctrl/services/deployment/deploy_workflow.go and rollback.go; no references to UpdateDeploymentRollback were found.

apps/dashboard/app/(app)/projects/[projectId]/deployments/hooks/use-deployments.ts (1)

116-119: Approved — call sites use project.rolledBackDeploymentId

Repo search shows no uses of deployment.isRolledBack in UI/TS files (only DB schema declares isRolledBack). UI/utils and API mapping use project.rolledBackDeploymentId — apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx, apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts, apps/dashboard/lib/trpc/routers/deploy/project/list.ts.

internal/db/src/schema/deployments.ts (1)

2-2: LGTM — removed boolean import aligns with column removal; verify lingering isRolledBack usages

Removal in internal/db/src/schema/deployments.ts looks correct. Found remaining references to isRolledBack / is_rolled_back — review/update these or confirm they're unrelated:

  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx
  • apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts
  • internal/db/src/schema/domains.ts
  • go/pkg/db/domain_find_by_deployment_id.sql_generated.go
  • go/pkg/db/domain_reassign.sql_generated.go
  • go/pkg/db/models_generated.go
  • go/pkg/db/querier_generated.go
  • go/pkg/db/queries/domain_find_by_deployment_id.sql
  • go/pkg/db/queries/domain_reassign.sql
  • go/pkg/db/schema.sql

Confirm these refer to the domains table (not deployments) or update/remove usages and regenerate affected generated code/assets.

apps/dashboard/lib/trpc/routers/deploy/project/list.ts (1)

14-21: Plumbing rolledBackDeploymentId end-to-end — LGTM

Selection, row typing, and mapping to Project look correct.

Also applies to: 36-37, 62-63

go/pkg/db/project_find_by_id.sql_generated.go (1)

23-24: Generated query + struct update — LGTM

Field is correctly selected, scanned, and exposed.

Also applies to: 31-41, 72-73

apps/dashboard/lib/collections/deploy/projects.ts (1)

14-15: Schema update — LGTM

New rolledBackDeploymentId is correctly added to the zod schema and typed.

apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/utils/get-row-class.ts (2)

49-58: Row styling update — LGTM

New rolled-back param and precedence (failed > rolled-back > default) look good.


49-53: No action required — deployments call site passes the new argument

apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx imports getRowClassName and calls it with three args: (deployment, selectedDeployment?.deployment.id ?? null, project?.rolledBackDeploymentId ?? null). No other imports of this utils file were found.

go/pkg/db/querier_generated.go (2)

598-606: FindProjectById exposure of rolled_back_deployment_id — LGTM


1698-1706: New UpdateProjectDeployments in Querier — LGTM

Interface reflects the consolidated project-level pointer update.

go/apps/ctrl/services/deployment/deploy_workflow.go (1)

396-405: Ready status step conversion — LGTM

StepVoid usage with UpdatedAt now/time is fine.

apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx (2)

49-50: Plumbing project from useDeployments: LGTM

This enables using project.rolledBackDeploymentId in UI logic.


63-64: Rolled-back detection via project ID: LGTM

Correct comparison against project.rolledBackDeploymentId.

go/pkg/db/models_generated.go (1)

717-727: Project.RolledBackDeploymentID addition looks correct; project-level usage migrated — domain-level is_rolled_back remains

Verified: project column and generated queries/models include rolled_back_deployment_id and UI/trpc use rolledBackDeploymentId (e.g. go/pkg/db/schema.sql, go/pkg/db/queries/project_update_deployments.sql_generated.go, go/pkg/db/models_generated.go, internal/db/src/schema/projects.ts, apps/dashboard/lib/trpc/... and deployments-list.tsx). No Deployment-level isRolledBack usages found. Remaining is_rolled_back/IsRolledBack references are domain-scoped (internal/db/src/schema/domains.ts, go/pkg/db/domain.go, apps/ctrl/services/deployment/{rollback.go,deploy_workflow.go}) and appear to be a separate flag.

@chronark chronark mentioned this pull request Sep 23, 2025
13 tasks
@chronark chronark merged commit 4d6fcc6 into main Sep 24, 2025
17 checks passed
@chronark chronark deleted the 09-23-fix_multiple_rolled_back_states branch September 24, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant