Repository navigation
Description
What happened
devops --dry-run config unset <key> removes the key and writes a backup. A dry run must write nothing.
Reproduced on main (24ef67ac) in a plain clone with a temporary HOME and a config of two keys:
$ devops --dry-run config unset ai.model
Removed ai.model from <config>.yaml:3.
The file before the change is in <config>.yaml.bak-<stamp>.
The key is gone from the file after the command, and the backup file exists. devops config unset ai.model --dry-run (the option after the command) exits 2 with "No such option: --dry-run", so the only form that is accepted is the global option, and that form deletes.
Cause
unset_value (src/devops_cli/commands/config.py:313-334) has no dry_run parameter and calls remove_config_key(key, dry_run=False). No code reads removal.diff. Commit 47cdf0d (#2963, closes #2255) removed the preview that #2207 had added, and tests/commands/test_config.py:158 now asserts that --dry-run config unset removes the line. The spec requirement "--dry-run writes nothing", with the diff printed, at openspec/specs/config-commands/spec.md:156 disagrees with the code.
What should happen
- A dry run of
config unsetwrites nothing: it does not change the config file and does not write a backup. - It prints the diff of the removal, with the value of a credential key redacted.
write_history.credential_pathsis the source of the credential key paths. - The test at
tests/commands/test_config.py:158asserts the new behavior. - The spec and the code agree.
Source
Found while fixing the plan pull request #3158 for #2740. #2740 (a dry-run preview that prints the value of a credential) is superseded: there is no preview to redact today, and this issue restores the preview with a redacted diff. The plan PR #3158 should close unmerged once #2740 is rejected or rewritten.
Related: #2740, #2963, #2255, #2207.
Proposed design
Problem statement
A dry run of devops config unset deletes the key and writes a backup. A dry run must write nothing. It must print the removal diff with credential values redacted. The test and the spec must agree with this behavior.
Acceptance criteria
Requirement: Dry run writes no config change
The command devops --dry-run config unset SHALL leave the config file unchanged and SHALL NOT create a backup file.
Scenario: Dry run keeps the key
- WHEN The config file holds
ai.modeland the user runsdevops --dry-run config unset ai.model. - THEN The config file content is unchanged and no
.yaml.bak-file exists.
Requirement: Dry run prints the removal diff
The command devops --dry-run config unset SHALL print the diff of the removal.
Scenario: Dry run shows the removed line
- WHEN The config file holds
ai.modeland the user runsdevops --dry-run config unset ai.model. - THEN The output contains a diff that shows the removal of the
ai.modelline.
Requirement: Credential value redacted in dry-run diff
The dry-run diff SHALL replace the value of a credential key with ***REDACTED***.
Scenario: Credential value is hidden
- WHEN The config file holds a credential key and the user runs
devops --dry-run config unset. - THEN The output contains
***REDACTED***and does not contain the credential value.
Requirement: Dry-run test asserts no write and redacted diff
The config unset test SHALL assert that a dry run writes nothing and prints a redacted diff.
Scenario: Test covers dry-run unset
- WHEN The test suite runs
tests/commands/test_config.py. - THEN The dry-run unset test passes and checks the unchanged file, the absent backup, and the redacted diff.
Requirement: Spec and code agree on dry-run behavior
The config-commands spec and the config unset command SHALL state that a dry run writes nothing and prints the removal diff.
Scenario: Spec text matches the command
- WHEN A reader compares the
config-commandsspec with the dry-run behavior ofconfig unset. - THEN Both state that the dry run writes no file and no backup, and prints the removal diff.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers this need: the defect is in devops-cli's own config unset command. The change edits existing code, so the written cost is small: about 2,000 tokens to build, keep and fix, and under one hour of elapsed time.
Key questions
- What must a dry run of
config unsetwrite?: A dry run must write no config change and no backup. It must print the removal diff. [sources: openspec/specs/config-commands/spec.md:156, src/devops_cli/commands/config.py:313-334] - Should
config unsetaccept--dry-runafter the command as a command option?: No. Keep the global--dry-runoption only. (best practice) [sources: src/devops_cli/commands/config.py:315, tests/commands/test_config_workspace_docs_dry_run.py:71]- Chosen: Global
--dry-runonly. The command already uses the shared dry-run decorator, and the test classifies it as no-external-request. - Rejected: Add a command-level
--dry-runoption. This duplicates the global option and changes the command surface beyond the defect. - Rejected: Accept both forms. This adds a second path with no need and no test.
- Chosen: Global
- How should the command produce the dry-run diff?: Print the
difffield from theremove_config_keyresult. (best practice) [sources: src/devops_cli/commands/config.py:313-334, openspec/specs/config-commands/spec.md:156]- Chosen: Print
removal.diff. The removal result already holds the diff, and the command currently ignores it. - Rejected: Recompute the diff in the command. This duplicates removal logic and can disagree with the result.
- Rejected: Print only the key and line number. The spec requires the diff, not only the location.
- Chosen: Print
- How should the dry-run diff redact a credential value?: Use the credential key paths from
write_history.credential_pathsand show***REDACTED***in place of the value. (best practice) [sources: src/devops_cli/commands/config.py:315, openspec/specs/config-commands/spec.md:156]- Chosen: Use
write_history.credential_pathsand***REDACTED***. This reuses the project's credential path source and the existing redaction marker. - Rejected: Redact by key name pattern. This duplicates the credential path list and can miss a configured key.
- Rejected: Print the diff with no redaction. This leaks a credential value in the preview.
- Chosen: Use
- What should the existing dry-run test at
tests/commands/test_config.py:158assert?: It must assert that the dry run leaves the file unchanged, writes no backup, and prints a redacted diff. (best practice) [sources: tests/commands/test_config.py:158, openspec/specs/config-commands/spec.md:156]- Chosen: Replace the removal assertion with the dry-run assertion. The current assertion records the defect and contradicts the spec.
- Rejected: Add a new test and keep the old assertion. The old assertion would still fail the new behavior.
- Rejected: Remove the test. The behavior needs a regression test.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 2, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(config)scope of the title gives the scope.Users who rely on --dry-run to preview changes will lose their config key and get an unexpected backup file.Requires adding a dry_run parameter, restoring the preview with credential redaction, updating the test, and aligning the spec.Both concern config unset --dry-run and credential redaction, but the candidate also fixes the file deletion and restores the missing preview.devops-cli-service commentedon Nov 2, 2026
Status set to Ready at bc0434e (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/3218-config-unset-with-dry-run-deletes, draft pull request #3234. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
The plan run made 2 model request(s), and used 96736 input tokens and 2985 output tokens. The tool calls, in order:
read_file({"path":"src/devops_cli/commands/config.py","start_line":280,"end_line":360})read_file({"path":"tests/commands/test_config.py","start_line":1,"end_line":220})read_spec({"capability":"config-commands","requirement":"devops config unset --dry-run writes nothing"})docs(openspec): plan #3218 dry-run config unset writes nothing
docs(openspec): plan #3218 dry-run config unset writes nothing (#3234)
dan-petty commentedon Nov 4, 2026
Amendment that the plan of this issue needs. It comes from the close of #2740, which this plan supersedes.
The defect in the plan. Task 1.2 of
openspec/changes/3218-config-unset-with-dry-run-deletes/tasks.mdredacts onlyprevious, and it builds the diff againstcontent._redactdrops a comment line that holds the replaced value (src/devops_cli/config/write_history.py:85), andround_trip.editkeeps that line incontent(src/devops_cli/config/settings.py:1714). So the diff shows the comment as an added line, with the credential value in it. A run with fake data on main, with the steps of task 1.2, reproduced this. Removing the key from the redacted text gave a diff with only the redacted line.The amendment.
contentfor the live write stays unredacted.specs/config-commands/spec.md: add the matching scenario.How. An amendment by the job cannot change a spec delta (
docs/ROADMAP_WORKFLOW.md:163), and the job readstasks.mdfrom the default branch (tasks_on_defaultinsrc/devops_cli/roadmap/planned.py). So open adocs(openspec)pull request that changes the folder before an implement run takes this item.Also from #2740. The value of a key that is not a credential stays in the diff as the file writes it. The live run stays as it is, and
tests/config/test_config_key_removal.py:208and:249cover it. The reproduction steps of #2740 stay readable on that issue.docs(config): generate the redaction note of the unset dry run (#3218)
devops-cli-service commentedon Nov 4, 2026
Released in v0.56.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.56.0
devops-cli-service commentedon Nov 4, 2026
Live since 2026-11-04 21:19 UTC
docs(security): design a sandboxed read-only run tool for the planner (…
feat(roadmap): allow-list builder for planner read-only commands (#4378)