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

Merged
SA
3mo ago
+6289-143

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

Removed

  • v2Project.get, v2Project.linkRepoCloneUrl, v2Project.delete — all left with zero callers by #6436. findByGitHubRemote remains, fenced
  • the v2_workspaces.project_id → v2_projects foreign key (migration 0069). The column stays as a bare uuid, exactly the shape automations.v2_project_id took in 0062

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.

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.