Skip to content

feat(config): config, workspace, openspec and docs commands list their requests in a dry run and make none #2255

Closed

Description

@dan-petty

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 22 config, workspace, openspec and docs commands that do not obey it:

  • 1 commands make an external request, or possibly make one, and have no request plan.
  • 4 commands change local state, make no external request and have no --dry-run.
  • 17 commands make no external request and need only the no-external-request class.

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.

A command that makes no external request prints the generic Would run delegated command line under devops --dry-run and does not run, although running it is safe. Some of these commands have an echo-only --dry-run that prints only their arguments.

Proposed Solution & Architectural Design

For each command in the table:

  • Request plan: add --dry-run if 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 ordered PlannedRequest items (argv, stdin and env with <placeholders>, plus condition and repeat). Build each PlannedRequest from the same argument builder that the real run uses, so that the plan cannot drift from the run. Print it with render_request_plan. Give the command the request-plan class.
  • Local preview: add --dry-run. The preview prints the change and writes nothing. Give the command the no-external-request class.
  • Mark only: give the command the no-external-request class. devops --dry-run <command> then runs it normally.
  • Remove an echo-only preview (render_dry_run_result or @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:

  • feat(cli): commands with no dry-run preview: read-only ones run, mutators gain one #886 names two criteria here: devops --dry-run config show prints the configuration, and devops --dry-run config set ai.provider ollama prints a preview and writes nothing (test: save_settings patched to fail).
  • config init reads the GitHub user, so it gets a request plan.
  • workspace add, workspace remove and workspace generate change the workspace file; config set changes the config file. Each gets a --dry-run preview.
  • openspec and docs have 3 commands each, so they join this group.
  • 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
config audit-keys yes (echo only) no mark only -
config audit-stream no no mark only -
config auth-headless no no mark only -
config env no no mark only -
config env-vars no no mark only -
config get no no mark only -
config init no yes request plan gh @ github.rate_limiter:run_gh:1774
config output no no mark only -
config set no no local preview -
config show no no mark only -
config unset yes (echo only) no mark only -
docs check no no mark only -
docs generate yes (echo only) no mark only -
docs sync-readme yes (echo only) no mark only -
openspec archive yes (echo only) no mark only manual: pinned local openspec binary
openspec check no no mark only manual: pinned local openspec binary (config/commands.py:build_openspec_cmd)
openspec regenerate yes (echo only) no mark only manual: pinned local openspec binary
workspace add no no local preview -
workspace clean yes (echo only) no mark only -
workspace generate no no local preview -
workspace open no no mark only manual: starts the local VS Code CLI
workspace remove no no local preview -

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-run and devops --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 json or --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).
  • For each local-preview command, --dry-run prints the change and writes nothing. Verified by tests with the writer patched to fail.
  • For each mark-only command, devops --dry-run <command> runs the command normally. Verified by tests with the process runner and the HTTP clients patched to fail.
  • 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 ci passes.

Source: #886

Proposed design

Problem statement

Twenty-two config, workspace, openspec, and docs commands do not follow the dry-run rule. A dry run can start an external request, change local state, or print false compliance text. This item gives each command a dry run that shows the real requests or the local change. It removes echo-only previews and clears the gap fixture.

Acceptance criteria

  • Criterion 1: Each command in the table is removed from tests/fixtures/dry_run_gaps.json.
    Verification: Run uv run pytest -q tests/test_roadmap_dry_runs.py and confirm the ratchet test passes.
  • Criterion 2: devops config init --dry-run and devops --dry-run config init make no external request and print the ordered requests.
    Verification: Run tests with the process runner and HTTP clients patched to fail. Confirm the output shows the planned gh command.
  • Criterion 3: devops config init --dry-run --json returns the real result type marked as a dry run, with the planned requests.
    Verification: Run the test and confirm the result has dry_run=True and a requests list.
  • Criterion 4: The plan of config init holds the requests that the real run makes, in the same order.
    Verification: Run a test that records each call with a fake runner and compares the calls with the plan.
  • Criterion 5: devops config set --dry-run prints the change and writes nothing.
    Verification: Run the test with save_settings patched to fail. Confirm the preview is printed.
  • Criterion 6: devops workspace add --dry-run, workspace remove --dry-run, and workspace generate --dry-run print the change and write nothing.
    Verification: Run tests with the writer patched to fail. Confirm the preview is printed.
  • Criterion 7: devops --dry-run config show prints the configuration.
    Verification: Run uv run devops --dry-run config show and confirm the configuration is printed.
  • Criterion 8: Each mark-only command runs normally under devops --dry-run.
    Verification: Run tests with the process runner and HTTP clients patched to fail. Confirm the command executes.
  • Criterion 9: Echo-only previews of these commands are gone, with no shim.
    Verification: Search the command modules for render_dry_run_result and @dry_run_command. Confirm no hit for these commands.
  • Criterion 10: The new tests start no process and open no socket.
    Verification: Run the new tests and confirm the session guard records no edge reach.
  • Criterion 11: The pull request records the time of the new tests.
    Verification: Read the pull request description and confirm the time is present.
  • Criterion 12: uv run devops ci passes.
    Verification: Run uv run devops ci and confirm the exit code is 0.
  • Criterion 13: The test test_config_audit_keys_dry_run in tests/test_config_audit_keys.py is updated for the removal of the echo-only preview.
    Verification: Run uv run pytest -q tests/test_config_audit_keys.py and confirm it passes.

