Skip to content

feat(projects): enforce Project membership and retire the connector - #8590

Draft
mzxchandra wants to merge 69 commits into
feat/project-workspace-column-expandfrom
codex/project-entity-enforcement
Draft

mzxchandra wants to merge 69 commits into
feat/project-workspace-column-expandfrom
codex/project-entity-enforcement

Conversation

@mzxchandra

@mzxchandra mzxchandra commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Complete the two-release migration to workspace.project_id. feat(projects): move Project membership to the workspace column #8830 supplies compatible column-based readers/writers; this PR enforces membership and retires project_workspace.
  • Prepare legacy data with apps/sim/scripts/backfill-projects.ts: read-only plan, reviewed archive repair, bounded apply, verify, and status. Persist private manifests/reports for resume; preserve existing assignments and stop on ambiguous or changed families.
  • Start at 50 independent workspaces per transaction, keeping each fork family atomic. Use nonblocking writer-compatible locks, NOWAIT row locks, transaction/statement limits, adaptive batch reduction, bounded retries, committed progress, and graceful interruption.
  • Repair archived environments through the shared workflow/archive cascade and require external provider cleanup to succeed. Replays retain the original workflow identities so cleanup can finish after a committed archive. Busy locks and transient database failures defer that environment while unrelated repairs continue; permanent/provider failures still fail the run.
  • Support PG16 statement/idle-transaction limits and PG17+ total transaction limits; CI runs preparation and enforcement on both versions.
  • Prevent db:push from contracting existing Project databases; retained data must complete the reviewed migration path. Fresh schema push installs the same permanent lifecycle enforcement as SQL migrations.
  • Require verification artifacts and a conflict-free reviewed plan, report fully assigned split families as conflicts, wait for every bounded cleanup worker before reporting a strict failure, and invalidate MCP caches/notifications on failure. Validate artifact byte limits before publishing files. Every database-backed command coordinates with enforcement through the same nonblocking maintenance lock. Read-only commands honor cancellation; offline status stays available and its exit code reflects the saved outcome.
  • SQL 0405 trigger locks reject contention with retryable 55P03 before waiting with a row lock; application operations retain their existing mutex order.
  • SQL 0405 validates prepared data, enforces membership/lifecycle constraints, and atomically removes the temporary bridge and connector. Deployment preflight rejects incomplete preparation; the CLI and SQL migration exclude simultaneous execution.

This is release 2 of 2. Fully deploy #8830 to production and verify that pre-#8830 application tasks and relevant background jobs have drained before merging this PR into staging. Run the reviewed preparation tool separately for each target database before its #8590 migration. Run verify with both the manifest and report to check pending external cleanup as well as database invariants. Keep the artifacts in durable private job storage. #8830 is the oldest supported application rollback release after enforcement and connector removal; retain the contracted schema during rollback.

Type of Change

  • New feature

Testing

  • All 170 PostgreSQL integration checks passed on PG17, plus 69 Project preparation/contract/bridge and schema-push checks on PG16. These cover real CLI interruption/resume, lost checkpoints, batch rollback, stale plans, contention/timeouts, migration refusal/replay, and SQL/CLI exclusion.
  • All 31 Project/application repair checks passed on the migrated schema; all 27 Project application checks passed on the schema-push database. The full-schema repair test uses real Redis and held HTTP notifications to prove all cleanup workers settle before failure, cache invalidation still occurs, and replay completes the committed archive. Three additional cases hold workspace, Project and row locks, prove unrelated repairs complete, and resume the deferred target after release.
  • New regressions fail on their prior implementations: direct-write lock contention, artifact-free verification, split-family discovery, strict cleanup completion, oversized plan publication, read-only scan cancellation and maintenance-lock exclusion, status exit codes, and verification of previously conflicted plans. Removing the initial SQL archive precheck also makes its regression fail. All guards were restored before the passing runs.
  • 19 live HTTP checks / 31 requests passed with the compatible app running before and after connector removal. A held workflow-create transaction made backfill defer while an unrelated workflow creation proceeded. A large synthetic full-schema benchmark measured about 43 ms local p95 for batches of 50; this is not a production latency guarantee.
  • Fresh schema-push provisioning installs lifecycle enforcement; populated legacy databases refuse unsafe schema push before DDL. The inherited billing concurrency regression passed 36 checks on both provisioning paths, and 36 deadline-related billing unit checks passed with stable clocks.
  • Full root tests, 26 workspace type checks, lint, 58 audits, workflow lint, generated-artifact checks, migration safety and Drizzle schema consistency passed. Block-registry validation passed against staging. Hosted validation and the separate desktop end-to-end run passed every applicable job on 4025e5a4b8.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Focused tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 2, 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 9, 2026 10:16am UTC

Request Review

@mzxchandra mzxchandra changed the title feat(projects): enforce membership after the staged backfill feat(projects): backfill and enforce membership in SQL Oct 3, 2026
@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 150 files

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 apps/sim/scripts/backfill-projects.ts Outdated
Comment thread apps/sim/scripts/backfill-projects.ts Outdated
@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 150 files

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 apps/sim/scripts/backfill-projects.ts
@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 150 files

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 apps/sim/scripts/backfill-projects.ts Outdated
@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 150 files

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 apps/sim/scripts/backfill-projects.ts
@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.

No issues found across 150 files

Confidence score: 5/5

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

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 successfully deployed

1 active deployment
Preview — 4025e5a4 Deployed Oct 9, 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.

1 participant