Skip to content

refactor: rename MESH_* env vars to STUDIO_* with fallback#4645

Open
viktormarinho wants to merge 1 commit into
mainfrom
chore/demesh-06-env-vars
Open

refactor: rename MESH_* env vars to STUDIO_* with fallback#4645
viktormarinho wants to merge 1 commit into
mainfrom
chore/demesh-06-env-vars

Conversation

@viktormarinho

@viktormarinho viktormarinho commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

De-mesh migration task 06: env vars. All MESH_* environment variables are renamed to STUDIO_*. Reads go through central points that prefer the new name and fall back to the legacy one with a one-time deprecation warning (envWithFallback in apps/mesh/src/settings/env-fallback.ts), so existing deploys keep working unchanged.

Renames

Old New Fallback?
MESH_JWT_SECRET STUDIO_JWT_SECRET yes (resolve-config, warns once)
MESH_DISPATCH_ROLE STUDIO_DISPATCH_ROLE yes (resolve-config, warns once)
MESH_PUBLIC_URL STUDIO_PUBLIC_URL yes (getPublicUrl, warns once)
MESH_CLUSTER_URL STUDIO_CLUSTER_URL yes (deco link, warns once); dev-spawned link daemon + resilience compose now emit the new name
MESH_TEST_SESSION / MESH_BASE_URL (smoke script) STUDIO_TEST_SESSION / STUDIO_BASE_URL yes (silent ??, dev-only script)
MESH_API_KEY / MESH_BASE_URL / MESH_ORG / MESH_AGENT_ID (UI-generated .env snippets) STUDIO_* equivalents consumer (@decocms/typegen) already reads STUDIO_* first with MESH_* fallback; docs already use STUDIO_*
env.MESH_REQUEST_CONTEXT (runtime SDK) env.STUDIO_REQUEST_CONTEXT yes — withBindings sets both keys to the same object; internal reads prefer new then old; old key kept on DefaultEnv as @deprecated so existing apps compile and run
settings.meshJwtSecret settings.studioJwtSecret clean rename — in-memory only, resolved from env at boot, never persisted

Docs (architecture.mdx en/pt, architecture model, runtime/mesh-sdk READMEs) updated to the STUDIO_* names.

Left for task 09 (would break running clusters)

Breaking changes

None. Every rename either has a runtime fallback on the read side or only changes emitted examples/snippets whose documented consumers already accept both names.

Testing

  • New unit tests: env-fallback.test.ts (precedence, empty-string, unset), resolve-config.test.ts (STUDIO/MESH precedence + fallback for JWT secret and dispatch role), triggers.test.ts (STUDIO_REQUEST_CONTEXT read; existing tests keep covering the MESH_REQUEST_CONTEXT fallback).
  • bun test apps/mesh/src/settings packages/runtime — 107 pass, 0 fail.
  • bun run check — all workspaces pass. bun run lint — 30 warnings, identical to main baseline. bun run fmt clean.

🤖 Generated with Claude Code


Summary by cubic

Renamed all MESH_* env vars to STUDIO_* with centralized fallback and one-time deprecation warnings. Updated the runtime SDK, CLI, docs, and UI snippets to prefer STUDIO_* without breaking existing deploys.

  • Refactors

    • Added envWithFallback to prefer STUDIO_* and fall back to MESH_* with a single warn.
    • Switched reads to STUDIO_JWT_SECRET, STUDIO_DISPATCH_ROLE, STUDIO_PUBLIC_URL, and STUDIO_CLUSTER_URL; kept MESH_* fallback where relevant.
    • Runtime now sets env.STUDIO_REQUEST_CONTEXT alongside the deprecated MESH_REQUEST_CONTEXT and reads new-then-old across helpers/tools/triggers.
    • Updated docs/READMEs and .env snippets to STUDIO_*; added tests for fallback and precedence.
  • Migration

    • No breaking changes; legacy MESH_* still work with a deprecation warning. Rename to STUDIO_* when convenient.
    • Helm chart remains on MESH_DISPATCH_ROLE for now; change will happen in a later task to avoid breaking older images.
    • For runtime apps, use env.STUDIO_REQUEST_CONTEXT; MESH_REQUEST_CONTEXT is kept as a deprecated alias.

