Skip to content

fix(control-center): load Supabase env for direct local dashboard startup - #352

Merged
i-xtsu-sixyou-ken-mei merged 5 commits into
mainfrom
fix/control-center-local-supabase-env
Sep 3, 2026
Merged

fix(control-center): load Supabase env for direct local dashboard startup#352
i-xtsu-sixyou-ken-mei merged 5 commits into
mainfrom
fix/control-center-local-supabase-env

Conversation

@i-xtsu-sixyou-ken-mei

Copy link
Copy Markdown
Collaborator

Intent

Fix local Control Center startup so direct pnpm ops:dashboard launches receive the same Infisical/dev environment as pnpm ops.

Without this, the dashboard can boot successfully while SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are absent from the Control Center process, causing Pipeline, Growth, Product, and podcast cost reads to report Supabase as not connected even though Home can still render non-Supabase operational evidence.

Context

The root pnpm ops command already runs inside scripts/env/run.mjs, which resolves committed dev env plus Infisical secrets before starting scripts/ops.mjs.

The standalone pnpm ops:dashboard command previously bypassed that loader and invoked Turbo directly. --env-mode=loose only preserves variables already present in the parent shell; it does not resolve Infisical itself.

The existing scripts/ops.mjs launcher then routed its dashboard child through the same public ops:dashboard script. Once the public command becomes env-aware, the full-stack path needs an internal raw command so it does not resolve Infisical twice.

Scope

  • Make public pnpm ops:dashboard run through scripts/env/run.mjs.
  • Add internal ops:dashboard:raw for the already-injected pnpm ops launcher.
  • Keep Turbo --env-mode=loose so injected server credentials survive into the Control Center process.
  • Extend the existing Control Center launch contract test to lock both entrypoints.

Out of scope

  • Supabase schema/query changes.
  • Vercel/deployment behavior.
  • Changing Control Center data-source fallback semantics.
  • Making Supabase credentials globally required for every Control Center execution mode.

Product contract / invariants

  • This PR does not change a documented product/architecture invariant.
  • This PR intentionally changes an invariant with explicit product approval.

Affected invariant:
apps/control-center/src/server/launch-contract.test.ts and the local launch contract documented by scripts/ops.mjs: Infisical-injected credentials must reach the Control Center server through Turbo.

Why:
The standalone dashboard entrypoint accidentally skipped the env-resolution half of that contract.

Acceptance criteria

  • pnpm ops:dashboard resolves dev env through scripts/env/run.mjs before starting Control Center.
  • pnpm ops reuses its already-resolved env instead of resolving Infisical a second time.
  • Both paths still run Control Center through Turbo with --env-mode=loose.
  • Contract tests assert the public wrapper and internal raw launcher relationship.

Implementation

Split the dashboard command into two layers:

  • ops:dashboard — public local entrypoint; resolves env, then delegates.
  • ops:dashboard:raw — internal Turbo command that assumes env has already been injected.

scripts/ops.mjs calls the raw command because pnpm ops itself is already wrapped by scripts/env/run.mjs.

Contract alignment

  • Implementation matches the invariant.
  • Regression / contract tests cover it.
  • Scoped AGENTS.md remains accurate.
  • README / runbook remains accurate.

Validation

  • Repository diff reviewed: 3 files changed, limited to root launch scripts and the existing Control Center launch contract test.
  • Branch is based directly on current main and is 3 commits ahead / 0 behind at PR creation time.

Validation gaps

  • GitHub connector cannot execute the local pnpm/Vitest suite. CI should run the repository checks on this PR.
  • Runtime Infisical resolution requires the developer's authenticated local workspace and is therefore covered structurally by the launch contract rather than exercised from this environment.

Known unrelated failures

None known.

Reviewer notes

Please scrutinize the two-entrypoint split. The intended invariant is that env resolution happens exactly once:

  • direct pnpm ops:dashboard → public env wrapper → raw Turbo command
  • pnpm ops → public env wrapper around ops.mjs → raw Turbo command

…lose exclusions

Move Fly compute run-rate to usage-only (compute_run_rate_monthly) and require operator-recorded billed figure for accrued/projected; keep run-rate as saturation ceiling, not a forecast.

Blend early-month OpenRouter/DeBank projections with prior-month daily rate for first 7 days to avoid linear-extrapolation spikes.

Extract cost-history aggregation, withhold stale previous-month snapshots from headline totals, and surface excluded providers on Economics/Home KPIs, ProviderLedger and RunwayChart.

Switch to light high-contrast operator palette, enforce AI boundary (no LLM inference), and keep collector failures visible even when a manual Fly figure is carried forward.
…ght palette

Replace dark-palette literals left after light operator palette switch
(.source-sentry #b9a7ff 2.09:1 on #ffffff) with darkened accessible variant
and semantic tokens (var(--success)/var(--warning)/var(--ink-faint)),
and add missing provider cost-driver panel styles (three-column grid,
proportional track, tabular figures) so the economics view renders
correctly.

Co-Authored-By: internal-model
@i-xtsu-sixyou-ken-mei
i-xtsu-sixyou-ken-mei merged commit 42c3bdb into main Sep 3, 2026
@i-xtsu-sixyou-ken-mei
i-xtsu-sixyou-ken-mei deleted the fix/control-center-local-supabase-env branch September 3, 2026 02:14
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