Skip to content

feat(projects): move Project membership to the workspace column - #8830

Merged
mzxchandra merged 33 commits into
stagingfrom
feat/project-workspace-column-expand
Oct 10, 2026
Merged

mzxchandra merged 33 commits into
stagingfrom
feat/project-workspace-column-expand

Conversation

@mzxchandra

@mzxchandra mzxchandra commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prepare the move from project_workspace to workspace.project_id with one authoritative membership representation in each phase. This compatible release continues to work while #8590 performs the backfill and after it retires the connector.

  • Add nullable membership, the restrictive Project FK, and a concurrent index in SQL 0406, after upstream OAuth 0405. No bulk backfill runs in this release.
  • Connector-mode writes remain connector-only. The checked singleton selects authority transactionally; column-mode writes use the workspace column and reads fall back to the connector only for unassigned legacy rows.
  • The shared workspace barrier coordinates the authority switch, including snapshot ordering. Account teardown deletes workspaces before Projects. Public workspace response shapes remain unchanged.
  • Record the final storage and enforcement decisions in packages/db/PROJECT_MEMBERSHIP.md. Project non-emptiness and archive lifecycle belong to application transactions. Release 2 uses native composite FKs for organization and connected-fork consistency, with no custom integrity/synchronization triggers or artificial Project row updates. project.updated_at remains ordinary metadata.

Rollout and rollback

Deploy this release, then verify that concrete incompatible membership-sensitive requests and independently scheduled workers have drained. The all-at-once application traffic switch stops fresh requests to retired servers; container retention alone is not evidence of a membership writer.

Only then deploy #8590. Its migration switches authority, performs all bounded backfill/reconciliation, validates final constraints, and atomically drops the connector and rollout marker while this release still serves traffic. No new infrastructure maintenance mechanism or third compatibility release is required.

After the authority switch, this release is the oldest supported application rollback. Keep the database changes; do not reset authority or deploy pre-#8830 code. This release recognizes a completed schema without either temporary table by checking required membership and the three validated membership foreign keys. A missing marker in an incomplete schema is an error.

Validation

Current-head focused local proof: three real PostgreSQL application tests passed for marker-free reads/writes, rejection of incomplete schemas, authority barriers, and snapshot ordering; eight billing lock-order unit tests passed. Merged current staging and retained its billing test synchronization fix.

Earlier local Docker/HTTP proof (before marker removal):

  • This release created and forked in connector mode, leaving workspace columns NULL.
  • The actual release-2 migration runner preserved those Project assignments, installed the native constraints, retired the connector, and recorded completion while the same release-1 dev server remained running.
  • Nine HTTP smoke checks then passed on that same server, covering authenticated workspace/Project creation, reads, fork inheritance, subtree disconnection and archival, plus fixture cleanup.
  • Real account-deletion preview/POST also passed and removed the fixture's workspaces and Projects.

These local requests prove compatibility, not production drain completion. Full CI runs on GitHub Actions; no full local suite was run. Downstream #8609/#8610 still need synchronization with the revised stack and its recorded decisions.

Current hosted status

Head 5dc6f90e5a fixes the real-Drizzle authority result and subquery routing in workspace-move fixtures. All 24 workspace-move tests pass locally. Both Greptile findings were answered individually and resolved. CI and both reviews were retriggered for this head; results remain pending: https://github.com/simstudioai/sim/actions/runs/38085210891.

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Oct 10, 2026 9:29pm UTC

Request Review

@mzxchandra mzxchandra changed the title feat(projects): prepare workspace project column compatibility feat(projects): move Project membership to the workspace column Oct 9, 2026
@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile review

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic review

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 25 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/db/migrations/0404_workspace_project_column.sql Outdated
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical impact] This PR appears safe to merge, with no new actionable issue found.

Summary

This PR prepares Project membership to move from project_workspace to workspace.project_id.

  • Adds nullable membership, a restrictive foreign key, a concurrent index, and a checked authority marker.
  • Keeps connector-only writes before cutover. After cutover, reads prefer the column and fall back only for unassigned legacy rows.
  • Coordinates cutover with workspace locks, deletes workspaces before Projects, and keeps public workspace responses unchanged.
  • No new actionable issue was found. This review used the full PR diff because the previous and current heads have different merge bases.
  • mzxchandra accepted the higher-branch creation, error-import, and account-deletion changes as required downstream work before feat: establish shared file ownership foundation #8609/feat(files): add the Project file backend and APIs #8610 ship. Those existing findings were not reposted.
  • mzxchandra previously accepted temporary fork/disconnect failures during overlap. Connector-only writes now remove the cause of that earlier failure.
  • Checks were by code inspection; no tests were run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Begin membership transaction] --> B[Hold workspace read lock]
  B --> C{Membership authority}
  C -->|Connector| D[Read and write connector membership]
  C -->|Column| E[Write workspace membership]
  E --> F[Read column; fall back only for NULL legacy rows]
  D --> G[Commit]
  F --> G
  H[Release 2 takes exclusive workspace lock] --> I[Switch authority]
  I --> J[Backfill and validate constraints]
  J --> K[Remove connector and marker atomically]
Loading

Reviews (22) · Last reviewed commit: "Merge remote-tracking branch 'origin/sta..." · Reviewed by Greptile

Comment thread packages/db/migrations/0404_workspace_project_column.sql Outdated
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

@mzxchandra

Copy link
Copy Markdown
Contributor Author

The removed-helper warning is a required downstream integration step. #8830 and #8590 use createProjectRecord before inserting workspace.project_id in the same transaction; the connector-based createProjectForWorkspace must not be restored. #8609 and #8610 must merge the final #8590 head and reconcile their creation/fixture callers before merging. Their shared foundation files are still awaiting that parent synchronization, so local feature-specific conversions alone do not establish a green combined stack. Preserve the downstream account-deletion storage cleanup effects and deferred Project deletion when resolving those conflicts.

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 26 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/db/migrations/0404_workspace_project_column.sql Outdated
@cubic-dev-ai

cubic-dev-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 34 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

…pace-column-expand

# Conflicts:
#	apps/sim/lib/billing/webhooks/stripe-sync-convergence.integration.ts
@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile Please review current head 467d269, including the staging merge and completed-schema detection that allows PR #8590 to remove the rollout marker while this release remains serving and rollback-compatible.

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 34 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/testing/src/mocks/database.mock.ts
Comment thread apps/sim/lib/workspaces/admin-move.test.ts
@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile Please re-review head 5dc6f90. Both fixture findings are fixed and individually answered; all 24 workspace-move tests pass locally.

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 34 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@mzxchandra
mzxchandra marked this pull request as ready for review October 10, 2026 20:57

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 34 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

Turn on auto-fix | Re-trigger cubic

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile

@mzxchandra

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@mzxchandra I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 34 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@mzxchandra
mzxchandra force-pushed the feat/project-workspace-column-expand branch from 744885c to 34798aa Compare October 10, 2026 21:22
@mzxchandra
mzxchandra merged commit 3492598 into staging Oct 10, 2026
36 of 37 checks passed
@mzxchandra
mzxchandra deleted the feat/project-workspace-column-expand branch October 10, 2026 21:37

This branch was successfully deployed

1 active deployment
Preview — 34798aa2 Deployed Oct 10, 2026 by vercel[bot]
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.

2 participants