Skip to content

refactor(config): each setting declares its variable on its settings field, and the option, variable and secret registries are derived from it - #2466

Merged
dan-petty merged 2 commits into
mainfrom
refactor/2444-settings-field-declaration
Oct 28, 2026
Merged

dan-petty merged 2 commits into
mainfrom
refactor/2444-settings-field-declaration

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Six hand-written registries described the settings, and they disagreed: the key constants, the secret set and the keyring map in config/options.py; the variable map and the 79 hand-written specs in config/env.py; the credential table in security/secrets.py; the keyring names in k8s/cluster_secrets.py; _CHILD_DATA_ENV_MAP in config/settings.py; and the 29 rows of devops config show. devops config env and docs/ENV_VARS.md did not show 13 variables that devops-cli reads, and 13 options read no variable.

This is part 1 of #1000. Each setting is now declared once:

  • A settings field declares that a variable sets it with a Variable marker in Annotated metadata, and its description with Field(description=...). The variable is DEVOPS_CLI_ and the dotted key in upper case, with _ for .. The tasks field of ai declares the segment TASK, so the 17 task variables keep their names. Each task field of ai.tasks names the fields of the shared task model that a variable sets.
  • A credential is one entry of CREDENTIALS in config/env.py: its key, description, other variables, whether the config file may hold it, and its keyring name when that is not the key with _ for ..
  • setting_variables(), option_env_vars(), env_var_for_option(), secret_keys(), keyring_names() and get_all_env_var_specs() derive every list. The env overrides, the data directory variables, build_secret_registry(), KeyringSource.for_credential(), the devops config commands, the docs generator and the workspace route read them.
  • config/options.py, the ENV_* constants of settings, OPTION_TO_ENV_VAR, ENV_VAR_TO_OPTION, the spec list, _CHILD_DATA_ENV_MAP and the _row lines are deleted. Code names a setting by its dotted key.

What a person sees:

  • devops config show prints every setting that a variable sets and every credential, sorted by key, and has --format and --json. A credential shows as set or not set.
  • devops config env and docs/ENV_VARS.md list the 7 setting variables and the 6 credential variables that they missed.
  • The 10 options that code reads and that had no variable get one by the rule: ai.reference_model, ai.reference_embedding_model, ai.reference_provider, ai.hardware_cost_usd, telemetry.capture_llm_content, sandbox.exclude_home_dir, cloudflare.public_ip_bypass and cloudflare.access.allowed_emails, bypass_ips and public_ip_bypass. No file in the repository sets one of these names. The 3 options that no code reads get none (fix(config): telemetry.logfire, cloudflare.access.enabled and cloudflare.access.idp are settings that no code reads #2457).

tests/test_config_declarations.py holds the set of variables, the keyring names and the secret keys to their values before the change, with the 10 added variables.

Closes #2444

Change: openspec/changes/archive/2026-10-28-2444-settings-field-declaration/

@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD), and check that devops config show and devops config env on the devcontainer list the same keys and variables as before, with the additions above.

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 17:21
…field

Six hand-written registries described the settings and disagreed: the
key constants and secret maps in `config/options.py`, the variable map
and the 79 hand-written specs in `config/env.py`, the credential table
in `security/secrets.py`, the keyring names in `k8s/cluster_secrets.py`,
`_CHILD_DATA_ENV_MAP`, and the 29 rows of `devops config show`.
`devops config env` and `docs/ENV_VARS.md` missed 13 variables that
devops-cli reads.

A settings field now declares that a variable sets it with a `Variable`
marker and its description with `Field(description=...)`. The variable
is `DEVOPS_CLI_` and the dotted key in upper case; `ai.tasks` declares
the segment `TASK`, so the task variables keep their names. A
credential is one entry of `CREDENTIALS`. Every list of settings,
variables and keyring entries is derived from these two declarations,
and the registries are deleted.

`devops config show` prints every declared setting and credential, and
has `--format` and `--json`. The 10 options that code reads and that
had no variable get one by the rule.
@dan-petty
dan-petty force-pushed the refactor/2444-settings-field-declaration branch from 33fd0cd to 1088670 Compare October 28, 2026 18:21
@dan-petty
dan-petty merged commit daaffc6 into main Oct 28, 2026
17 checks passed
@dan-petty
dan-petty deleted the refactor/2444-settings-field-declaration branch October 28, 2026 18:28
dan-petty added a commit that referenced this pull request Oct 28, 2026
… setting by its dotted key

The settings refactor of #2466 deleted `devops_cli.config.options`,
and code now names a setting by its dotted key. The URL check of the
three command groups imported its setting name from that module.

Refs #2424
dan-petty pushed a commit that referenced this pull request Oct 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.10.1](v0.10.0...v0.10.1)
(2026-10-28)


### Bug Fixes

* **ai:** a reply names its server by the origin of the URL called, so a
password in an AI URL stays out of every record
([#2488](#2488))
([3ec083f](3ec083f)),
closes [#1110](#1110)
* **ai:** the AI service clients dial through the egress-checked factory
and check the address at the connect
([#2484](#2484))
([08d70ca](08d70ca))


### Code Refactoring

* **config:** each setting declares its variable on its settings field,
and the option, variable and secret registries are derived from it
([#2466](#2466))
([daaffc6](daaffc6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant