Skip to content

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

Open
mzxchandra wants to merge 33 commits into
stagingfrom
feat/project-workspace-column-expand
Open

mzxchandra wants to merge 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.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 10, 2026 9:12pm 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] The latest changes appear safe to merge and address both previous workspace-move test failures.

Summary

Prepares Project membership to move from project_workspace to workspace.projectId. Reads and writes follow the database’s current membership mode, and account deletion removes workspaces before Projects.

  • The latest changes supply the authority result for real Drizzle SQL and route the Project lookup to the correct workspace fixtures. Both previous test findings are addressed.
  • No new actionable issues were found in the changes since the previous review. Tests were not run during this review.
  • mzxchandra accepted the higher-branch account-deletion and removed-helper findings as required downstream changes for feat: establish shared file ownership foundation #8609/feat(files): add the Project file backend and APIs #8610, not completed fixes.
  • mzxchandra likewise accepted the moved ProjectConflictError imports as required downstream changes outside this PR’s scope.
  • mzxchandra previously accepted temporary fork/disconnect failures during mixed-version deployment. The current connector-only writes before the authority switch supersede that earlier tradeoff.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Begin membership transaction] --> B[Hold workspace barrier]
  B --> C{Membership mode}
  C -->|Connector| D[Read and write connector membership]
  C -->|Column| E[Read and write workspace membership]
  E --> F[Use connector fallback for unassigned legacy rows]
  D --> G[Commit]
  F --> G
Loading

Reviews (21) · Last reviewed commit: "test(projects): model expansion authorit..." · 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
Comment thread apps/sim/lib/projects/membership.ts
@mzxchandra

Copy link
Copy Markdown
Contributor Author

@greptile Please re-review the current head and the individual thread evidence. Downstream import adaptations are explicitly recorded as required follow-up outside these PRs; no downstream completion is claimed.

@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

…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

This branch was previously deployed

1 inactive deployment
Preview — 744885c5 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