Skip to content

feat(config): devops config unset removes a key, and an unknown key's error names the line and that command - #2207

Merged
dan-petty merged 1 commit into
mainfrom
feat/2201-config-unset
Oct 25, 2026
Merged

dan-petty merged 1 commit into
mainfrom
feat/2201-config-unset

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Since #2168, the ai settings refuse a key that they do not declare. A config file that still holds a removed key, such as ai.vllm_url, stops every command that loads the settings. On origin/main (527558f), a temporary config file with ai.vllm_url under DEVOPS_CLI_CONFIG makes devops config get ai.provider exit 1 with ValidationError: 1 validation error for Settings / ai / Value error, Unknown configuration key 'vllm_url'. [type=value_error]. The error names no file, no line and no fix, and devops config had no command that removes a key.

This pull request adds two things:

  • devops config unset <key> removes the key and its value from the active config file with the ruamel.yaml round trip of devops config set (feat(config): a settings save writes only the changed keys and keeps the comments and unknown keys of config.yaml #1999), so the comments, the order and the other lines stay. It loads no settings, so it works when the key stops the load. A write copies the file to <name>.bak-<YYYYMMDD-HHMMSS> (UTC) and records the removed key in the audit log, as a save does. A key that the file does not hold exits 1 and changes nothing. --dry-run prints the dry-run response with the key, its line and the lines of the unified diff, and writes nothing. A key name that holds a dot, such as qwen3.8:27b in ai.gateway_weights, resolves as one key.
  • When a section refuses a key (ai, ai.tasks or ai.tasks.<task>), the load error gives one line for each key, with the full dotted key, the file and the line, and the command that removes it: Unknown configuration key 'ai.vllm_url' at <file>:8. Release 0.2.34 removed it. Remove it with: devops config unset ai.vllm_url. A table of one entry gives the release (the 0.2.34 changelog names the removal of AIConfig.vllm_url). For a key in the config file that is not the active one, the command sets DEVOPS_CLI_CONFIG to that file. The hint for the per-model sampling and serving settings (top_k, min_p, ...) moves into this error.

The error comes from the extra_forbidden error of pydantic 2.13.5, whose location is the full key path. The hand-written unknown-key loops of AIConfig and AITaskOverride repeated extra="forbid" and reported only the section, so this change deletes them. The line comes from ruamel.yaml 0.19.1 (CommentedMap.lc.key), and the files are read again only on the error path.

The tests use temporary config files under tmp_path alone. No test reads or writes the real config.yaml or keyring. The changed tests pass with PATH=/usr/bin:/bin.

Pending a person: run devops config unset ai.vllm_url on the workstation config file, then devops config show. This branch did not touch that file.

Item

Closes #2201

Change: openspec/changes/archive/2026-10-25-2201-config-unset/

… error names the line and that command

The ai settings refuse a key that they do not declare. A config file
that still holds a removed key, such as ai.vllm_url, stopped every
command that loads the settings with a pydantic error that named no
file, no line and no fix, and devops config had no command to remove
a key.

devops config unset <key> removes the key and its value from the
active config file with the round trip of devops config set, so the
comments, the order and the other lines stay. It loads no settings,
so it works when the key stops the load. A write copies the file to
<name>.bak-<YYYYMMDD-HHMMSS> and records the removed key in the audit
log. A key that the file does not hold exits 1 and changes nothing.
--dry-run prints the change with the lines of its unified diff and
writes nothing.

When a section refuses a key, the load error now names the full
dotted key, its file and line, and the command that removes it, for
example: Unknown configuration key 'ai.vllm_url' at <file>:8. Release
0.2.34 removed it. Remove it with: devops config unset ai.vllm_url.
A small table gives the release that removed a key. The error uses
the extra_forbidden error of pydantic, which holds the full key path,
so the hand-written unknown-key loops of AIConfig and AITaskOverride
are deleted. The hint for the per-model sampling settings moves into
the same error.

Closes #2201
@dan-petty
dan-petty marked this pull request as ready for review October 25, 2026 00:38
@dan-petty
dan-petty merged commit 217e05b into main Oct 25, 2026
17 checks passed
@dan-petty
dan-petty deleted the feat/2201-config-unset branch October 25, 2026 00:56
dan-petty pushed a commit that referenced this pull request Oct 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.5.0](v0.4.3...v0.5.0)
(2026-10-25)


### Features