Key questions

  • Which commands need a local preview?: config set, workspace add, workspace remove, and workspace generate. (proposed)
  • What class does a request-plan command get?: The command gets the request-plan class. (proposed)
  • What class does a local-preview command get?: The command gets the no-external-request class. (proposed)
  • What does a mark-only command do under devops --dry-run?: It runs the command normally. (proposed)
  • Do the echo-only previews stay?: No. Remove them with no shim when the command gets its new dry run. (proposed)
  • Does the repository already have the dry-run request tools?: Yes. PlannedRequest and render_request_plan exist. [sources: tests/test_roadmap_dry_runs.py, CHANGELOG.md:1337]
  • What test pattern proves a plan matches the real run?: Record each call with a fake runner or client and compare the calls with the plan. [sources: tests/test_roadmap_dry_runs.py]
  • Do the test guards block external network and process starts?: Yes. The session fixtures install network and process guards. [sources: tests/conftest.py]
  • What does this item depend on?: It depends on sub-issue 00 of feat(cli): commands with no dry-run preview: read-only ones run, mutators gain one #886, the dry-run class ratchet test. (proposed)
  • Does this item fit one pull request?: Yes. It changes one command group and uses existing tools. (proposed)
  • What does the config audit-keys echo-only dry run do that is wrong?: It prints fixed values zero_plaintext_compliance: VERIFIED and status: COMPLIANT_DRY_RUN without scanning. A CI step that adds --dry-run passes when a leak is present. The work of this issue removes this preview. [sources: tests/test_config_audit_keys.py]

Open questions

  • Which command needs a request plan? (missing verified source)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 25, 2026
  2. dan-petty commented on Oct 25, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/feature. The candidate proposes new functionality for dry-run behavior in multiple commands.
    • Priority: P1-High. This change affects core devops functionality and follows the project's established dry-run rule.
    • Value: High. Improves usability and predictability of devops commands during dry runs for all users.
    • Effort: High. Requires changes to many commands across different areas with complex request planning logic.
    • Related: feat(review): review commands list their requests in a dry run and make none #2248, which asks for a different change. Both items work on dry-run functionality but target different command groups: config/workspace/openspec/docs vs review commands.
  3. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    Refine cannot set this item to Ready at 69636b6 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.

    • Which command needs a request plan? (missing verified source)
  4. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    More evidence for the config audit-keys row. The review of PR #2401 found it.

    The echo-only dry run of devops config audit-keys does more than echo the arguments. It prints the fixed values zero_plaintext_compliance: VERIFIED and status: COMPLIANT_DRY_RUN, and it exits 0. It does not scan a file or read the keyring. Thus a dry run claims compliance that it did not check, also when a config file holds a plaintext secret. Its keys_checked list names 3 keys, but the audit checks every key of KEYRING_KEYS.

    Reproduction on main at d739a47: a config file named by DEVOPS_CLI_CONFIG holds grafana.token: <fake value>. devops config audit-keys --json exits 1 and reports the leak. devops config audit-keys --dry-run exits 0 and reports VERIFIED. A CI step or a hook that adds --dry-run passes when a leak is present.

    The work of this issue ("mark only", and the removal of the echo-only preview) removes this false claim. Thus no separate issue is filed. The test test_config_audit_keys_dry_run in tests/test_config_audit_keys.py pins the echo-only preview today, so that work also changes it.

  5. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Refine cannot set this item to Ready at 19412fa 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.

    • Which command needs a request plan? (missing verified source)
  6. added
    priority/p1-high
    status/new
    effort/high
    value/high
    scope/config
    status/in-progress
    and removed
    status/new
    on Oct 28, 2026
  7. added a commit that references this issue on Nov 1, 2026
    b0e13c7
  8. added
    status/in-review
    and removed
    status/in-progress
    on Nov 1, 2026
  9. removed
    status/in-review
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p1-highscope/configsource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions