feat: wire sv web UI flags to runtime via static override - #21
Merged
Merged
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Jul 31, 2026
nicosampler
added a commit
that referenced
this pull request
Jul 31, 2026
) ## Summary Closes #23 Follow-up to #21: the headless-validator mechanism was the last place generating YAML from JS (`writeGeneratedOverride` string-building `.generated/service-overrides.yaml` on every run). It now rides the same static, env-var-driven override as the SV UIs, so there is a single mechanism and no YAML codegen anywhere. ## Changes - `templates/runtime-overrides.yaml` gains one mount per validator with a fixed, readable target: `${APP_*_NGINX_ROUTES}:/etc/nginx/templates/<name>.conf.template`. The env var selects the source: Splice's real routing config when `ui: true` (identical to vanilla after compose dedups the mount), or an empty `.generated/empty-nginx-routes.conf` when the validator is headless or disabled. - `writeGeneratedOverride` and `.generated/service-overrides.yaml` removed; `writeLocalnetEnv` writes the `APP_PROVIDER_NGINX_ROUTES` / `APP_USER_NGINX_ROUTES` vars instead. - Tests for the route-source contract in `scripts/runtime-plan.test.js`; docs and template comments updated. - `fix(smoke)`: pre-existing breakage on `main` — #21 shipped the scaffolded `sv` defaults as all-off, but `smoke.js` still asserted all-on, so `npm run test:e2e` failed. Assertions aligned. ## Acceptance criteria - [x] Headless validators are driven by `templates/runtime-overrides.yaml` via env vars, with behavior identical to today (backend reachable on direct ports, no nginx routes, nginx boots). - [x] `writeGeneratedOverride` and `.generated/service-overrides.yaml` are removed, along with the conditional `-f` wiring in `dockerComposeArgs`. - [x] Docs and comments updated: README design notes and the `splice-localnet-overrides.yaml` header. - [x] Tests updated (`runtime-plan.test.js`) and verified against a live stack with a headless and a UI-enabled validator. Note: the issue sketched Splice's `.c${VAR}f.template` filename trick; implemented with a clearer equivalent — fixed mount target, env var selects the *source* file — avoiding the cryptic on/off concatenation. ## Test plan ### Automated tests - `scripts/runtime-plan.test.js` — route-source env contract (empty file for headless/disabled, Splice's real config for `ui: true`). - Run with `npm test` (26 passing); `npm run test:e2e` for the smoke test (fixed here). ### Manual verification Against the live stack: with `appUser.ui: true`, wallet and ANS serve 200 on port 2000; with `ui: false`, no UI containers run, port 2000 refuses connections, the rendered `app-user.conf` inside nginx is 0 bytes, and the backend answers 200 on its direct port (:2975). nginx boots in every combination, including all SV UIs and all validator UIs off simultaneously. ## Breaking changes None. ## Checklist - [x] Self-reviewed my own diff - [x] Tests added or updated - [x] Docs updated (if applicable) - [x] No unrelated changes bundled in ## Screenshots None.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4
The
svprofile always startedscan-web-ui,sv-web-uiandwallet-web-ui-svwith no way totoggle them. This adds per-UI
svconfig flags and wires them to runtime so the SV backend (andevery API route) always stays up while each web UI starts conditionally.
Changes
sv: { scanUI, svUI, walletUI }config section, zod-validated and strict like the rest of the schema.templates/runtime-overrides.yamlshipped with the package and always applied: pins eachdisabled UI to
deploy.replicas: 0and gives nginx a network alias per UI, driven purely by env vars(no YAML generated from JS).
writeLocalnetEnvwrites the*_REPLICAS/*_NGINX_ALIASpairs;deriveRuntimePlanexposesdisabledSvUIs(visible invalidate --json).scripts/runtime-plan.test.js, newsvcases inconfig-validation.test.js, smoke updated.Acceptance criteria
sv: { scanUI, svUI, walletUI }), zod-validated like the rest of the schema.Note: the issue proposed a generated overrides file under
.generated/. That alone breaks nginx —sv.confresolves the UI hostnames at startup and dies with "host not found in upstream" when aservice has 0 replicas (
depends_on … required: falsedoesn't cover DNS). Implemented instead as astatic override + env vars: same
replicas: 0effect, plus an nginx alias that keeps a disabled UI'shostname resolvable (its URL answers 502). No YAML is generated from JS.
Test plan
Automated tests
scripts/runtime-plan.test.js— flag→service mapping and the*_REPLICAS/*_NGINX_ALIASenv contract.scripts/config-validation.test.js— newsvsection cases.npm test(24 passing);npm run test:e2efor the smoke test.Manual verification
Verified against the live stack, both flag sets (
scanUI:false, svUI:true, walletUI:falseand itsinverse): disabled UIs have no container and answer 502, enabled ones serve their app (200),
canton/splice/postgresstay up across flag flips (only nginx and the UIs are recreated), and thescan/SV/canton API routes return 200 regardless of UI state.
Breaking changes
None.
Checklist
Screenshots
None.