Skip to content

chore(trpc,db): shrink the v2_projects surface ahead of its removal - #6439

Merged
saddlepaddle merged 1 commit into
mainfrom
chore/next-teardown
Aug 13, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
chore/next-teardown

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Prework for dropping v2_projects and reclaiming the projects name. Does not drop the table.

Removed

State after this PR: v2_projects has no inbound FKs and one consumer repo-wide — findByGitHubRemote, called by the v1→v2 importer so an imported repo reuses its existing cloud project id.

Why the table still can't drop

Two things I checked that change the picture:

  1. No shipped desktop version subscribes to the v2_projects Electric shape — verified across 1.15, 1.17, 1.19, and 1.20.2. So unlike workspaces/agent_commands/v2_clients, this table is not gated on old-build adoption.
  2. The v1 importer is live and ramping: ~67 auto-migrations completed and ~68 bulk imports this week (both were zero through July — the auto-migration rollout just started). Removing its cloud lookup now would give mid-migration users fresh project ids per device.

So v2_projects's gate is the v1 migration finishing, not Electric adoption — a different and likely shorter clock.

Note on agent_commands

Worth recording: it is not droppable yet despite having zero code references. desktop-v1.19.0 subscribes to its Electric shape (~2,000 weekly users), even though 1.20.2 does not. Any table drop must be checked against every version still in use, not just the latest.

I re-verified the already-merged drops on that basis: device_presence, secrets, and sandbox_images were subscribed by no shipped version (1.15 → 1.20.2), so #6431 and #6435 were safe.

Verification: lint exit 0 · typecheck exit 0 (36/36).


Summary by cubic

Shrinks the v2_projects surface ahead of its removal by deleting unused TRPC procedures and dropping the v2_workspaces.project_id foreign key. This keeps data intact and preserves the importer’s lookup via findByGitHubRemote. The table is not dropped.

  • Removes v2Project.get, v2Project.linkRepoCloneUrl, and v2Project.delete; only v2Project.findByGitHubRemote remains for the v1→v2 importer.
  • Drops the v2_workspaces.project_id → v2_projects.id foreign key via migration 0069; the column stays as a bare uuid (same shape as automations.v2_project_id from 0062).
  • Behavior change: the deleted procedures are no longer callable; no internal callers remain.

Rollout

  • Run migration 0069. No client changes required.
  • Do not drop v2_projects yet. The importer still uses it, while no shipped desktop versions subscribe to its Electric shape. Proceed with the table drop after the importer completes.

Written for commit 318f073. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Changes
    • Project services now support GitHub remote lookup only.
    • Removed project retrieval, repository-linking, and project-deletion operations from the available project tools.
    • Updated workspace/project relationship handling to allow greater flexibility when managing workspace records.

Deletes the three v2Project procedures left with zero callers after #6436 (get, linkRepoCloneUrl, delete) and drops the v2_workspaces.project_id foreign key, keeping the column as a bare uuid — the same shape automations.v2_project_id took in 0062.

After this, v2_projects has no inbound FKs and exactly one consumer repo-wide: findByGitHubRemote, called by the v1 to v2 importer. No shipped desktop version subscribes to the v2_projects Electric shape (verified across 1.15 through 1.20.2), so the table's only remaining gate is the importer, which is still live: ~67 auto-migrations and ~68 bulk imports this week as the rollout ramps.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 56f591cc-71ef-4df7-988f-821127dd4480

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae3f41 and 318f073.

📒 Files selected for processing (5)
  • packages/db/drizzle/0069_drop_v2_workspaces_project_fk.sql
  • packages/db/drizzle/meta/0069_snapshot.json
  • packages/db/drizzle/meta/_journal.json
  • packages/db/src/schema/schema.ts
  • packages/trpc/src/router/v2-project/v2-project.ts

📝 Walkthrough

Walkthrough

This change removes the foreign-key relationship from v2Workspaces.projectId and removes the get, linkRepoCloneUrl, and delete procedures from v2ProjectRouter.

Changes

V2 project cleanup

Layer / File(s) Summary
Workspace project relationship cleanup
packages/db/src/schema/schema.ts, packages/db/drizzle/0069_drop_v2_workspaces_project_fk.sql, packages/db/drizzle/meta/_journal.json
The schema keeps v2Workspaces.projectId as a required UUID without a foreign-key reference. A migration drops the existing constraint and records the migration.
V2 project router reduction
packages/trpc/src/router/v2-project/v2-project.ts
The router now exposes only findByGitHubRemote. The get, linkRepoCloneUrl, and delete procedures and related logic were removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 318f0

This PR removes unused procedures and the obsolete workspace foreign key while retaining the remaining project lookup. No actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested reviewers: kitenite

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses conventional commit format and clearly summarizes the removal of unused tRPC procedures and foreign-key preparation.
Description check ✅ Passed The description explains the changes, rationale, rollout constraints, testing results, and retained importer dependency; the checklist is omitted but non-critical.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/next-teardown

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.

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit 38d0011 into main Aug 13, 2026
26 of 27 checks passed

This branch was previously deployed

1 inactive deployment
preview — 318f073e Deployed Aug 13, 2026 by saddlepaddle via Deploy Admin #7671
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