One table of settings in internal/config #320

Open
opened 2026-10-21 12:51:21 +02:00 by clawbot · 0 comments
Collaborator

Item 14 of 15 of #168: "One list of settings in internal/config". Starts when the item before it (deciding a fetched image's format once) is squash-merged to next.

Today (next at 989da78)

Adding a setting touches a key constant, isKnownConfigKey, envVarNames, a Config field, the literal in newFromSmartConfig, validate, README.md and configs/config.example.yml, and must agree with TestEnvironmentSetsEveryKey. The code is correct, only long: the config model has to be put together from five lists.

Definition of done

  • One table in internal/config lists every setting once: its key, its environment variable, its type, its default and its check. Loading, the unknown-key and unknown-variable checks, and the defaults are driven by that table.
  • isKnownConfigKey, envVarNames and the per-key literal in newFromSmartConfig are gone; adding a setting is one entry in the table plus its Config field.
  • A test checks that README.md's settings table and configs/config.example.yml name exactly the keys in the table.
  • Every setting loads, defaults and is refused exactly as before.

Approval and tests

sneak asked for each main recommendation of #168 to be its own issue, built before 1.0, one at a time in the order listed (#168 (comment)). That instruction is his approval of this item. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped.

Model: opus-5-5

Item 14 of 15 of https://git.eeqj.de/sneak/pixa/issues/168: "One list of settings in `internal/config`". Starts when the item before it (deciding a fetched image's format once) is squash-merged to `next`. ## Today (`next` at `989da78`) Adding a setting touches a key constant, `isKnownConfigKey`, `envVarNames`, a `Config` field, the literal in `newFromSmartConfig`, `validate`, `README.md` and `configs/config.example.yml`, and must agree with `TestEnvironmentSetsEveryKey`. The code is correct, only long: the config model has to be put together from five lists. ## Definition of done - One table in `internal/config` lists every setting once: its key, its environment variable, its type, its default and its check. Loading, the unknown-key and unknown-variable checks, and the defaults are driven by that table. - `isKnownConfigKey`, `envVarNames` and the per-key literal in `newFromSmartConfig` are gone; adding a setting is one entry in the table plus its `Config` field. - A test checks that `README.md`'s settings table and `configs/config.example.yml` name exactly the keys in the table. - Every setting loads, defaults and is refused exactly as before. ## Approval and tests sneak asked for each main recommendation of https://git.eeqj.de/sneak/pixa/issues/168 to be its own issue, built before 1.0, one at a time in the order listed (https://git.eeqj.de/sneak/pixa/issues/168#issuecomment-153513). That instruction is his approval of this item. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-10-21 12:51:21 +02:00
clawbot self-assigned this 2026-10-21 12:51:21 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#320