Skip to content

[EN-1892] feat(db): migrate existing default team names to project naming - #3334

Merged
Kraci merged 5 commits into
mainfrom
migrate-existing-default-team-team-names-to-projects-en-1892
Jul 23, 2026
Merged

Kraci merged 5 commits into
mainfrom
migrate-existing-default-team-team-names-to-projects-en-1892

Conversation

@Kraci

@Kraci Kraci commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

Final part of the teams → projects rename stack (PR 1: dashboard copy + banner, PR 2: provisioning generator — merged). New signups now get "Personal Project" / "'s Project", but existing rows still hold the old generated names. This data-only migration renames those rows so existing users stop seeing stale "Default Team" naming in the dashboard.

What it does

Renames only the two exact forms the old generator (provisioning/names.go) ever produced:

  • Default Team → Personal Project (exact match)
  • <Word>'s Default Team → <Word>'s Project (suffix-anchored)

Customer-chosen names that merely contain the phrase (e.g. "My Default Team Stuff", "Best Team") are untouched. Slugs, IDs, memberships, API keys, and every other column are unchanged — verified that team_slug_trigger fires BEFORE INSERT only, so a name UPDATE cannot regenerate slugs.

Safety design

  • Rollback map captured atomically: affected (id, old_name) rows are snapshotted into _backup_teams_default_team_rename in the same transaction as the update. Exact restore is a single UPDATE … FROM (documented in the migration); a follow-up migration drops the table after a soak period.
  • Idempotent: a re-run matches zero rows.
  • Observable: per-branch row counts are RAISE NOTICEd into migrator logs.
  • Down is a deliberate no-op: a pattern-based reverse would rewrite teams legitimately named "…'s Project" before this ran.

Verified locally against Postgres 16 with the real slug trigger: six seed cases (bare, possessive, mid-string, "Best Team", name==email, unrelated) — only the first two change, second run is a no-op, and the restore drill from the backup table reproduces the original state exactly.

Pre-merge gates (do not merge until checked)

  • Prod pre-flight recorded in this PR: per-branch counts + sample review (see pre-flight comment below; raw sample kept off this public PR — it contains customer-derived names)
  • PR 2 generator deployed to prod — as of 2026-07-22 old-style names are still being created (280 in the last 24h), so running this now would leave a moving target. Verify new signups get "Personal Project" before merging.
  • Second reviewer with prod restore authority named and approved
  • Follow-up ticket filed to drop _backup_teams_default_team_rename after soak

Known accepted non-effects: billing/Stripe keep the provisioning-time name on historical invoices; rows where name equals the user's email stay as-is (handled by the render-time transform from PR 1); mid-string stragglers remain by design.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

EN-1892

@cla-bot cla-bot Bot added the cla-signed label Jul 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc0b23db25

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@blacksmith-sh

blacksmith-sh Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
github.com/e2b-dev/infra/packages/api/internal/sandbox/storage/redis/
TestStorageLocker_ObtainUsesProvidedContext
View Logs

Fix with Codesmith
Need help on this PR? Tag /codesmith with what you need.

@codecov

