An unknown PIXA_ environment variable is ignored instead of aborting startup #133

Closed
opened 2026-09-28 13:10:15 +02:00 by clawbot · 2 comments
Collaborator

Found in review of #131 (#128).

An unknown key in the config file aborts startup, so a typo fails loudly. An environment variable is not held to that: a misspelled PIXA_ name (for example PIXA_TRUSTED_PROXY) or PIXA_PORT (the port is read from PORT) is ignored without a word, and the setting silently keeps its file value or default.

Definition of done

  • At startup, an environment variable whose name starts with PIXA_ and is neither a setting's variable nor PIXA_CONFIG_PATH aborts startup naming it, the same way an unknown config key does. For PIXA_PORT the message says to use PORT.
  • Failing tests first, with t.Setenv: a misspelled PIXA_ variable aborts naming it; PIXA_PORT aborts pointing to PORT; PIXA_CONFIG_PATH and every setting's variable are accepted.
  • README.md's variable table section says unknown PIXA_ variables abort startup.

Model: opus-5-5

Found in review of https://git.eeqj.de/sneak/pixa/pulls/131 (https://git.eeqj.de/sneak/pixa/issues/128). An unknown key in the config file aborts startup, so a typo fails loudly. An environment variable is not held to that: a misspelled `PIXA_` name (for example `PIXA_TRUSTED_PROXY`) or `PIXA_PORT` (the port is read from `PORT`) is ignored without a word, and the setting silently keeps its file value or default. ## Definition of done - At startup, an environment variable whose name starts with `PIXA_` and is neither a setting's variable nor `PIXA_CONFIG_PATH` aborts startup naming it, the same way an unknown config key does. For `PIXA_PORT` the message says to use `PORT`. - Failing tests first, with `t.Setenv`: a misspelled `PIXA_` variable aborts naming it; `PIXA_PORT` aborts pointing to `PORT`; `PIXA_CONFIG_PATH` and every setting's variable are accepted. - `README.md`'s variable table section says unknown `PIXA_` variables abort startup. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-09-28 13:10:15 +02:00
Author
Collaborator

Plan:

  • A new check sits next to the one that rejects unknown config file keys. Every environment variable whose name starts with PIXA_ must be in the list pairing each config key with its variable (from #128) or be PIXA_CONFIG_PATH. Any other aborts startup, all of them named in one message, as unknown keys are: unknown environment variables: PIXA_TRUSTED_PROXY. PIXA_PORT is listed as PIXA_PORT (the port is set by PORT).
  • Judgement call: the check runs after the config file loads, so a PIXA_ name in the file's env: section is held to the same rule. The README already says those names act as environment variables. The existing test for the env: section sets PIXA_TEST_ENV_INJECTION, which smartconfig puts in the whole test process's environment. It moves to a name without the prefix.
  • Failing tests first, with t.Setenv: a misspelled name aborts naming it; PIXA_PORT aborts pointing to PORT; PIXA_CONFIG_PATH together with every setting's variable loads. The config tests still unset PORT and every PIXA_ variable before they run.
  • README.md: one sentence in the Configuration section, above the variable table.

Model: opus-5-5

Plan: - A new check sits next to the one that rejects unknown config file keys. Every environment variable whose name starts with `PIXA_` must be in the list pairing each config key with its variable (from https://git.eeqj.de/sneak/pixa/issues/128) or be `PIXA_CONFIG_PATH`. Any other aborts startup, all of them named in one message, as unknown keys are: `unknown environment variables: PIXA_TRUSTED_PROXY`. `PIXA_PORT` is listed as `PIXA_PORT (the port is set by PORT)`. - Judgement call: the check runs after the config file loads, so a `PIXA_` name in the file's `env:` section is held to the same rule. The README already says those names act as environment variables. The existing test for the `env:` section sets `PIXA_TEST_ENV_INJECTION`, which smartconfig puts in the whole test process's environment. It moves to a name without the prefix. - Failing tests first, with `t.Setenv`: a misspelled name aborts naming it; `PIXA_PORT` aborts pointing to `PORT`; `PIXA_CONFIG_PATH` together with every setting's variable loads. The config tests still unset `PORT` and every `PIXA_` variable before they run. - `README.md`: one sentence in the Configuration section, above the variable table. Model: opus-5-5
Author
Collaborator

Built in #136, as planned except for one point. The check runs in New right after the config file loads, not next to the unknown-key check, so names set by a file's env: section are checked, and the existing test for that section, which does not go through New, keeps its PIXA_TEST_ENV_INJECTION unchanged, per the repo's rule against editing existing tests without the owner's approval.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/pixa/pulls/136, as planned except for one point. The check runs in `New` right after the config file loads, not next to the unknown-key check, so names set by a file's `env:` section are checked, and the existing test for that section, which does not go through `New`, keeps its `PIXA_TEST_ENV_INJECTION` unchanged, per the repo's rule against editing existing tests without the owner's approval. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#133