* **config:** devops config unset removes a key, and an unknown key's
error names the line and that command
([#2207](#2207))
([217e05b](217e05b)),
closes [#2201](#2201)
* **k8s:** devops k8s volume move copies a local-path claim to a volume
on another node and rebinds it, with argo cd paused and each step
checked ([#2199](#2199))
([8efee07](8efee07)),
closes [#2186](#2186)


### Bug Fixes

* **review:** exclude deleted files and record scanner failures per file
([#1140](#1140))
([#2204](#2204))
([cdc5070](cdc5070))

---
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>
dan-petty added a commit that referenced this pull request Oct 25, 2026
…nymous refusal, clone url, registry token and no egress (#2200)

## Summary

After the Gitea stack (#1081) was deployed, a person ran its checks by
hand, as curl and kubectl lines from the pull request body. One paste
failed on a placeholder. Now `devops k8s doctor --stack gitea` runs the
checks of the live stack in place of the cluster rules, and shows the
result and the reason of each check. A failed check does not stop the
next one. The command exits 2 when a check fails, and 0 when every check
passes.

| Check | It passes when |
| :--- | :--- |
| `application-gitea`, `application-gitea-manifests` | the Application
is `Synced` and `Healthy` |
| `volume-retained` | the volume of claim `gitea-shared-storage` has the
reclaim policy `Retain` |
| `pod-security-restricted` | namespace `gitea` has the Pod Security
enforce level `restricted` |
| `ingress-host` | Ingress `gitea/gitea-ingress` has a host that is not
`git.example.com`, the placeholder in git |
| `tunnel-host` | `GET /user/login` on that host answers 200 |
| `anonymous-read-refused` | `GET /api/v1/repos/search` with no sign-in
answers 401 or 403 |
| `registry-token` | `GET /v2/` answers 401 with a Bearer challenge
whose realm is an HTTPS URL on the host |
| `clone-url` | a temporary private repository `devops-doctor-<random>`,
made as `gitea_admin` with the password from the keyring, has its
`clone_url` under `https://git.<domain>/`, and an `ssh_url` that does
not name that host |
| `temporary-repository-deleted` | Gitea deleted that repository |
| `no-egress` | `curl https://github.com` in the Gitea container cannot
connect (exit 7 or 28) |

- kubectl runs through `run_subprocess`. The HTTP requests go through
`new_http_client` at egress level `public`, to the host of the live
Ingress only. Without a host, the checks through the tunnel fail with
`not run` and send nothing.
- The password comes from the settings layer at run time
(`gitea.admin_password`, keyring `gitea_admin_password`). It goes only
into the Authorization header of the create and the delete. A test holds
it out of the output, the log records, the kubectl argument lists and
the printed requests.
- The delete goes out whenever Gitea can hold the repository: after a
201, also when the clone-URL check fails, and when the create gets no
answer. A refused create (400, 409, 422) made nothing, and a 409 means
that another repository has the name, so no delete goes out. A failed
delete names the repository to delete by hand.
- When the configuration does not load, `clone-url` fails with the
reason and sends no create, and the other checks still report. For an
unknown key, the reason is the error of the settings (#2207): the file,
the line and `devops config unset <key>`. For another refused value, the
reason is the key and the message, with no value.
- `--dry-run` lists the twelve kubectl commands and HTTP requests, with
placeholders, and starts no program, sends no request and reads no
keyring entry.
- `DoctorReport` gets `checks`, a list of `DoctorCheck`. The MCP tool
`k8s_doctor` gets the parameter `stack` and `readOnlyHint: false`,
because `stack` makes a repository (#857).
- The shared HTTP fake `StubWeb` gets `serve`, a server that answers by
method and body, because the delete goes to a name that only the run
knows.
- `k8s/README.md`, Gitea: rollout step 5 and the new section `Stack
checks` name the command in place of the hand-run lines.

A change from the issue body: the issue asks for "no SSH URL". Gitea
1.27.3 always fills `ssh_url` (`services/convert/repository.go`,
`ComposeSSHCloneURL` in `models/repo/repo.go` does not read
`DISABLE_SSH`). The live configuration has `SSH_DOMAIN =
gitea-http.gitea.svc.cluster.local`, so `ssh_url` names the in-cluster
address, where nothing answers. The check passes when `ssh_url` does not
name the tunnel host, which carries no SSH.

Evidence (2026-10-24): the Gitea v1.27.3 source and swagger (`POST
/user/repos` answers 201, 400, 409 or 422; `DELETE
/repos/{owner}/{repo}` answers 204, 403 or 404;
`ENABLE_BASIC_AUTHENTICATION` defaults to true), and read-only kubectl
and anonymous curl on the homelab cluster. One live run of the command
on the homelab cluster after the change: all 11 checks passed, the
temporary repository was deleted, and a listing of the repository store
in the pod shows no `devops-doctor-` repository.

Tests: `tests/test_gitea_doctor.py` (40 tests) on `ProcessFake`,
`StubWeb` and `FakeKeyring`: the pass and the fail of each check, the
delete of the temporary repository in each case, the password, a
configuration that does not load (an unknown key and a refused value),
the dry run and the command. They fail on `origin/main` (no module
`devops_cli.k8s.gitea_doctor`). No test starts a program or reaches a
network.

Pending a person: the workspace `config.yaml` still holds `ai.vllm_url`,
which v0.2.34 removed. Since #2168, the settings refuse it, so
`clone-url` fails with that reason, which names `devops config unset
ai.vllm_url`, until a person runs that command.

## Item

Closes #2187

Change: `openspec/changes/archive/2026-10-24-2187-gitea-stack-doctor/`
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.

feat(config): devops config unset removes a key, and an unknown key's error names the line and that command

1 participant