From 81917acc3e17352496d3a6f004c71ff401e4d834 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Sat, 16 May 2026 21:46:24 +0200 Subject: [PATCH] dev-deploy: enable Dev Sandbox bootstrap and synthetic-report loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two long-standing dev-environment ergonomics had not survived the move from the bespoke local-dev stack to the CI-driven dev-deploy: 1. `BACKEND_DEV_SANDBOX_EMAIL` defaulted to an empty string in the dev-deploy compose, so the auto-provisioned "Dev Sandbox" game never appeared on `https://www.galaxy.lan`. Bake `dev@galaxy.lan` as the default — matches `.env.example` and lets a developer who logs in with that email find a ready-to-play game in the lobby. 2. The lobby's synthetic-report loader was gated on `import.meta.env.DEV`, which is true only for `vite dev` (the tools/local-dev path). The long-lived dev environment builds with `vite build` (production mode), so the section was always stripped from its bundle. Gate it on an explicit `VITE_GALAXY_DEV_AFFORDANCES` flag instead and set it both in `.env.development` (preserves `pnpm dev` behaviour) and in the `dev-deploy.yaml` build step. The `prod-build.yaml` build path leaves the flag unset, so production stays clean. Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/dev-deploy.yaml | 5 +++++ tools/dev-deploy/Makefile | 1 + tools/dev-deploy/docker-compose.yml | 7 ++++++- ui/frontend/.env.development | 6 ++++++ ui/frontend/src/routes/lobby/+page.svelte | 11 ++++++++--- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/dev-deploy.yaml b/.gitea/workflows/dev-deploy.yaml index 28db15b..3eb6305 100644 --- a/.gitea/workflows/dev-deploy.yaml +++ b/.gitea/workflows/dev-deploy.yaml @@ -69,6 +69,11 @@ jobs: working-directory: ui/frontend env: VITE_GATEWAY_BASE_URL: https://api.galaxy.lan + # Surface the synthetic-report loader and similar dev-only + # affordances in the long-lived dev bundle. The prod build + # path (`prod-build.yaml`) leaves this flag unset so the + # production bundle keeps the same affordances stripped. + VITE_GALAXY_DEV_AFFORDANCES: "true" run: | # The response-signing public key is committed in # `.env.development` alongside its private counterpart in diff --git a/tools/dev-deploy/Makefile b/tools/dev-deploy/Makefile index 403054b..4e154b8 100644 --- a/tools/dev-deploy/Makefile +++ b/tools/dev-deploy/Makefile @@ -62,6 +62,7 @@ seed-ui: @echo "building UI (vite build)…" (cd $(REPO_ROOT)/ui/frontend && \ VITE_GATEWAY_BASE_URL=https://api.galaxy.lan \ + VITE_GALAXY_DEV_AFFORDANCES=true \ VITE_GATEWAY_RESPONSE_PUBLIC_KEY=$$(cat $(REPO_ROOT)/ui/frontend/.env.development \ | sed -n 's/^VITE_GATEWAY_RESPONSE_PUBLIC_KEY=//p') \ pnpm build) diff --git a/tools/dev-deploy/docker-compose.yml b/tools/dev-deploy/docker-compose.yml index dd085f9..3deb385 100644 --- a/tools/dev-deploy/docker-compose.yml +++ b/tools/dev-deploy/docker-compose.yml @@ -107,7 +107,12 @@ services: # bcrypt-hashed code is single-use). Set the var to an empty # string in `.env` to disable. BACKEND_AUTH_DEV_FIXED_CODE: ${BACKEND_AUTH_DEV_FIXED_CODE:-123456} - BACKEND_DEV_SANDBOX_EMAIL: ${BACKEND_DEV_SANDBOX_EMAIL:-} + # Long-lived dev environment always bootstraps the "Dev Sandbox" + # game owned by this email so a freshly redeployed stack already + # has one ready-to-play game in the lobby. Set the variable to an + # empty string in `.env` to disable the bootstrap (e.g. for a + # cold-start QA pass). + BACKEND_DEV_SANDBOX_EMAIL: ${BACKEND_DEV_SANDBOX_EMAIL:-dev@galaxy.lan} BACKEND_DEV_SANDBOX_ENGINE_IMAGE: ${BACKEND_DEV_SANDBOX_ENGINE_IMAGE:-galaxy-engine:dev} BACKEND_DEV_SANDBOX_ENGINE_VERSION: ${BACKEND_DEV_SANDBOX_ENGINE_VERSION:-0.1.0} BACKEND_DEV_SANDBOX_PLAYER_COUNT: ${BACKEND_DEV_SANDBOX_PLAYER_COUNT:-20} diff --git a/ui/frontend/.env.development b/ui/frontend/.env.development index 93ddbbc..5d87fe9 100644 --- a/ui/frontend/.env.development +++ b/ui/frontend/.env.development @@ -16,3 +16,9 @@ VITE_GATEWAY_BASE_URL=http://localhost:5173 # key. Pairs with `tools/local-dev/keys/gateway-response.pem`. The pair # is dev-only — see `tools/local-dev/keys/README.md` before rotating. VITE_GATEWAY_RESPONSE_PUBLIC_KEY=nIG54tCuNiIKrazt8Hh7YxmmU/BhpseGhIIgj164Chw= + +# Opt in to dev-time UI affordances that should never reach a +# production bundle — currently the synthetic-report loader in the +# lobby. Mirror this flag in any long-lived dev build (e.g. +# `dev-deploy.yaml`); the prod build path leaves it unset. +VITE_GALAXY_DEV_AFFORDANCES=true diff --git a/ui/frontend/src/routes/lobby/+page.svelte b/ui/frontend/src/routes/lobby/+page.svelte index 553f431..aaa96bf 100644 --- a/ui/frontend/src/routes/lobby/+page.svelte +++ b/ui/frontend/src/routes/lobby/+page.svelte @@ -375,13 +375,18 @@ {/if} - {#if import.meta.env.DEV} + {#if import.meta.env.VITE_GALAXY_DEV_AFFORDANCES === "true"}

Synthetic test reports (DEV)