Repository navigation
Description
Context & Rationale
Paths are under src/devops_cli/. Evidence was checked at ef21785.
- 174 of the 361 distinct command callbacks declare no
--dry-runand have no dry-run branch in their body. I counted them by walkingtyper.main.get_commandfor every_COMMAND_SPECSmodule. - After feat(cli): reachable
--dry-runpreviews for delegated commands #412:devops --dry-run <cmd>printsWould run delegated command: …and runs nothing;devops <cmd> --dry-runfails withNo such option: --dry-run.
- Both outcomes are honest, but neither helps:
- read-only commands such as
config showandk8s podsdo not show their output; - mutating commands give no preview. Examples are
config set(commands/config.py:182-191),pr create,pr close,gh issues create,argo cd apps sync,ai cost resetandworkspace remove.
- read-only commands such as
- Some read-only commands that feat(cli): reachable
--dry-runpreviews for delegated commands #412 gives a--dry-runonly echo their arguments, for examplessh list(commands/ssh.py:342-348).
Scope & Deliverables
- Deliverable:
- Classify every command as read-only or mutating.
- Each mutating command declares
--dry-run, with a preview that returns before acting. - Each read-only command declares that it is read-only, and the feat(cli): reachable
--dry-runpreviews for delegated commands #412 proxy runs it normally under dry-run. - Remove the echo-only previews, and their option, from read-only commands, with no shim.
- Acceptance criteria:
- An invariant test: every command reachable from
_COMMAND_SPECSeither declares--dry-runor is marked read-only, never both. Verified by the test. devops --dry-run config showprints the configuration, anddevops --dry-run config set ai.provider ollamaprints a preview and writes nothing. Verified by tests withsave_settingspatched to fail.- The new tests add at most 1 s to the test step, recorded in the task file.
uv run devops cipasses.
- An invariant test: every command reachable from
- Key questions:
- How does a command declare that it is read-only? With a
read_onlyattribute set by a decorator indry_run/decorator.py, which the proxy reads (proposed). - Should this agree with the MCP
readOnlyHintannotations (feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857)? Yes (proposed). Add a consistency test for MCP tools that wrap adevopscommand, rather than keeping one shared list. - Does this fit one PR? Decide when this item is refined (proposed). If more than about 40 mutating commands need a new preview, split by command group, starting with
ghandpr.
- How does a command declare that it is read-only? With a
- Constraint: Tests start no process and touch no network, cluster or real scanner. No new dependency.
Strategic Alignment
- Milestone: (proposed) Backlog.
- Depends on: feat(cli): reachable
--dry-runpreviews for delegated commands #412. - Related: refactor(cli): one process runner owns execution, process groups and dry-run #775, and the MCP ToolAnnotations item feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857.
Split off #412 during the v0.2.25/v0.2.26 readiness review (2026-10-01): This is the classification the first draft of #412 wanted before flipping the switch. #412 now routes per command and fails safe: a command with no preview keeps the generic line. So this audit no longer has to come first, and it splits off as its own item.
Amended 2026-10-04: the owner's dry-run rule replaces "read-only commands run"
The owner (2026-10-04): "dry run should just return the command or request that would be run and a dry run response that is the exact same type as the real return object, not run a thousand api requests as read only". #412 records the rule. "Read-only" is therefore no longer a reason to run under a dry run. The line between the two cases is whether a command makes an external request: GitHub, a cluster, a model, the network, or a child process that does any of these.
-
A command with no external request (
config show,ssh list, local file reads) may run normally under a dry run, as this item proposed. It is marked read-only. -
A read-only command that makes external requests (
k8s pods,gh issues list,pr checks,ci) does not run. Under a dry run it returns its result type, marked as a dry run, with the ordered list of requests it would make. It usesdevops_cli.dry_run.requests.PlannedRequestfrom feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741 (argv, stdin and env with<placeholders>, plus condition and repeat). A preview that does the reads is a separately named mode,--plan. -
Evidence: on 2026-10-04,
devops ci --check --dry-run, run to list the gate's checks, ran every check instead, includinguv audit, which reaches the network, and a pytest with up to 8 workers. It was stopped by hand. -
Done: feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741 (
push-secrets,run-job,deploy-stack) and feat(github): single-entry item intake with duplicate detection and placement (devops roadmap intake) #742 (roadmap intake, with the CLI and MCP dry runs exporting no telemetry) already follow the rule. fix(github): GraphQL mutations and implicit-POSTgh apiwrites get the rate limiter's mutation pacing, decided from the request gh sends #1125 brings the roadmap store's board reads under it. -
The invariant test's classes are "makes no external request" (runs under a dry run) and "declares
--dry-run" (returns a request plan). A command that makes an external request without a request-plan dry run fails the test. -
devops ci --dry-runlists the checks and the exact commands it would run, in order, and runs none of them. Test: the subprocess runner is patched to fail. -
devops --dry-run k8s podsreturns the kubectl request it would make and makes none. Test: the runner is patched to fail.
Update 2026-10-08: refinement
#885 delivered devops ci --dry-run running nothing (tests/test_ci_dry_run.py:89-105); drop that criterion. This class means 'makes no external request', while #857's readOnlyHint means 'changes no state' (gh issues list is the first only), so the consistency test checks one direction: a tool wrapping a no-request command has readOnlyHint: true. #997 can read both facts from one declaration.
Proposed design
Problem statement
226 of 483 commands in _COMMAND_SPECS declare no --dry-run option. Commands that make external requests execute those requests under --dry-run instead of returning a plan. Commands that make no external requests lack a read_only marker. No invariant test enforces that every command either runs safely under dry-run or returns a request plan.
Acceptance criteria
- Criterion 1: Every command in
_COMMAND_SPECShas aread_onlymarker or declares--dry-runwith a request plan.
Verification: The invariant test passes. It fails when a command makes an external request and lacks both markers. - Criterion 2:
devops --dry-run k8s podsreturns the kubectl request it would make and makes none.
Verification: A test patches the subprocess runner to fail. The command exits 0 and the runner is not called. - Criterion 3: An MCP tool wrapping a no-request command has
readOnlyHint: true.
Verification: The consistency test intests/test_fastmcp_contracts.pypasses. - Criterion 4: Echo-only previews are removed from no-request commands with no shim.
Verification:devops --dry-run ssh listprints the SSH list output. The--dry-runoption is absent from thessh listcallback. - Criterion 5:
uv run devops cipasses.
Verification: Runuv run devops ciand confirm exit code 0.
Key questions
- How does a command declare that it is read-only?: A
read_onlyattribute set by a decorator indry_run/decorator.py. The proxy inmain.pyreads this attribute. (proposed) - Should this agree with the MCP
readOnlyHintannotations (feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857)?: Yes, one direction only. A tool wrapping a no-request command hasreadOnlyHint: true. The reverse is not required. feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857 means 'changes no state'; this class means 'makes no external request'. (proposed) - Does this fit one PR?: No. 226 commands declare no
--dry-run. More than 230 make external requests and lack request plans. Split by command group, starting withghandpr. (proposed)
Fit
Needs splitting into 9 items:
- Infrastructure: add the
read_onlydecorator indry_run/decorator.py, the proxy logic inmain.py, and the invariant test ghcommand group: add--dry-runrequest plans to external-request commandsprcommand group: add--dry-runrequest plans to external-request commandsk8scommand group: add--dry-runrequest plans to external-request commandsconfigcommand group: classify commands and addread_onlymarkers or--dry-runrequest plansargo cdcommand group: add--dry-runrequest plans to external-request commandsaicommand group: add--dry-runrequest plans to external-request commandsworkspacecommand group: add--dry-runrequest plans to external-request commands- Remaining command groups (
sshand others): classify and addread_onlymarkers or--dry-runrequest plans
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-10-29: not-applicable.
Tool: none found.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 25, 2026
This item cannot be built as written in one pull request.
_COMMAND_SPECShas 483 commands. 226 commands declare no--dry-run. More than 230 commands make external requests and lack request plans withPlannedRequest. The issue asks for an invariant test that fails when any external-request command lacks a request plan. The issue also requires splitting by command group if more than 40 commands need changes.Refinement must split this work into bounded issues by command group, starting with
ghandpr.9 remaining items
fix(roadmap): intake leaves the sub-issues of a candidate's source ou…
dan-petty commentedon Oct 28, 2026
The proposal at bb46660 needs splitting into 9 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
read_onlydecorator indry_run/decorator.py, the proxy logic inmain.py, and the invariant testghcommand group: add--dry-runrequest plans to external-request commandsprcommand group: add--dry-runrequest plans to external-request commandsk8scommand group: add--dry-runrequest plans to external-request commandsconfigcommand group: classify commands and addread_onlymarkers or--dry-runrequest plansargo cdcommand group: add--dry-runrequest plans to external-request commandsaicommand group: add--dry-runrequest plans to external-request commandsworkspacecommand group: add--dry-runrequest plans to external-request commandssshand others): classify and addread_onlymarkers or--dry-runrequest plansdevops-cli-service commentedon Oct 29, 2026
Alternatives check: not-applicable
Tool: none found
Checked on 2026-10-29. A person decides what this means for the item. The check changes no label and closes no issue.
fix(roadmap): make the alternatives check search before a verdict (#3127