Skip to content

refactor(cli): entry.main sets a dry-run state that is set again - #4286

Merged
dan-petty merged 1 commit into
mainfrom
refactor/3910-entry-main-sets-a-dry-run
Nov 9, 2026
Merged

dan-petty merged 1 commit into
mainfrom
refactor/3910-entry-main-sets-a-dry-run

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Issue #3910 fixes a defect found while migrating root module tests in #3901 (item 3 of #1333). entry.main calls set_dry_run(True) when the argument vector contains --dry-run. The root callback main in src/devops_cli/main.py sets the dry-run state again before a command runs. The call in entry.main sets _ACTIVATED_HERE = True. This causes dry_run_requested_by_environment() to return False. When an exported DEVOPS_CLI_DRY_RUN variable meets a command that has its own --dry-run flag, the root callback clears the exported variable. This drops the dry-run request that the caller exported. Runs that stop before the root callback do not read is_dry_run(). Telemetry export reads in_dry_run_invocation(), which mark_dry_run_invocation already sets.

Closes #3910

Change: openspec/changes/archive/2026-11-09-3910-entry-main-sets-a-dry-run/

Closes #3910

The entry point dispatcher called set_dry_run(True) when --dry-run was
present in argv, which set _ACTIVATED_HERE = True. This caused
dry_run_requested_by_environment() in main.py to evaluate to False and
clear an exported DEVOPS_CLI_DRY_RUN when running a command with its own
--dry-run flag.

Removing set_dry_run(True) and its import from entry.py ensures the
canonical dry-run state is managed solely by the root callback while
preserving the dry-run invocation mark for exit telemetry.

Change: openspec/changes/archive/2026-11-09-3910-entry-main-sets-a-dry-run/
@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior scope/cli Core CLI framework, Typer subcommands, options, and tables labels Nov 9, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Check results

Head commit: ba6c235e19a0ea0aa616851ea7b32e0fab86cca3

Check Conclusion Link
Tests & Coverage success run
devops-cli success run
zizmor success run
trivy-config success run
CodeQL success run
Plan Check skipped run
Fail-to-Pass Check skipped run
Dependency Freshness skipped run
Test Job Duration skipped run
Third-Party Image Scan success run
Tests & Coverage (shard 2 of 4) success run
Tests & Coverage (shard 1 of 4) success run
Service Image success run
Runner Image success run
Image Pins success run
DevContainer Image success run
Static Analysis success run
Docs Site Build success run
Tests & Coverage (shard 4 of 4) success run
MCP Server Image success run
Tests & Coverage (shard 3 of 4) success run
Analyze (actions) success run
Rule Pack Tests success run
Changed-Test Independence success run
Analyze (python) success run
Semantic PR title success run

Skipped check: Plan Check
Skipped check: Fail-to-Pass Check
Skipped check: Dependency Freshness
Skipped check: Test Job Duration

Implemented by Agent pair-programming session.

@dan-petty
dan-petty marked this pull request as ready for review November 9, 2026 23:20
@dan-petty
dan-petty merged commit f0d3eaa into main Nov 9, 2026
26 checks passed
@dan-petty
dan-petty deleted the refactor/3910-entry-main-sets-a-dry-run branch November 9, 2026 23:38
dan-petty pushed a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.103.1](v0.103.0...v0.103.1)
(2026-11-09)


### Bug Fixes

* **roadmap:** keep the trace facts of a plan in its record
([#4285](#4285))
([cb2287e](cb2287e))


### Code Refactoring

* **ai:** remove unreachable partial status of harness
([#4287](#4287))
([a4ea0c2](a4ea0c2))
* **cli:** entry.main sets a dry-run state that is set again
([#4286](#4286))
([f0d3eaa](f0d3eaa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/cli Core CLI framework, Typer subcommands, options, and tables type/refactor Type refactor: a new structure, same behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(cli): entry.main sets a dry-run state that is set again

1 participant