Repository navigation
Description
Part of #886. Depends on sub-issue 00 (the dry-run class ratchet test).
Problem or Motivation
The owner's dry-run rule (#412) says that a dry run makes no external request and returns the requests that the real run would make. The #886 inventory (2026-10-25, commit 1bb164b) found 9 gh api, status, branch-protection and secrets commands that do not obey it:
- 9 commands make an external request, or possibly make one, and have no request plan.
- These commands have 1 more paths under a second name. A class on the callback clears those paths too.
A command without a request plan either prints the generic Would run delegated command line under devops --dry-run, or fails with No such option: --dry-run, or prints an echo of its arguments. None of these shows the requests.
Proposed Solution & Architectural Design
For each command in the table:
- Request plan: add
--dry-runif it is missing. The dry run makes no external request, reads included. It returns the command's real result type, marked as a dry run, with the orderedPlannedRequestitems (argv, stdin and env with<placeholders>, plusconditionandrepeat). Build eachPlannedRequestfrom the same argument builder that the real run uses, so that the plan cannot drift from the run. Print it withrender_request_plan. Give the command therequest-planclass. - Remove an echo-only preview (
render_dry_run_resultor@dry_run_command) when the command gets its new dry run, with no shim. - Remove the command's paths from
tests/fixtures/dry_run_gaps.json.
Notes from the inventory:
gh apipasses any request through. Its plan is the onegh apiargv that the command would run.gh statusand the rootstatuscommand read the public status pages over HTTP (telemetry/service_status.py).statushas 1 command, so it joins this group.gh branch-protection syncandgh secrets synchave a--dry-runtoday. Check whether their dry run still reads GitHub, and replace it with a request plan.- The table comes from a static walk of each callback and the functions that it calls. Check each row against the code before you change it. If a row is wrong, change the class to match the code, and record the evidence in the pull request.
| Command | --dry-run today |
External request | Work | Evidence |
|---|---|---|---|---|
gh api |
no | yes | request plan | gh @ github.rate_limiter:run_gh:1774 |
gh branch-protection audit |
no | yes | request plan | gh api @ github.branch_protection:get_remote_branch_protection:139 |
gh branch-protection sync |
yes | yes | request plan | gh @ github.rate_limiter:run_gh:1774 |
gh metrics |
no | yes | request plan | gh api @ github.client:GhCliClient.api:289 |
gh rate-limit |
no | yes | request plan | gh @ github.rate_limiter:run_gh:1774 |
gh secrets list |
no | yes | request plan | gh api @ github.secrets:list_repository_secrets:95 |
gh secrets sync |
yes | yes | request plan | gh @ github.rate_limiter:run_gh:1774 |
gh status |
no | yes | request plan | http: httpx2.HTTPTransport @ http.client:egress_transport:106 |
status |
no | yes | request plan | http: httpx2.HTTPTransport @ http.client:egress_transport:106 |
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
The work uses what the repository has: devops_cli.dry_run.requests.PlannedRequest and render_request_plan (#741), the dry-run class decorator and ratchet test from sub-issue 00, and the test guards in tests/conftest.py and tests/test_roadmap_dry_runs.py. No new dependency is necessary.
Acceptance Criteria
- Each command in the table is out of
tests/fixtures/dry_run_gaps.json, and the ratchet test passes. - For each request-plan command,
devops <command> --dry-runanddevops --dry-run <command>make no external request and print the ordered requests. Verified by tests with the process runner, the HTTP clients and the other clients patched to fail. - For each request-plan command with
--format jsonor--json, the dry run returns the real result type marked as a dry run, with the planned requests. Verified by tests. - For each request-plan command, the plan holds the requests that the real run makes, in the same order. Verified by a test that runs the real command against a fake runner or client that records each call, and compares the calls with the plan (the pattern of
tests/test_roadmap_dry_runs.py). - Echo-only previews of these commands are gone, with no shim.
- The new tests start no process and open no socket. The pull request records their time.
-
uv run devops cipasses.
Source: #886
Proposed design
Problem statement
Nine commands do not follow the dry-run rule. They make external requests or show no request plan. This item makes each command list its planned requests and make no request.
Acceptance criteria
- Criterion 1: The ratchet test passes after the commands are removed from tests/fixtures/dry_run_gaps.json.
Verification: Run the dry-run ratchet test and confirm that it passes. - Criterion 2: Each command in the table has the request-plan class.
Verification: Inspect the callback class and confirm that it is request-plan. - Criterion 3: Both devops --dry-run and devops --dry-run make no external request.
Verification: Run tests with the process runner, HTTP clients, and other clients patched to fail and confirm that they fail when a request is made. - Criterion 4: Each dry run prints the ordered requests that the real run would make.
Verification: Run the dry run and confirm that the output lists the planned requests in order. - Criterion 5: Each command with --format json or --json returns its real result type marked as a dry run.
Verification: Run a test that checks the type, the dry_run flag, and the planned requests. - Criterion 6: The plan holds the requests that the real run makes, in the same order.
Verification: Run the real command against a fake runner or client that records each call, and compare the calls with the plan. - Criterion 7: Echo-only previews of these commands are gone, with no shim.
Verification: Search the code for render_dry_run_result and@dry_run_commandfor these commands and confirm that none remain. - Criterion 8: The new tests start no process and open no socket.
Verification: Run the new tests under the test floor and confirm that no reach is recorded. - Criterion 9: The pull request records the time of the new tests.
Verification: Read the pull request description and confirm that it states the test time. - Criterion 10: uv run devops ci passes.
Verification: Run uv run devops ci and confirm that it exits 0.
Key questions
- Do gh branch-protection sync and gh secrets sync still read GitHub under their current --dry-run?: Replace their current --dry-run with a request plan. The implementation must first check the code and remove any GitHub read. (proposed)
- Does one pull request deliver all nine commands?: Yes. One pull request delivers the whole change. (proposed)
- What test guard proves that a dry run makes no external request?: The test floor patches sockets, DNS, process starts, and clients to fail. [sources: tests/conftest.py]
Open questions
- What fixture holds the commands that still lack a dry-run request plan? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 25, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate adds new functionality to list requests in dry runs for specific commands.This change implements a core rule about dry runs and affects multiple commands.Users benefit from seeing what requests would be made during dry runs, improving predictability and testing.The work involves modifying several commands to add request plans and remove old dry run behavior.Both items add request plans to commands, but the candidate focuses on api, status, branch-protection and secrets while the related item focuses on issues, milestones, labels and runs.dan-petty commentedon Oct 27, 2026
Refine cannot set this item to Ready at 63be7ed until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
feat(gh): preview requests in dry run for api, status, secrets
feat(gh): preview requests in dry run for api, status, secrets
chore(main): release 0.25.0 (#2829)