Skip to content

fix(infra): report which environment variable pins a setting - #1084

Merged
rmyndharis merged 1 commit into
mainfrom
fix/name-the-pinning-env-var
Aug 6, 2026
Merged

fix(infra): report which environment variable pins a setting#1084
rmyndharis merged 1 commit into
mainfrom
fix/name-the-pinning-env-var

Conversation

@rmyndharis

Copy link
Copy Markdown
Owner

The Infrastructure page decided a setting was pinned by an environment variable by comparing the running value against the saved file. That mismatch is also exactly what a save looks like before the server is restarted, so a stock stack with no variable set anywhere still told the operator that a variable was pinning the setting — and never said which one. The Engine card had no notice at all, so a pinned engine silently reverted after a restart and read as "nothing was saved", which is how it was reported in #1082.

Change

load-env snapshots the keys present immediately before data/.env.generated is merged — everything supplied by the container environment or a project .env. Both load with override: false and outrank the saved file permanently, so both are pins.

This is a second snapshot rather than a reuse of recordOsEnvKeys. That one answers "may this value win over the file being written?" for the save-config guard, where only a host value counts. This one answers "can the dashboard change this at all?", and there a project .env pins just as hard. Verified: with a pinning .env and no container variable at all, only the new snapshot reports it.

Because clearBlankEnv runs before the snapshot, a blank compose forward (- KEY=${KEY:-} with nothing set) is already deleted and correctly does not register as a pin — so the bundled compose keeps behaving exactly as before.

/infra/status reports the pinned subset of the four editable selection keys. The page then names the variable when a setting is pinned, says a restart is pending when it is not, and applies the same notice to the Engine card. envPinned is optional on the client type so a dashboard served by an older gateway degrades to the previous behaviour rather than breaking.

Verification

Unit tests cover the snapshot (a shadowing layer counts, a blank forward does not, and a real value that merely repeats the default does) and the controller wiring (only editable selection keys are reported, never unrelated variables like PATH).

Beyond the suites, the built app was run against four configurations and /infra/status inspected each time:

Configuration envPinned
Nothing set []
Bundled compose, nothing set (ENGINE_TYPE=, REDIS_ENABLED=) [], and the saved values apply
Real REDIS_ENABLED=true in the environment ["REDIS_ENABLED"]
Project .env with ENGINE_TYPE ["ENGINE_TYPE"]

The first two are the cases that previously produced a false pin notice.

Both new strings are translated across all twelve locales; i18n:check passes, including placeholder parity for the new {{name}} token.

Refs #1082.

The Infrastructure page inferred an environment pin from "running value !=
saved value". That mismatch is also exactly what a save looks like before the
server is restarted, so a stock stack with no variable set anywhere still told
the operator a variable was pinning the setting — and never said which one.
The Engine card had no notice at all, so a pinned engine silently reverted
after a restart and read as "nothing was saved".

load-env now snapshots the keys present immediately before data/.env.generated
is merged, i.e. everything supplied by the container environment or a project
.env. Both outrank the saved file for good, so both are pins. This is a second
snapshot rather than a reuse of recordOsEnvKeys: that one answers "may this
win over the file being written?" for the save guard, where only a host value
counts, while a project .env pins the dashboard just as hard.

Because clearBlankEnv runs first, a blank compose forward is already gone and
correctly does not register as a pin.

/infra/status reports the pinned subset of the four editable selection keys.
The page now names the variable when a setting is pinned, says a restart is
pending when it is not, and applies the same notice to the Engine card.
@rmyndharis
rmyndharis force-pushed the fix/name-the-pinning-env-var branch from 6a3077d to 1bb1da7 Compare August 6, 2026 02:38
@rmyndharis
rmyndharis merged commit 8daa2f5 into main Aug 6, 2026
15 checks passed
@rmyndharis
rmyndharis deleted the fix/name-the-pinning-env-var branch August 6, 2026 02:45
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