feat(db): add v2_hosts.allow_cloud_workspaces

Merged
HA
16h ago
+17311-0

Stack: 1 of 3 — this PR → API + relay → desktop + CLI. Merge in order.

Summary

  • Adds v2_hosts.allow_cloud_workspaces boolean NOT NULL DEFAULT false: whether a host's owner lets their cloud workspaces reach it through the relay.
  • Schema only. Nothing reads or writes it until the next PR in the stack, apart from host.ensure returning it as part of the row.

Why / Context

A customer (lucas@traceroot.ai) reported that from a cloud workspace superset hosts list shows their Mac offline and --host calls fail with "Session expired". Making that work needs a per-host opt-in, and this column is where it lives. Related: SUPER-2661, SUPER-2852.

Migration safety

  • One statement: ALTER TABLE "v2_hosts" ADD COLUMN "allow_cloud_workspaces" boolean DEFAULT false NOT NULL;
  • A constant default on Postgres 11+ is metadata-only: no table rewrite, only a brief lock on v2_hosts. That table is not in the hot-table list in .agents/skills/db-migrations/SKILL.md, and no job holds it open.
  • No tRPC input or procedure change in this PR, per rule 10 / the checklist. One side effect: host.ensure returns the whole row, so its output gains allowCloudWorkspaces. That's additive and safe for released clients.
  • Not rehearsed under load, because it locks only v2_hosts briefly and scans nothing. I did not check production table sizes (no production access from here).
  • Applied to this workspace's Neon dev branch with the neon-serverless migrator; the column read back as boolean, default false. Note: it was applied there as 0189 before main gained its own 0189, so that dev branch needs a reset before applying this one cleanly.

Testing

  • bun run typecheck in packages/db
  • drizzle-kit generate on top of main produced only the one statement above.

Rollback

Forward-only and inert on its own. Reverting the PR before the next one merges leaves no reader. After that, roll back the API PR first.


Summary by cubic

Adds v2_hosts.allow_cloud_workspaces, a boolean column defaulting to false, so a host's owner can opt in to letting their cloud workspaces reach it through the relay. Schema only — nothing reads or writes it until the next PR in the stack.

  • A customer (lucas@traceroot.ai) reported superset hosts list showing their Mac offline and --host calls failing with "Session expired" from a cloud workspace; related to SUPER-2661 and SUPER-2852.
  • The migration is one ALTER TABLE with a constant default, which is metadata-only on Postgres 11+: no table rewrite, only a brief lock on v2_hosts.
  • Rollback is a revert before the next PR merges; after that, roll back the API PR first.

Summary by CodeRabbit

  • Updates
    • Host configuration now includes a setting that determines whether cloud workspaces can reach the host through the relay. The setting defaults to off, so cloud workspace access remains unavailable unless it is enabled. This provides a clear default for host access while allowing configurations to specify whether cloud workspace connections are permitted.