Skip to content

feat(db): add environments.machine_size (SUPER-3135) - #9706

Merged
harshithmullapudi merged 1 commit into
mainfrom
superset/environment-machine-size-migration
Nov 13, 2026
Merged

harshithmullapudi merged 1 commit into
mainfrom
superset/environment-machine-size-migration

Conversation

@harshithmullapudi

@harshithmullapudi harshithmullapudi commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Links

  • Linear: SUPER-3135 — bake default machine sizes into environments
  • Code that uses it: stacked PR on superset/cloud-environment-onboarding (opened right after this one)

Summary

  • Adds a nullable environments.machine_size text column: the size a workspace boots at when its create names none. null means the organization's default, which is every existing row.
  • Migration-only, per packages/trpc/AGENTS.md rule 10 and the db-migrations checklist, so the API change can be reverted on its own.

Migration safety (db-migrations checklist)

  • Statement: ALTER TABLE "environments" ADD COLUMN "machine_size" text; — no default and nullable, so Postgres only updates the table's metadata. There is no rewrite and no scan, just a brief ACCESS EXCLUSIVE lock on environments.
  • Size: environments is about 176 kB / 229 rows (measured on this workspace's Neon branch, which was copied from production today). It is not one of the hot tables (auth.*, automation_events, ingest.webhook_events), and no job holds it open.
  • Lock order: a single table, with no foreign keys added.
  • Not rehearsed under load: nothing in it locks a hot table or rewrites or scans a large one, so the size and lock checks are enough (per the skill).
  • Generated with drizzle-kit generate, not hand-edited. The snapshot's prevId chains to 0192.
  • Applied with PGOPTIONS="-c lock_timeout=5s -c statement_timeout=60s" bunx drizzle-kit migrate, to this workspace's own Neon branch only (br-misty-firefly…, a non-default child branch).

Known deviation

  • The checklist asks for no tRPC output change in a migration PR. environment.list / get / create / update select every column, so their output gains machineSize: null once this lands. That's additive, and no client reads it until the stacked PR ships.

Rollout / Rollback

  • Order: merge and deploy this first. The stacked code PR reads and writes the column.
  • Rollback: nothing reads the column until the code PR lands, so a revert is a plain DROP COLUMN migration if it's ever needed.

Summary by cubic

Adds a nullable environments.machine_size column that stores the machine size a workspace boots at when its create names none; null means the organization's default, which is every existing row. This is migration-only — the API change that reads and writes the column ships in the stacked PR on superset/cloud-environment-onboarding, so this migration can be reverted on its own.

  • No default and nullable, so Postgres only updates the table's metadata on environments (~229 rows, not a hot table); no rewrite or scan, just a brief lock.
  • Generated with drizzle-kit generate and applied only to this workspace's Neon branch.
  • Rollback is a plain DROP COLUMN migration since nothing reads the column yet.

Known deviation

  • environment.list / get / create / update select every column, so their output gains machineSize: null once this lands; additive, and no client reads it until the stacked PR ships.

Written for commit 2b365bd. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • New Features
    • Environments can now store a machine size for workspace startup. If none is specified, the organization default is used.

A nullable text column for the machine size a workspace boots at when its
create names none; null means the organization's default. Nothing reads or
writes it yet: the API change that uses it ships separately, after this
migration is applied.

The column is added without a default, so Postgres only changes the table's
metadata: no rewrite, a brief lock on `environments` (about 230 rows; not a
hot table).
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The environments table gains a nullable machine_size text column. The schema documents that a null value uses the organization default. Migration 193 adds the column and is recorded in the migration journal.

Changes: Environment machine size

Layer / File(s) Summary
Add the environment machine size field
packages/db/src/schema/schema.ts, packages/db/drizzle/0193_environment_machine_size.sql, packages/db/drizzle/meta/_journal.json
The schema declares nullable machineSize. Migration 193 adds the machine_size column to environments, and the journal records the migration.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: kitenite, saddlepaddle

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title uses conventional commit format and names the main change: adding the nullable environments.machine_size column in the db package. It matches the migration, journal, and schema changes in th…
Description check Passed The description covers the required template areas. The 'What & why' content is present: it links SUPER-3135, explains the nullable column, and states that null means the organization default. The 'Ho…
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.
Full details: Title check

Explanation

The title uses conventional commit format and names the main change: adding the nullable environments.machine_size column in the db package. It matches the migration, journal, and schema changes in the raw summary. The ticket reference is extra detail and does not reduce clarity.

Full details: Description check

Explanation

The description covers the required template areas. The 'What & why' content is present: it links SUPER-3135, explains the nullable column, and states that null means the organization default. The 'How I tested it' content is partly covered. It gives migration safety analysis and the Neon branch the migration was applied to, but it does not describe a direct functional test or include screenshots. Those are not needed for a migration-only change. The checklist items are not ticked, and the description does not confirm that bun run lint and bun run typecheck pass, or that the CLA is signed. The template's checklist is not reflected in the description.

Resolution

Consider confirming in the description that bun run lint and bun run typecheck pass, and tick the applicable checklist items (conventional-commit title, CLA signed, maintainer edits allowed for fork PRs if applicable). Optionally state how the migration was verified beyond the Neon branch application.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Review coverage is incomplete: 1 file could not be fully reviewed. Findings from completed review steps are included; see review info for details.

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a0a226f7-3244-49fb-9232-4e1a58069189
Commits

Reviewing files that changed from the base of the PR and between a67609c and 2b365bd.

Files selected for processing: 4

  • packages/db/drizzle/0193_environment_machine_size.sql
  • packages/db/drizzle/meta/0193_snapshot.json
  • packages/db/drizzle/meta/_journal.json
  • packages/db/src/schema/schema.ts
Files not fully reviewed because they exceed a per-file size limit: 1

  • packages/db/drizzle/meta/0193_snapshot.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@github-actions

github-actions Bot commented Nov 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! 🎉

@expo

expo Bot commented Nov 13, 2026

Copy link
Copy Markdown

Preview update published for development build 1b1443b5 (fingerprint 315789730588). Open the build on your phone and scan:

Update group ee72c662

Copy link
Copy Markdown
Contributor

Review verdict: looks good. It is a metadata-only ADD COLUMN on a small, cold table (environments, ~176 kB / 226 rows). The generated files are consistent, and CI is green at 2b365bde.

Findings:

  • Nit (optional), packages/db/src/schema/schema.ts:828: consider text("machine_size").$type<MachineSize>() so the stacked PR reads a typed value. The other machine_size columns (:987, :1760) are plain text too, so it is fine to keep them the same.

Verified: the 0193 snapshot prevId chains to 0192, and only the new column differs. drizzle-kit generate reports no drift. drizzle-kit migrate with lock_timeout=5s/statement_timeout=60s applies cleanly on the review workspace's own Neon branch. db and trpc typecheck pass.

Full report: https://app.superset.sh/page/pr-9706-review-environments-machine-size-migration-rv08yc

@harshithmullapudi
harshithmullapudi merged commit f731e1b into main Nov 13, 2026
20 checks passed
@harshithmullapudi
harshithmullapudi deleted the superset/environment-machine-size-migration branch November 13, 2026 08:20
@harshithmullapudi
harshithmullapudi restored the superset/environment-machine-size-migration branch November 13, 2026 08:20
@harshithmullapudi
harshithmullapudi deleted the superset/environment-machine-size-migration branch November 13, 2026 08:21

This branch was previously deployed

1 inactive deployment
preview — 2b365bde Deployed Nov 13, 2026 by harshithmullapudi via Cleanup Preview Resources #5572
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.

2 participants