Skip to content

Gaps — Storybook has no environment configuration ​

Raw observation recorded where it was noticed and deliberately left unprocessed. Nothing here is a proposal, a decision, or a plan.


From spec 025 — painterly containers (2026-08-19) ​

Found while building a discovery spike story for LegendaryTree. research.md F1.

Any story that reaches src/api throws on import ​

apps/web/src/api/apiBase.ts:16 resolves the API origin at module load:

ts
export const API_ORIGIN = resolveApiOrigin(import.meta.env.VITE_APP_ENV);

and resolveApiOrigin throws Invalid VITE_APP_ENV: ${env} for anything but dev or prod (apiBase.ts:10). That validation is deliberate — spec 015 made an unset environment fail loudly rather than silently defaulting to a wrong origin.

Vitest supplies the variable (apps/web/vitest.config.ts:25, env: { VITE_APP_ENV: 'dev' }). Storybook supplies nothing: .storybook/main.ts sets no env and no viteFinal, and the repo has no .env file. So a story that imports the api barrel — directly, or transitively through a provider, as a LegendaryTree story does via OwnVsNeedProvider — fails to render with:

Invalid VITE_APP_ENV: undefined

Worked around during 025's discovery by starting the server as VITE_APP_ENV=dev pnpm storybook, which only works when the person starting it remembers.

What this does not affect ​

None of spec 025's three painted containers (Dialog, Tooltip, ConnectAccountPrompt) reaches src/api, so every story shipped by 025 renders without it. This blocks the next feature-level story.