Repository navigation
Description
Problem Statement
Paths are under src/devops_cli/. Evidence re-checked at 8271385 (release/v0.2.25, 2026-10-02); commands/ci.py and core/process.py are unchanged since decb600. At the branch tip 9c879ae the only cited files that changed are lang/en/help.py, lang/en/messages.py and config/constants.py; help.py:25 and constants.py:183 still hold, and the dry-run message template moved from messages.py:537 to :545, cited below at its 9c879ae line. The issue's original line numbers (from ef21785, which is not an ancestor of this branch) have drifted by three and are corrected below.
The commands. 14 devops ci commands declare --dry-run. When it is set, each one only calls set_dry_run(True) and then carries on: ci itself (commands/ci.py:710-711), test (:820), coverage (:853), lint (:887), format (:911), typecheck (:931), audit (:957), security (:977), actionlint (:997), docs (:1017), uv-check (:1036), lockfile (:1052), outdated (:1068) and run (:1138). A 15th, maintain (:1088-1097), is the only one that returns a dry-run preview (render_dry_run_result) without running anything; it stays as it is.
What happens under the flag.
- The commands run their tools through
_run(ci.py:172-185) or the async path (_execute_check_async,ci.py:259-298;_run_all_checks_async,:312-485). Both runners prepend--preview-features malware-check,check-commandtouvargv and call the core runner unconditionally (_get("run_subprocess")at:181,_get("run_subprocess_async")at:275). - Under dry-run,
run_subprocessandrun_subprocess_asyncprintWould run commandand then run the command anyway (core/process.py:235-236, thensubprocess.runat:266;:376-377, thenasyncio.create_subprocess_execat:409). - With
subprocess.runrecorded instead of run,devops ci lint --dry-runreacheduv --preview-features malware-check,check-command run ruff check . --fixand exited 0. 12cisubcommands reached their tool this way, andci runreached the async runner. - The results:
devops lint --dry-runapplies ruff fixes (ci.py:892-896);devops format --dry-runreformats files (ci.py:916-921);devops ci run --dry-runruns the whole gate with fixes on (ci.py:1141), includingruff format .,ruff check --fix .anddevops docs generate --sync-readme(ci.py:341-365);devops ci test --dry-runruns the test suite (ci.py:836-837);- the aggregate gate also deletes
.coverage*andcoverage.xmlin the checked tree and its.data/(_clean_coverage_artifacts,ci.py:222-242, called from_run_all_checks_asyncat:316,:373and:473; its only guard isPYTEST_CURRENT_TEST,:224).
- Dry-run bypasses the check cache (
ci.py:623) and never saves one (:666, covered bytests/test_ci.py:751). - The option's own help promises the opposite:
HELP.options.dry_runis "Preview execution plan without mutating external state." (lang/en/help.py:25). - Nothing else in these commands starts a process:
_get_project_rootresolves the worktree from files (core/repo.py:150-171, norun_subprocess),_verify_python_314_environmentreadssys.version_info(ci.py:160), and_try_fast_cached_cireturns before computing a fingerprint under dry-run (:623). So a recorder on the process runner sees exactly the check tools.
Why it matters now. #412 makes devops --dry-run <cmd> forward to the command's own --dry-run. Today devops --dry-run lint only prints a Would run delegated command line from the lazy proxy (core/cli.py:127-134; lint and format are root-level aliases of the ci module, main.py:70-71, config/constants.py:183). After #412 it would reach this defect. #412 is not delivered (docs/agent/tasks/task-412-reachable-dry-run-previews-for-delegated-commands.md is Status: Backlog; no commit mentions #412).
Existing tests codify the defect. tests/test_ci_dry_run.py:42-88 patches devops_cli.commands.ci._run and asserts it is called once under --dry-run. Those tests pass today and would keep passing after any fix placed in _run, because they replace the function that gains the guard; they prove nothing about whether a process starts.
Other commands that declare --dry-run. The other commands that declare --dry-run were run without arguments with the same recorder. 80 of 120 command paths finished. Apart from ci, the only processes started were read-only: git worktree list, git rev-parse, gh api rate_limit and kubectl apply -k . --dry-run=client. The 40 paths that need arguments were not run. They are surveyed by #986; this item keeps the two runner guards and the coverage-cleanup guard (owner decision Q3, 2026-10-02).
Proposed Solution
- Under dry-run,
_runand_execute_check_asyncprint the command they would run withprint_dry_run_command(output/console.py:728-752, which already renders[dry-run] Would run command: ...fromlang/en/messages.py:545, masks secrets and showscwd) and return a pass (Truefrom_run; aCheckResultwithpassed=True, the preview'sduration_secondsand empty output from_execute_check_async) without calling the runner. Theuv --preview-featuresinsertion stays, so the printed command is the one that would run. _run_all_checks_asyncskips its three_clean_coverage_artifacts()calls under dry-run: nothing ran, so there is nothing to clean, and the option's contract (help.py:25) rules out deleting files.devops ci --dry-runanddevops ci run --dry-runtherefore list every check's command (the three fix steps when fixes are on, then the 11 check rows) and exit 0. The cache stays bypassed (ci.py:623) and nothing is saved (:666); no change there.- The 14 commands keep their
--dry-runoption andset_dry_run(True)call; the fix is below them, in the two runners insideci.py.maintainis unchanged. tests/test_ci_dry_run.pyis rewritten to record the process runner (subprocess.runmonkeypatched astests/test_ci.py:28-36does, which also covers the async path becauserun_subprocess_asyncfalls back to the sync runner in a thread wheneversubprocess.runis patched,core/process.py:361-375; ordevops_cli.commands.ci.run_subprocess/devops_cli.core.process.run_subprocess_asyncastests/test_ci.py:312and:963do) instead of_run, so each test proves no process is started.- The task file keeps the recorded 80-path result (the four read-only processes above) and names chore(cli): every argument-taking
--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 as the candidate that surveys the 40 argument-taking paths; no survey work happens in this pull request.
Scope
src/devops_cli/commands/ci.py:_run,_execute_check_async,_run_all_checks_async(coverage cleanup under dry-run).tests/test_ci_dry_run.py: rewritten; new tests forci --dry-run,ci run --dry-run, the coverage-cleanup guard and the no-flag control.docs/agent/tasks/task-885-ci-checks-run-under-dry-run.md(with the 80-path recorder result and the reference to chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986) andchangelog.d/885.md.- No change to
core/process.py,dry_run/,main.pyorcore/cli.py. No new dependency.
Key Questions
All answered; nothing is open.
- Should the runner refuse to execute under dry-run instead? No. Many callers rely on read-only processes under dry-run, such as
git rev-parseinreview branch(and_QUIET_SUBPROCESS_ARGS,core/process.py:23-25, exists for exactly those). Deciding intent per caller is refactor(cli): one process runner owns execution, process groups and dry-run #775. This fix stays inci.py. - Should dry-run still bypass the check cache (
ci.py:623)? It no longer matters. Nothing runs, so nothing is cached; the existing bypass and the no-save rule (:666, covered bytests/test_ci.py:751) stay as they are. - Is this a critical fix? No. The damage is local file changes under version control, and the global form stays safe until feat(cli): reachable
--dry-runpreviews for delegated commands #412 ships. - Where does the dry-run branch live: in the two
ci.pyrunners, or in each of the 14 commands? In the two runners (_run,_execute_check_async). One branch covers all 14 commands and every future check row; per-command branches would be 14 copies that refactor(ci): github ci runs the gate throughdevops cifrom one check table #843's check table is about to reorganize anyway. - Does the aggregate gate still delete coverage artifacts under dry-run? No. This is settled by the option's documented contract, "Preview execution plan without mutating external state." (
help.py:25):_clean_coverage_artifactsunlinks files in the checked tree, so a preview that keeps calling it breaks that contract. The guard is oneis_dry_run()branch around the three calls in_run_all_checks_async. - Does the survey of the 40 argument-taking
--dry-runcommands stay in this item? No. It moves out as chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 (owner decision Q3, 2026-10-02: "Move it out as its own candidate; this PR's task file keeps the recorded 80-path result and names the candidate filed"). The survey changes no code here and cannot be verified by the pull request's checks (docs/agent/tasks/README.md, rule 3: verification is the PR's passing checks); its only output is zero or more candidates for other command modules, which chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 files. This item keeps the two runner guards and the coverage-cleanup guard, and its task file records the 80-path result and names chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986. The code change is identical either way; effort stays Medium.
Acceptance Criteria
- With
subprocess.runreplaced by a recorder (as intests/test_ci.py:28-36),devops ci lint --dry-run,devops ci format --dry-run,devops ci test --dry-run,devops ci run --dry-runanddevops ci --dry-runeach exit 0, the recorder has zero calls, and the output containsWould run commandwith every argv the command would run (ruff check . --fix,ruff format .,pytest, and for the two aggregate forms the three fix steps plus all 11 check rows ofci.py:341-470). Test:tests/test_ci_dry_run.py, assertions as structural tuples; each test fails at8271385(today the recorder is called once per check). -
devops ci --dry-runanddevops ci run --dry-rununlink nothing: withPYTEST_CURRENT_TESTremoved from the environment (monkeypatch.delenv, because_clean_coverage_artifactsreturns early when it is set,ci.py:224),_get_project_rootpatched to atmp_pathtree (astests/test_ci.py:385) holding.coverage.xandcoverage.xml, and the recorder in place, both files still exist afterwards. Test:tests/test_ci_dry_run.py; fails at8271385. - Without the flag,
devops ci lintstill calls the runner once withuv --preview-features malware-check,check-command run ruff check . --fix, anddevops ci --no-cachewith the recorder still reaches the runner for every check row. Test:tests/test_ci_dry_run.pycontrol case;tests/test_ci.py:84(test_ci_lint_command) and:879(test_gate_checks_nested_worktree_not_main_checkout) keep passing. -
tests/test_ci_dry_run.pyno longer patchesdevops_cli.commands.ci._run:rg -n 'commands\.ci\._run"' tests/test_ci_dry_run.pyprints nothing. -
devops ci maintain --dry-runoutput is unchanged. Test:tests/test_ci_maintain.py::test_ci_maintain_dry_runkeeps passing. - The new and rewritten tests take at most 1 s in total for setup, call and teardown on one worker, not counting the session fixture setup that the first test in any run pays (5 s at
8271385), measured withuv run pytest -n 0 --durations=0 tests/test_ci_dry_run.py(-p no:xdisterrors on the-n logicalinpyproject.toml:105) and recorded in the task file. - The task file records the recorder results for the 80 argument-free
--dry-runcommand paths already surveyed (the four read-only processes listed above) and names chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 as the candidate filed for the 40 argument-taking paths. Observable: the task file's survey section lists the four processes and contains#986; it carries no table of the 40 paths. -
changelog.d/885.mdexists;CHANGELOG.mdanddocs/ROADMAP.mdare untouched (devops pr check-readiness). -
uv run devops cipasses.
Out of Scope
- Making
run_subprocess/run_subprocess_asyncrefuse to run under dry-run, or merging the two runners (refactor(cli): one process runner owns execution, process groups and dry-run #775). - Forwarding the global
devops --dry-runto a command's own--dry-run(feat(cli): reachable--dry-runpreviews for delegated commands #412), which depends on this item. - Any command outside
commands/ci.py; the survey of the 40 argument-taking--dry-runpaths is chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986, and each offender it finds becomes a candidate of its own. - The check table and
--only/--skipselection of refactor(ci): github ci runs the gate throughdevops cifrom one check table #843; the gate cache fingerprint of fix(ci): the gate cache certifies only the tree it checked #838; thedevops ci testselection index of feat(cli):devops ci testselects tests from a coverage index built on demand bydevops ci coverage --build-index#406; the gate's pytest worker setting of fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858. - Structured dry-run JSON (
render_dry_run_result) for the 14 commands; the plainWould run commandline is the deliverable.
Dependencies
- Depends on: none.
- Ordered after:
- refactor(ci): github ci runs the gate through
devops cifrom one check table #843 (v0.2.26): rewrites_run_all_checks_async(ci.py:312-485) and the per-check subcommands into one check table and changes_execute_check_async's timeout handling; this item's guards go into whatever runner functions refactor(ci): github ci runs the gate throughdevops cifrom one check table #843 leaves (the_run/_execute_check_asyncnames are re-checked at branch time). - feat(cli):
devops ci testselects tests from a coverage index built on demand bydevops ci coverage --build-index#406 (v0.2.26): changesdevops ci testand adds--build-indextodevops ci coverage, two of the 14 commands this item's tests invoke; the branch is cut after it.
- refactor(ci): github ci runs the gate through
- Ordered before (same release, same file, sequence
#885 -> #838 -> #858oncommands/ci.py, largest change first so the smallest rebases last):- fix(ci): the gate cache certifies only the tree it checked #838 (v0.2.27): edits
_try_fast_cached_ci,_try_save_ci_cacheandFileOrSubcommandGroupinci.py; different functions, merge order only. - fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858 (v0.2.27): changes the gate's pytest worker argv (
ci.py:374-376) inside_run_all_checks_async, the function whose_clean_coverage_artifactscalls this item guards; merge order only.
- fix(ci): the gate cache certifies only the tree it checked #838 (v0.2.27): edits
- Related:
- chore(cli): every argument-taking
--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 (backlog, no milestone): the survey of the 40 argument-taking--dry-runpaths, named by this item's task file; no ordering between the two, since the survey changes no code and excludescommands/ci.py. - feat(cli): reachable
--dry-runpreviews for delegated commands #412: depends on this item; after it,devops --dry-run <cmd>reaches the command's own flag (its task file isStatus: Backlog). - refactor(cli): one process runner owns execution, process groups and dry-run #775: the runner-level dry-run decision (
run_subprocess/run_subprocess_async).
- chore(cli): every argument-taking
Readiness check (2026-10-04)
Re-checked at b61e5a0 (release/v0.2.26). #843 and #406 are merged, so this item waits only for v0.2.26 to merge. The two guarded runners survive #843, but most cited lines moved, #406 added a writing path, and the owner's dry-run rule of 2026-10-04 changes what a dry run returns.
Corrected locations (under src/devops_cli/):
commands/ci.py:_runis at:189-203:--preview-featuresinsertion at:198-199, runner call at:200._execute_check_asyncis at:277-355, with its runner call at:308._clean_coverage_artifactsis at:240-261, with itsPYTEST_CURRENT_TESTguard at:242._run_all_checks_async(:695-742) calls it at:703,:731and:741.- Fix steps run in
_run_pre_fixes_async(:622-665), from each row'sfix_cmd. - Dry-run cache bypass is at
:884, no-save at:930. maintainis at:1564-1611(render_dry_run_resultat:1577),runat:1614-1633.
- The "11 check rows of
ci.py:341-470" are now the 12 rows ofget_check_specs()(ci.py:383-481, which addsdevcontainer), plus the virtualcoveragerow from_assemble_ci_results(:668-692). Tests take the expected rows fromget_check_specs(), not from a fixed count. - Command spellings: the lint fix is
uv run ruff check --fix .and the format fix isuv run ruff format .. The no-flag control therefore expectsuv --preview-features malware-check,check-command run ruff check --fix .. core/process.py:_QUIET_SUBPROCESS_ARGSis at:38.run_subprocessprints at:360, then runs at:390.run_subprocess_asyncprints at:500, then runs at:533; it falls back to the sync runner whensubprocess.runis patched (:485-486).
- Other moved lines:
lang/en/messages.py:631(would_run_command),lang/en/help.py:28(HELP.options.dry_run),pyproject.toml:122(addopts). - Tests:
- In
tests/test_ci.py: recorder pattern:37-44,test_ci_lint_command:93,test_gate_checks_nested_worktree_not_main_checkout:1026,test_a_dry_run_records_nothing:898,_get_project_rootpatch:396,run_subprocess_asyncpatch:1110. tests/test_ci_dry_run.pypatches_runat:44,:56,:67and:81.- "Fails at
8271385" now reads "fails atb61e5a0".
- In
New since the body: coverage --build-index (#406). _handle_coverage_index_build (ci.py:1291-1333) runs the suite through _run (:1306), then writes the index (save_index, :1328). With only the _run guard, devops ci coverage --build-index --dry-run would write an index from whatever .coverage is on disk.
devops ci test <paths> --dry-run still reads the index and runs local git hash reads for test selection (_resolve_test_targets, ci.py:1177-1226; ci/cache.py:251-272). These make no external request, so they may stay. The zero-call criterion applies to the path-free invocations it lists.
Rule alignment. The owner's rule (2026-10-04, recorded in #412 and in #886's amendment, which names ci): a dry run returns its real result type, marked as a dry run, with the ordered requests it would make as PlannedRequests (dry_run/requests.py:16-41, printed by render_request_plan, :49-75). This replaces two passages:
- "return a pass (
True/CheckResultwithpassed=True)" in the Proposed Solution; - "the plain
Would run commandline is the deliverable" in Out of Scope.
This item delivers #886's devops ci --dry-run criterion. Telemetry export is already off under a dry run (telemetry/tracer.py:1226-1229), so nothing is needed there.
Amended acceptance criteria (they replace the first two criteria above where the two differ):
- Under a dry run,
_runand_execute_check_asyncstart no process. Each records aPlannedRequestholding the argv as it would run, including theuv --preview-featuresinsertion.devops ci lint|format|test|coverage --dry-runeach print a one-request plan.devops ci --dry-runanddevops ci run --dry-runprint, in order, the fix steps (when fixes are on) and then every row ofget_check_specs().- Each exits 0 with the
subprocess.runrecorder at zero calls. Test:tests/test_ci_dry_run.py.
- Dry-run
CheckResults carry a dry-run marker (a field, asMigrationPlan.dry_rundoes atroadmap/migrate.py:157) instead ofpassed=Truefor checks that never ran. The gate prints no pass badges or pass summary for them. Under a dry run,_handle_ci_resultsneither saves (:930) nor clears (:936) the cache. -
devops ci coverage --build-index --dry-runplans the index run (--cov-context=testwith envCOVERAGE_CORE=ctrace), hashes nothing and writes no index. Test: with the index path undertmp_path, no file exists afterwards and the recorder has zero calls.
The order #885 -> #838 -> #858 on commands/ci.py stands; #858 still edits the check table and the worker argv. This is still one PR, effort Medium.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 2, 2026
Grooming (2026-10-02): Placed in v0.2.28, one of its slots held for P1 work that surfaced after it was planned. Value High, effort Medium. Ready.
Checked against the code at the release/v0.2.25 tip.
dan-petty commentedon Oct 2, 2026
Moved from v0.2.28 to the top of the backlog on 2026-10-02. #519, a flaky gate test that failed a pre-push
devops cirun today, was raised to P1 (Value High, Effort Low) and took this item's place. #885 was the lowest-ranked item in v0.2.27 and v0.2.28 that no person placed (P1, Value Medium, Effort Medium). It goes into the first of those releases that has a free slot.dan-petty commentedon Oct 2, 2026
Placed in v0.2.27 on 2026-10-02. #846 and #845 moved into v0.2.25 with the review-loop work the owner asked for, which freed two slots. This item ranks highest among the backlog P1 items displaced earlier (P1, Value Medium, Effort Medium; #844 has Effort High).
fix(ci): devops ci checks run for real under the gate (#885) (#1199)
dan-petty-bot commentedon Oct 5, 2026
What changed
#1199, merged into
release/v0.2.27as 85a924b.5 file(s) changed.
How it was verified
Check runs at d187a1d:
Acceptance Criteria of
docs/agent/tasks/task-885-ci-checks-run-under-dry-run.md:_runand_execute_check_asyncstart no process. Each records aPlannedRequestholding the argv as it would run, including theuv --preview-featuresinsertion.devops ci lint|format|test|coverage --dry-runeach print a one-request plan.devops ci --dry-runanddevops ci run --dry-runprint, in order, the fix steps (when fixes are on) and then every row ofget_check_specs().subprocess.runrecorder at zero calls (tests/test_ci_dry_run.py).CheckResults carry a dry-run marker (dry_run=True) instead ofpassed=Truefor checks that never ran. The gate prints no pass badges or pass summary for them. Under a dry run,_handle_ci_resultsneither saves nor clears the cache.devops ci coverage --build-index --dry-runplans the index run (--cov-context=testwith envCOVERAGE_CORE=ctrace), hashes nothing and writes no index. Tested with index path undertmp_path, verifying no file is created and the recorder sees zero calls.devops ci --dry-runanddevops ci run --dry-rununlink nothing: withPYTEST_CURRENT_TESTremoved and_get_project_rootpointed totmp_pathholding.coverage.sampleandcoverage.xml, both files still exist afterwards.devops ci lintcalls the runner once withuv --preview-features malware-check,check-command run ruff check --fix ., anddevops ci --no-cachewith the recorder reaches the runner for every check row.tests/test_ci_dry_run.pycontains zero occurrences of patchingcommands.ci._run.devops ci maintain --dry-runoutput is unchanged (tests/test_ci_maintain.py::test_ci_maintain_dry_runpasses).--dry-runpaths (the four read-only processes) and names chore(cli): every argument-taking--dry-runcommand path is recorded as read-only or mutating, one candidate per offender #986 for the 40 argument-taking paths.changelog.d/885.mdexists;CHANGELOG.mdanddocs/ROADMAP.mdare untouched.uv run devops cipasses on this branch.feat(release): v0.2.27 (#1257)
chore(cli): survey argument-taking --dry-run command paths (#2316)