codecov Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
3469 3 3466 9
View the top 3 failed test(s) by shortest run time
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN
Stack Traces | 0s run time
=== RUN   TestTemplateBuildRUN
=== PAUSE TestTemplateBuildRUN
=== CONT  TestTemplateBuildRUN
--- FAIL: TestTemplateBuildRUN (0.00s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildFromTemplateStartCommand
Stack Traces | 163s run time
=== RUN   TestTemplateBuildFromTemplateStartCommand
=== PAUSE TestTemplateBuildFromTemplateStartCommand
=== CONT  TestTemplateBuildFromTemplateStartCommand
    build_template_test.go:133: test-ubuntu-start-base: [info] Building template n219nbkfxg9w3ftrxiy5/684dafc8-4ff4-4b06-86c3-be1a987b3136
    build_template_test.go:133: test-ubuntu-start-base: [info] [base] FROM ubuntu:22.04 [f9f564014e009a9561a82bf8c84f9314242971e833fb019936654ecba452f184]
    build_template_test.go:133: test-ubuntu-start-base: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-ubuntu-start-base: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-ubuntu-start-base: [info] Uncompressing layer sha256:d6834b4a794c03efa2c998853e64969fa8851b11b2ade63292268872a37759d0 30 MB
    build_template_test.go:133: test-ubuntu-start-base: [info] Uncompressing layer sha256:fe2a51aa6130489d11431e164fcf026637492f7cf0cbde8eef218b8c39c0ad8c 13 MB
    build_template_test.go:133: test-ubuntu-start-base: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-ubuntu-start-base: [info] Layers extracted
    build_template_test.go:133: test-ubuntu-start-base: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-ubuntu-start-base: [info] Provisioning sandbox template
    build_template_test.go:133: test-ubuntu-start-base: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-ubuntu-start-base: [info] Sandbox template provisioned
    build_template_test.go:133: test-ubuntu-start-base: [info] [base] DEFAULT USER user [49e586c2171254c6bc4a09e84eedac32dbcf113a158c24248129af2f49cbed74]
    build_template_test.go:133: test-ubuntu-start-base: [info] [builder 1/2] ENV START_ENV start_value [22ecb2c2ce1b1d262e37d2cd71b90e6d33fdf99ecfca361e1a2c284afb7fc08a]
    build_template_test.go:133: test-ubuntu-start-base: [info] [builder 2/2] WORKDIR /start/workdir [f841574929b92d8b6e15a8fc6477f0f1e568eac3d30ae7110a831bbcea62e921]
    build_template_test.go:133: test-ubuntu-start-base: [info] [finalize] Finalizing template build [a509f6bf83c53e4844e4d62e9e93f7dae0d5706e070f3f756fe6d227a04976e4]
    build_template_test.go:133: test-ubuntu-start-base: [error] Build failed: An internal error occurred. Please try again or contact support with the build ID.
    build_template_test.go:700: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestTemplateBuildFromTemplateStartCommand (162.88s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN/Single_RUN_command
Stack Traces | 163s run time
=== RUN   TestTemplateBuildRUN/Single_RUN_command
=== PAUSE TestTemplateBuildRUN/Single_RUN_command
=== CONT  TestTemplateBuildRUN/Single_RUN_command
    build_template_test.go:133: test-ubuntu-run: [info] Building template 8b4v6l6d2j6s928wry18/25322a3b-3bc3-4f82-afce-d7d80e7d5034
    build_template_test.go:133: test-ubuntu-run: [info] [base] FROM ubuntu:22.04 [f9f564014e009a9561a82bf8c84f9314242971e833fb019936654ecba452f184]
    build_template_test.go:133: test-ubuntu-run: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:d6834b4a794c03efa2c998853e64969fa8851b11b2ade63292268872a37759d0 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:fe2a51aa6130489d11431e164fcf026637492f7cf0cbde8eef218b8c39c0ad8c 13 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-ubuntu-run: [info] Layers extracted
    build_template_test.go:133: test-ubuntu-run: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning sandbox template
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-ubuntu-run: [info] Sandbox template provisioned
    build_template_test.go:133: test-ubuntu-run: [info] [base] DEFAULT USER user [49e586c2171254c6bc4a09e84eedac32dbcf113a158c24248129af2f49cbed74]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] RUN echo 'Hello, World!' [c72b4f813c2a16b0fc1a1c5da7b1365a304cbac516b22dc304a71f70aae48ac0]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] [stdout]: Hello, World!
    build_template_test.go:133: test-ubuntu-run: [info] [finalize] Finalizing template build [92c524e30533398ebb41ce04c2596130f0cdecc9aa328e28fdb16a1b11f61d62]
    build_template_test.go:133: test-ubuntu-run: [error] Build failed: An internal error occurred. Please try again or contact support with the build ID.
    build_template_test.go:166: Build failed: {<nil> An internal error occurred. Please try again or contact support with the build ID. <nil>}
--- FAIL: TestTemplateBuildRUN/Single_RUN_command (162.88s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@Kraci
Kraci merged commit 7b3d30a into main Jul 23, 2026
41 checks passed
@Kraci
Kraci deleted the migrate-existing-default-team-team-names-to-projects-en-1892 branch July 23, 2026 15:24
ValentaTomas added a commit that referenced this pull request Jul 24, 2026
…3369)

Two migrations merged today share the goose version `20260723120000`
(`set_tier_max_disk_size` from #3350 and
`rename_default_team_names_to_project` from #3334). Goose panics on
duplicate versions at collection time, so since the second merge
**every** goose invocation fails — all DB-touching test shards on every
open PR, and any deploy-time migration step.

Renumbers the later-merged one to `20260723172400` (its merge time).
This is safe precisely because of the failure mode: no goose run since
the collision could have applied it anywhere, so no environment has it
recorded under the old version; the earlier migration keeps its number
and its applied history.

Flagging as the likely root cause of ARM64 test-shard failures on
currently-open PRs (observed on #3368) and of any migration-step
failures in deploys since 17:24Z.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants