chore(host-service,trpc,cli,desktop): decouple the app from v2_projects

Merged
SA
3mo ago
+115-530

Severs the app's remaining dependence on the cloud v2_projects table, so it can be dropped later and the projects name reclaimed for the cloud-only projects model. This PR does not drop the table.

Prior audit found zero v2Project.* callers in desktop/mobile/CLI/SDK/MCP — only host-service call sites remained. Re-verified before editing.

Removed

  • dead v2Project procedures list/create/update (zero callers) + their orphaned helpers
  • project.setup's cloud-lookup fallback: origin now comes from the local row or the origin param. When neither is present it throws a typed NOT_FOUND with a mode-specific message (same status the cloud lookup produced for this case, so no client behavior flips)
  • the "legacy adopt only" linkRepoCloneUrl write-back and the fire-and-forget v2Project.delete cleanup in project.remove
  • project-backfill's cloud arm — now a pure local sweep (kept: it still writes real names and emits project:changed, which readers depend on)
  • the automation router's verifyProjectInOrg + 4 call sites — already a no-op for local-first projects; real authorization is verifyHostAccess
  • isInternalBuild() (zero callers after #6434) and plans/host-integration-test.md → plans/done/ (it cited tests/docs deleted in #6434)

Kept, fenced: findByGitHubRemote in project.findByPath, reachable only via walkAllRemotes: true from the v1→v2 importer. Commented as the last v2_projects consumer, dying with the importer. Verified by grep: it is now the only production v2Project.* call repo-wide.

Callers updated to pass origin

  • CLI projects setup: new --repo-url/--name flags plus automatic resolution (explicit flags → target host's project.list → this machine's host service → actionable error). Existing invocations keep working with no new flags
  • desktop v1-migration: passes origin from the candidate findByPath already returned, mirroring SetupProjectModal

Tests: adapted rather than deleted — cloud-fallback cases became origin-based equivalents, plus a new test asserting the failure path for both clone and import and that zero v2Project.* calls occur.

Verification: lint exit 0 · typecheck exit 0 (37/37) · sherif exit 0 · cli 99/99 · desktop 2695/2695 · host-service 1069 pass with 3 failures, all pre-existing/flaky under parallel load and in files untouched here (confirmed passing in isolation); the 5 modified test files run together 76/76.

Follow-up: v2Project.get/delete/linkRepoCloneUrl now have zero callers but were left in the router — they cost nothing until the table drop and can go with it.

Follows #6431, #6434, #6435 in the Sandbox Workspaces cleanup track.


Summary by cubic

Decouples the app from the cloud v2_projects table. project.setup no longer falls back to a cloud lookup; previously it used the cloud row, now it uses the local row or a caller-provided origin and returns NOT_FOUND when neither exists.

  • Removes dead v2Project.list/create/update procedures and cloud write-backs; project-backfill is now a pure local sweep.
  • Required migration: callers setting up a project on a host with no local row must pass origin.repoCloneUrl (and optionally origin.name).
  • CLI projects setup adds --repo-url and --name, with auto-resolution from the target or local host; existing invocations keep working.
  • Desktop v1 migration now supplies origin. Automation router drops legacy verifyProjectInOrg; authorization remains verifyHostAccess.
  • Keeps one fenced cloud use: findByGitHubRemote in project.findByPath, reachable only via the v1→v2 importer.
  • Removes isInternalBuild() and retires plans/host-integration-test.md. Tests assert the origin path and zero v2Project.* calls.

Summary by CodeRabbit

  • New Features

    • Project setup now accepts optional repository URL and project name values.
    • Imported projects retain their repository origin and name during setup.
    • Setup can automatically use available local project information.
  • Changes

    • Project creation and updates are no longer available through the project API.
    • Project setup and deletion now operate locally without cloud project synchronization.
    • Setup reports a clear error when repository details are unavailable and must be provided manually.
  • Documentation

    • Added an integration testing plan covering host sessions, persistence, restarts, and supported client flows.