Repository navigation
refactor(config): settings resolve in one declared order through pydantic-settings sources - #2518
Merged
Merged
Conversation
…ntic-settings sources `setting_sources` declares the order of every setting once: its variable, the project config file, the global config file, then the default of its field. `load_settings` builds `Settings` from these sources with the merge and the validation of pydantic-settings, and `telemetry_from_environment` uses the same variable source. `Settings(...)` built in code holds its arguments and the defaults, and reads no variable and no file. `_apply_env_overrides`, `_resolve_data_config`, `_deep_merge` and the merged-file cache go. Only the value that a setting takes is checked. The embedding task keeps its model when a source sets another of its fields, and a config file that holds no mapping stops the load with an error that names the file. Credentials keep their own chain in `security.secrets.build_default_resolver`.
Owner
Author
|
Test evidence:
Decisions are in Filed while building this: #2517 ( Pending a person: review the diff in tuicr ( |
dan-petty
marked this pull request as ready for review
October 28, 2026 19:40
dan-petty
pushed a commit
that referenced
this pull request
Oct 28, 2026
🤖 I have created a release *beep* *boop* --- ## [0.11.0](v0.10.1...v0.11.0) (2026-10-28) ### Features * **monitoring:** the roadmap Service's identity refusals, failing and stalled jobs, restarts, and GitHub and model request volume raise alerts ([#2496](#2496)) ([0137f23](0137f23)), closes [#2472](#2472) * **service:** roadmap-service runs at one replica, and each model call in the cluster is sent at most two times ([#2500](#2500)) ([2d32dae](2d32dae)), closes [#2494](#2494) ### Bug Fixes * **cli:** every command reports a DevOpsCLIError through one exit seam ([#2502](#2502)) ([eadd55f](eadd55f)), closes [#2487](#2487) * **github:** pr monitor waits until the checks settle and names every blocker, and pr ready reads the merge-readiness verdict ([#2498](#2498)) ([43326ea](43326ea)) * **k8s:** a pod that does not call the Kubernetes API mounts no service account token ([#2522](#2522)) ([305d3ba](305d3ba)) * **k8s:** the cloudflared tunnel replicas prefer different nodes and keep one up through a drain ([#2499](#2499)) ([d4edaf6](d4edaf6)), closes [#1023](#1023) * **k8s:** the grafana, prometheus, argo cd and loki clients dial through the egress-checked factory, and their pre-flight address checks go ([#2497](#2497)) ([e7ca1d5](e7ca1d5)) * **monitoring:** the roadmap Service alerts count a series that starts in the hour, and a lane of a new pod can stall ([#2514](#2514)) ([c7692b2](c7692b2)), closes [#2505](#2505) * **review:** a review's scanners leave out the rules that never gave a valid finding here ([#2508](#2508)) ([fe953ac](fe953ac)) * **roadmap:** a refine round leaves an outside account issue to a person, and refine neutralizes comment openers, www links and cross-repository references ([#2507](#2507)) ([e6230dc](e6230dc)), closes [#2478](#2478) * **sandbox:** the metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check ([#2521](#2521)) ([7c01426](7c01426)) * **security:** the subprocess environment guard refuses the zsh and interpreter keys that make a child run code ([#2510](#2510)) ([459621a](459621a)) * **service:** a restart keeps the halt, the budget window and the failure ledger, and a rate limit or a suspended installation stops every worker ([#2515](#2515)) ([3630de1](3630de1)), closes [#2474](#2474) ### Code Refactoring * **config:** settings resolve in one declared order through pydantic-settings sources ([#2518](#2518)) ([6a5447a](6a5447a)), closes [#2445](#2445) --- 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>
11 tasks
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.
Every setting now resolves in one order, which
setting_sourcesinsrc/devops_cli/config/settings.pydeclares once as pydantic-settings sources: its variable, then the project config file, then the global config file. A setting that no source holds keeps the default of its field. Before,load_settingsmerged the two files with_deep_merge, builtSettingswithmodel_validate, which reads no source, and then set each variable withdotted_set._resolve_data_configrebuilt thedatasection with rules of its own, andtelemetry_from_environmentapplied a partial copy of the variable step.SettingVariablesreads the variables that the settings fields declare (refactor(config): each setting declares its variable and description on its settings field, and the option, variable and secret registries are derived from it #2444), with the list parsing ofdevops config set. WhenDEVOPS_CLI_DATA_DIRis set, it also moves each data path that no variable of its own sets into that directory, as before.MappingSourceholds one config file as one load read it. The cache of the files and the YAML error that quotes no text of the file (fix(config): a config file that does not parse never prints its line from any command that loads settings #1468) stay. A null in the project file is still no value.load_settingsbuildsSettings(_build_sources=...), so pydantic-settings merges the sources and validates the result one time.telemetry_from_environmentuses the same variable source.Environment variable <name> cannot set <key>: ...(fix(config): numeric settings from environment variables load as strings and are never range-checked #992). A key that a section refuses still gets its file and line (feat(config): devops config unset removes a key, and an unknown key's error names the line and that command #2201).Settings(...)built in code holds its arguments and the defaults, and reads no variable and no file. Before, it read some variables, such asDEVOPS_CLI_DOMAIN, through the default environment source of pydantic-settings, whichload_settingsdid not read.security.secrets.build_default_resolver: the OS keyring, Vault, its variable, then the config file._apply_env_overrides,_resolve_data_config,_deep_merge,_read_config_layers,_merged_config_data,_DEFAULT_CHILD_DATA_MAPandenv_prefix.These results change:
ai.tasks.embedding, such as its timeout, keeps the embedding model. Before, the task's model became None, and the embedding task used the chat modelai.model. The embedding task has its own override class,AIEmbeddingTaskOverride, whosemodeldefaults to the embedding model.AttributeError.docs/CONFIGURATION.mdsays where the order is declared and states these rules.Closes #2445
Change:
openspec/changes/archive/2026-10-28-2445-settings-sources/