Written for commit f2ba73b. Summary will update on new commits.

Review in cubic

Central read points now prefer STUDIO_* and fall back to the legacy
MESH_* name with a one-time deprecation warning (envWithFallback in
apps/mesh/src/settings/env-fallback.ts). settings.meshJwtSecret is
renamed to studioJwtSecret (in-memory only, never persisted). The
runtime SDK sets env.STUDIO_REQUEST_CONTEXT alongside the deprecated
MESH_REQUEST_CONTEXT alias and reads new-then-old. Helm templates
still set MESH_DISPATCH_ROLE on purpose (old images have no fallback);
full chart rename is task 09.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@viktormarinho
viktormarinho force-pushed the chore/demesh-06-env-vars branch from f2ba73b to 63881fd Compare July 16, 2026 23:43
viktormarinho added a commit that referenced this pull request Jul 20, 2026
De-mesh task 09 (deploy/infra). Renames the remaining "mesh" identifiers
in deploy/, tests/multi-pod and the CI wiring that references them:

- chart-deco-studio: configMap.meshConfig -> configMap.studioConfig
  (breaking for values files; a fail-guard rejects the old key with a
  clear message). Chart 0.12.2 -> 0.13.0.
- Dispatch role env: the chart now sets STUDIO_DISPATCH_ROLE as the
  canonical variable and keeps MESH_DISPATCH_ROLE as an alias so both
  pre- and post-#4645 images work; both names are reserved.
- sandbox-env: mesh.* values block -> studio.* (breaking for values /
  --set flags; fail-guard on the old key). Chart 0.9.5 -> 0.10.0.
  Prose/comments de-meshed across templates, README, examples and the
  housekeeper script; release-sandbox-charts.yaml install snippet
  updated to --set studio.*.
- tests/multi-pod: compose services mesh-1/2/3 -> studio-1/2/3 (and
  POD_NAME, YAML anchors), with the PODS constants, PodName type and
  scenario literals renamed to match; multi-pod.yml log dump updated.
- /app/data/mesh.db is intentionally KEPT: it is a persisted sqlite
  file on existing volumes and renaming it would orphan data.

apps/mesh directory paths, MESH_* env vars in tests/resilience
(PR #4645), and the @decocms/mesh package/workflow names are out of
scope here (tasks 10 / other open de-mesh PRs).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
viktormarinho added a commit that referenced this pull request Jul 21, 2026
De-mesh task 09 (deploy/infra). Renames the remaining "mesh" identifiers
in deploy/, tests/multi-pod and the CI wiring that references them:

- chart-deco-studio: configMap.meshConfig -> configMap.studioConfig
  (breaking for values files; a fail-guard rejects the old key with a
  clear message). Chart 0.12.2 -> 0.13.0.
- Dispatch role env: the chart now sets STUDIO_DISPATCH_ROLE as the
  canonical variable and keeps MESH_DISPATCH_ROLE as an alias so both
  pre- and post-#4645 images work; both names are reserved.
- sandbox-env: mesh.* values block -> studio.* (breaking for values /
  --set flags; fail-guard on the old key). Chart 0.9.5 -> 0.10.0.
  Prose/comments de-meshed across templates, README, examples and the
  housekeeper script; release-sandbox-charts.yaml install snippet
  updated to --set studio.*.
- tests/multi-pod: compose services mesh-1/2/3 -> studio-1/2/3 (and
  POD_NAME, YAML anchors), with the PODS constants, PodName type and
  scenario literals renamed to match; multi-pod.yml log dump updated.
- /app/data/mesh.db is intentionally KEPT: it is a persisted sqlite
  file on existing volumes and renaming it would orphan data.

apps/mesh directory paths, MESH_* env vars in tests/resilience
(PR #4645), and the @decocms/mesh package/workflow names are out of
scope here (tasks 10 / other open de-mesh PRs).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant