Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ k8s/. |
| [**uv**](docs/commands/uv.md) | `devops uv sync [OPTIONS]` | Sync project dependencies into the virtual environment. |
| | `devops uv lock [OPTIONS]` | Regenerate the uv lockfile. |
| | `devops uv python-install [OPTIONS]` | Install project Python version with uv. |
| | `devops uv run` | Run an arbitrary command using `uv run`. |
| | `devops uv run [OPTIONS]` | Run an arbitrary command using `uv run`. |
| [**scan**](docs/commands/scan.md) | `devops scan trivy [OPTIONS] <target>` | Run Aqua Trivy vulnerability, secret, and misconfiguration scan. |
| | `devops scan secrets [OPTIONS] <target>` | Run Gitleaks secret pre-filter scan across workspace or targets. |
| | `devops scan workflows [OPTIONS] <target>` | Audit GitHub Actions workflows with zizmor offline: template injection, unpinned actions
Expand Down
17 changes: 16 additions & 1 deletion docs/CLI_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3232,6 +3232,7 @@ devops uv sync [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--frozen` | `boolean` | - | Do not update lockfile. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

### `devops uv lock`

Expand All @@ -3246,6 +3247,7 @@ devops uv lock [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--upgrade` | `boolean` | - | Upgrade dependencies while locking. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

### `devops uv python-install`

Expand All @@ -3260,6 +3262,7 @@ devops uv python-install [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--version`, `-v` | `string` | - | Python version to install (defaults to .python-version). |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

### `devops uv run`

Expand All @@ -3270,10 +3273,19 @@ Run an arbitrary command using `uv run`.
Example:
devops uv run -- pytest -q

A dry run lists the one `uv run` command and starts nothing. What that command does is
not a request of devops-cli, so the plan does not list it.

```bash
devops uv run
devops uv run [OPTIONS]
```

**Options:**

| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

## devops scan
Expand Down Expand Up @@ -6400,6 +6412,7 @@ devops mcp serve [OPTIONS]
| `--host`, `-h` | `string` | `127.0.0.1` | Host interface for SSE transport. |
| `--port`, `-p` | `integer` | `8000` | Port number for SSE transport. |
| `--allow-remote` | `boolean` | - | Permit binding SSE transport to non-loopback network interfaces. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

### `devops mcp tools`

Expand All @@ -6422,6 +6435,7 @@ devops mcp export-schemas [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--output-dir`, `-o` | `path` | - | Destination directory for tool schema JSON files. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand Down Expand Up @@ -9273,6 +9287,7 @@ devops serve [OPTIONS]
| `--log-level`, `-l` | `string` | `info` | Logging level (debug, info, warning, error). |
| `--docs` / `--no-docs` | `boolean` | `True` | Enable or disable Swagger UI (/docs) and ReDoc (/redoc). |
| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status, triage and model lanes. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ devops mcp serve [OPTIONS]
| `--host`, `-h` | `string` | `127.0.0.1` | Host interface for SSE transport. |
| `--port`, `-p` | `integer` | `8000` | Port number for SSE transport. |
| `--allow-remote` | `boolean` | - | Permit binding SSE transport to non-loopback network interfaces. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand All @@ -46,5 +47,6 @@ devops mcp export-schemas [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--output-dir`, `-o` | `path` | - | Destination directory for tool schema JSON files. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---
1 change: 1 addition & 0 deletions docs/commands/serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ devops serve [OPTIONS]
| `--log-level`, `-l` | `string` | `info` | Logging level (debug, info, warning, error). |
| `--docs` / `--no-docs` | `boolean` | `True` | Enable or disable Swagger UI (/docs) and ReDoc (/redoc). |
| `--service`, `-s` | `boolean` | - | Run continuous background service with GitHub webhook verification and per-repository status, triage and model lanes. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---
14 changes: 13 additions & 1 deletion docs/commands/uv.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ devops uv sync [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--frozen` | `boolean` | - | Do not update lockfile. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand All @@ -33,6 +34,7 @@ devops uv lock [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--upgrade` | `boolean` | - | Upgrade dependencies while locking. |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand All @@ -49,6 +51,7 @@ devops uv python-install [OPTIONS]
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--version`, `-v` | `string` | - | Python version to install (defaults to .python-version). |
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---

Expand All @@ -61,8 +64,17 @@ Run an arbitrary command using `uv run`.
Example:
devops uv run -- pytest -q

A dry run lists the one `uv run` command and starts nothing. What that command does is
not a request of devops-cli, so the plan does not list it.

```bash
devops uv run
devops uv run [OPTIONS]
```

**Options:**

| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. |

---
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- **`test sandbox` reuses `plan_docker_sandbox` and `declared_controls()`, as `docker sandbox` does.** Both commands use `WorkloadSandboxRunner`. The workspace check stays before the plan, so the tests of #1383 keep passing. `build_dry_run_details` has no caller after this, so it goes with the tests that call only it. The rootless user note that it printed does not appear in the plan of `docker sandbox` either.
- **`test run` keeps its git reads for `--changed`.** The targets are the input of the plan. They come from local `git diff` and `git status` calls, as the targets of `ci mutate --changed` do. No call leaves the machine. The existing tests of `--changed` already run on a real repository.
- **`test profile-memory` is `no-external-request`, with a local preview.** The built-in targets run in memory (`httpx2.ASGITransport`, `list_mcp_tools()`). A target `module:function` runs user code, which can make any request. A dry run therefore runs nothing. It prints the target, the iteration count, the limits and the path of the report that the run would write. It writes nothing.
- **`ci fail-to-pass` is `request-plan`, and its plan starts no git call.** The real run starts ten processes. The plan lists them with placeholders `<merge-base>`, `<tree>` and `<changed test files>`, and gives a condition to the steps that run only when the diff holds a changed test file. The pure argument builders live next to the code that runs them. The two git reads in `src/devops_cli/git/operations.py` get a builder each, and the behavior of those two functions does not change. The class sits on the callback, so `format fail-to-pass` and `lint fail-to-pass` leave the gap list too.
- **`ci fail-to-pass` is `request-plan`, and its plan starts no git call.** The real run starts ten processes. The plan lists them with placeholders `<merge-base>`, `<temp-dir>` and `<changed test files>`, and gives a condition to the steps that run only when the diff holds a changed test file. The pure argument builders live next to the code that runs them. The two git reads in `src/devops_cli/git/operations.py` get a builder each, and the behavior of those two functions does not change. The class sits on the callback, so `format fail-to-pass` and `lint fail-to-pass` leave the gap list too.
- **A server dry run lists the bind and the start.** `serve` and `mcp serve` start a server that makes no outbound request until a client calls it. A mark-only class would start a blocking server under `devops --dry-run`. The plan has two requests, bind and start, and reads its values from the same function as the real call (`uvicorn.run` options, `run_mcp_server` arguments). `mcp serve --transport sse` applies the same loopback check as the real run, through one shared function. `serve --service` does not load settings or read credentials in a dry run. The real run reports the configuration errors.
- **`mcp export-schemas` is a local preview, and `mcp tools` is mark-only.** The export writes files and makes no request. The preview counts the tools with the same listing and prints the directory. `mcp tools` only reads the registry.
- **The proxy tests use a stub app, not `serve`.** Three tests use `serve` as the example of a command with no class and no `--dry-run`. Every later child of #886 would break them the same way. A stub module in `tests/support/dry_run_stub.py` gives them a command that stays unclassified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ None.
Checked on 2026-11-01 against `origin/main` at commit `4734035c`, with the commands below.

1. The 14 commands exist and are in the gap list. `PYTHONPATH=. uv run python` with `_collect_reachable_commands()` of `tests/invariants/test_dry_run_class_ratchet.py` gives, for each of them, its callback, whether it declares `--dry-run`, and its class. All 14 have class `None`. Eight declare no `--dry-run`: `mcp export-schemas`, `mcp serve`, `mcp tools`, `serve`, `uv lock`, `uv python-install`, `uv run` and `uv sync`. Six declare it, and print the echo: `ci fail-to-pass`, `pipeline`, `test load`, `test profile-memory`, `test run` and `test sandbox`.
2. One callback serves three paths. The same script prints `devops_cli.commands.ci fail_to_pass` for `ci fail-to-pass`, `format fail-to-pass` and `lint fail-to-pass`. The class sits on the callback, so the ratchet test demands that all three leave the gap list: `Command 'x' has dry-run class ... but is still listed`. The first plan missed this. No other path of this item shares a callback.
2. One callback serves three paths. The same script prints `devops_cli.commands.ci fail_to_pass` for `ci fail-to-pass`, `format fail-to-pass` and `lint fail-to-pass`. The class sits on the callback, so the ratchet test demands that all three leave the gap list: `Command 'x' has dry-run class ... but is still listed`. The first plan missed this. No other path of this item shares a callback. A user cannot start the two extra paths: `format` and `lint` are root-level commands (`CONST_CLI_ROOT_LEVEL_COMMANDS`), so `devops format fail-to-pass --base main` runs the `format` command and fails with `No such option: --base`. For that reason the tests run the plan through `ci fail-to-pass` only.
3. Today's output. `uv run devops uv lock --dry-run` prints `No such option: --dry-run`. `uv run devops --dry-run uv lock`, `--dry-run mcp tools` and `--dry-run serve` print `Would run delegated command: devops <command>`. `uv run devops test load --dry-run` prints a JSON echo with `"action": "execute_k6_load_test"` and a `simulated_metrics` object. `uv run devops pipeline --dry-run` prints `"status": "SIMULATED_SUCCESS"`.
4. The line numbers in the issue table are stale. `commands.test_cmd:run_test_cmd:162` is now a line of the target selection. The `uv run` call is later in the same function. The symbols are right: `run_test_cmd` runs `run_subprocess(["uv", "run", *test_args])`. The sources of the issue to read are `tests/roadmap/test_roadmap_dry_runs.py` (the plan comparison pattern) and `tests/invariants/test_dry_run_class_ratchet.py`. `tests/test_roadmap_dry_runs.py` does not exist (`git cat-file -e origin/main:tests/test_roadmap_dry_runs.py` fails).
5. Nothing newer did or removed the work. `git log --since=2026-10-25` on the six command files and on `src/devops_cli/ci/fail_to_pass.py` shows no commit that adds a dry run or deletes a command. The newer commits are #2589 and #2353 (fail-to-pass replay), #2588 (sandbox seccomp option), #2515 and #2354 (Service). Open issues: #2258 plans four other command groups, and no open issue plans these 14 commands. Sibling plans touch the same gap file and the same spec but name other paths and other requirement names.
6. `test profile-memory` makes no external request. `src/devops_cli/telemetry/memory_profiler.py` runs the `http-pool` target against `httpx2.ASGITransport(app=_dummy_app)`, an in-memory transport. The `fastmcp` target calls `list_mcp_tools()`. `uv run devops test profile-memory http-pool --iterations 2 --format json` prints `"initial_sockets": 0` and `"final_sockets": 0`. The issue row (`http .send()`) is wrong for the built-in targets. A target `module:function` runs a function of the user, so a dry run cannot run it. The class is `no-external-request`, with a local preview.
7. `ci fail-to-pass` makes no network request either. `git grep -n "fetch\|pull\|clone" -- src/devops_cli/ci/fail_to_pass.py` finds only a docstring line. A missing base ref raises `GitOperationError` through `_verify_commit`; the command never fetches. The real run starts `git merge-base`, two `git rev-parse --verify`, `git diff --name-status`, `git ls-files --others`, `git worktree add`, `git archive`, `python -m pytest`, `git worktree remove` and `git worktree prune`. It is a request-plan command like `ci mutate`, which is `request-plan` on main for the same reason (it starts local processes). The test `test_fail_to_pass_dry_run_and_no_changed_tests` in `tests/ci/test_fail_to_pass.py` says the dry run starts no git call, so the plan uses placeholders for `<merge-base>`, `<tree>` and `<changed test files>`.
7. `ci fail-to-pass` makes no network request either. `git grep -n "fetch\|pull\|clone" -- src/devops_cli/ci/fail_to_pass.py` finds only a docstring line. A missing base ref raises `GitOperationError` through `_verify_commit`; the command never fetches. The real run starts `git merge-base`, two `git rev-parse --verify`, `git diff --name-status`, `git ls-files --others`, `git worktree add`, `git archive`, `python -m pytest`, `git worktree remove` and `git worktree prune`. It is a request-plan command like `ci mutate`, which is `request-plan` on main for the same reason (it starts local processes). The test `test_fail_to_pass_dry_run_and_no_changed_tests` in `tests/ci/test_fail_to_pass.py` says the dry run starts no git call, so the plan uses placeholders for `<merge-base>`, `<temp-dir>` and `<changed test files>`.
8. `uv run` and `pipeline` can list a plan. The real run passes one list to one process: `_run(["uv", "run", *ctx.args])` in `src/devops_cli/commands/uv.py`, and `build_dagger_cmd(...)` in `src/devops_cli/commands/pipeline.py`. The plan holds that one request. What `uv run` or `dagger call` does inside is not a request of devops-cli, so the plan does not list it. The resolver inserts `--dry-run` right after the command path (`_build_forwarded_args` in `src/devops_cli/core/command_resolver.py`), so `devops --dry-run uv run -- pytest` gives `uv run --dry-run -- pytest` and the tokens after `--` reach the plan unchanged.
9. The uv argument list needs `prepare_tool_cmd`. `DefaultProcessRunner.prepare_cmd` calls `prepare_tool_cmd`, which adds `--preview-features malware-check,check-command` after `uv` (`src/devops_cli/core/process.py`). The plan must apply it, as `_planned_request_for_cmd` in `src/devops_cli/commands/ci.py` does, or the plan drifts from the run.
10. `test sandbox` already has a model. `docker sandbox` in `src/devops_cli/commands/docker.py` builds its plan with `plan_docker_sandbox` and `WorkloadSandboxRunner.declared_controls()`, and it checks the workspace first. `test sandbox` has the same runner and the same flow. The tests of #1383 (`test_sandbox_dry_runs_refuse_invalid_workspaces`) pin the workspace check for both commands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The commands `mcp serve` and `serve` SHALL carry the `request-plan` dry-run clas
- **THEN** the plan prints a bind request for `127.0.0.1:9000` and a start request that names 2 workers

### Requirement: ci-fail-to-pass-request-plans
The command `ci fail-to-pass`, and the paths `format fail-to-pass` and `lint fail-to-pass` that share its callback, SHALL carry the `request-plan` dry-run class. Under `--dry-run` the command SHALL start no process, git call included. It SHALL print the ordered requests of the replay, built by the argument builders that the replay uses, with the placeholders `<merge-base>`, `<tree>` and `<changed test files>`.
The command `ci fail-to-pass`, and the paths `format fail-to-pass` and `lint fail-to-pass` that share its callback, SHALL carry the `request-plan` dry-run class. Under `--dry-run` the command SHALL start no process, git call included. It SHALL print the ordered requests of the replay, built by the argument builders that the replay uses, with the placeholders `<merge-base>`, `<temp-dir>` and `<changed test files>`.

#### Scenario: Dry run on ci fail-to-pass
- **WHEN** a user runs `devops ci fail-to-pass --base main --dry-run` with the process fake patched to fail on any call
Expand Down
Loading
Loading