fix(shared): unblock local dev account seeding

OW
1d ago
+1915877-10792

What & why

The documented local setup's account-seeding step fails under Bun 1.3.14 before it creates the development account or CLI OAuth client. db:seed-dev imports the auth server, which imports @superset/shared/auth. That barrel loads a compile-time Lingui macro used only to display role names in desktop settings.

Move the display helper beside its two desktop callers. Role data and permission functions are unchanged. The helper retains the same translation messages and i18n instance.

Desktop dev sign-in has a separate account-creation fallback. This PR repairs the seed command; it does not establish a general app-startup failure.

How I tested it

With dependencies installed, use Bun 1.3.14 from the repository root to reproduce the import failure. This command requires no database or credentials:

bun --eval 'await import("./packages/shared/src/auth/index.ts")'
SourceObserved result
Base 94056be3a4b209d342fd4c831c8b1514b434ab31Exit 1: Cannot find package 'babel-plugin-macros', loaded by @lingui/core/macro.
Fix 3424c173292bf0d77e207485c15d4b3e7382bd3fExit 0.

The added regression runs in the existing test suite. It starts a fresh Bun process because the parent test setup mocks Lingui macros. It passes from both the repo root and the shared package directory. Run it directly with:

bun test packages/shared/src/auth/auth-runtime.test.ts

For the actual seed command, I applied existing migrations to an empty isolated local database and ran bun run db:seed-dev twice. Both runs exited 0. Selected output shows creation followed by reuse:

Seeded dev account: admin@local.test
Dev account ready: admin@local.test (onboarded, pro)
Seeded CLI OAuth client: superset-cli

Dev account already exists: admin@local.test
Dev account ready: admin@local.test (onboarded, pro)
Refreshed CLI OAuth client: superset-cli

Placeholder local email credentials produced a nonfatal signup-event warning outside this excerpt.

  • All 11 code CI jobs pass on the submitted commit, including full tests, typecheck, desktop build, lint, and all four CLI-platform builds.
  • Local auth tests (15/15), shared and desktop typechecks, lint, and bun run check:i18n pass. Translation catalogs are unchanged.
  • CodeRabbit's review covers the same commit and reports no actionable findings.

The separate Neon preview job fails before deployment because the fork lacks NEON_API_KEY.

Checklist

  • PR title follows conventional commits.
  • bun run lint and bun run typecheck pass (full typecheck in CI).
  • bun run test and bun run check:i18n pass (full tests in CI; i18n checked locally).
  • "Allow edits from maintainers" is checked on this fork PR.

Summary by cubic

Fixes db:seed-dev failing under Bun 1.3.14 by removing a compile-time Lingui macro from the shared auth import path. The macro only displayed role names in desktop settings, so that helper now lives beside its two callers and auth imports load in any runtime. Role data and permission functions are unchanged; the helper keeps the same translation messages and i18n instance.

Adds a regression test that imports the auth index in a fresh Bun process, because the parent test setup mocks Lingui macros.

Summary by CodeRabbit

  • Refactor

    • Member settings continue displaying localized organization role names with unchanged role-management behavior.
    • Organization role-name handling is now scoped to member settings instead of shared authentication functionality.
  • Tests

    • Added validation that authentication functionality loads successfully in a fresh runtime.