Skip to content

feat: add dry-run and prune flag for apply command#2912

Open
Yuan325 wants to merge 1 commit intocli-applyfrom
cli-apply-flags
Open

feat: add dry-run and prune flag for apply command#2912
Yuan325 wants to merge 1 commit intocli-applyfrom
cli-apply-flags

Conversation

@Yuan325
Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 commented Mar 31, 2026

New flags that will be introduced in this subcommand:
The --dry-run Flag: Before sending GET/PUT/DELETE requests to the Admin API, allow users to preview the execution plan. This will print exactly which primitives will be created or updated, acting as a safeguard against misconfigurations.
The --prune Flag: Users must explicitly pass --prune to tell the CLI to delete missing resources.

@Yuan325 Yuan325 requested a review from a team as a code owner March 31, 2026 19:11
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces --dry-run and --prune flags to the apply command, enabling users to simulate updates and remove resources not defined in the provided YAML configurations. The code review identified a significant logic error where pruning is executed within the per-file processing loop, which would cause resources defined in subsequent files to be prematurely deleted. Additionally, the logging for the apply sequence was moved incorrectly and now misleadingly reports the character length of the file path instead of the file count. Finally, the new test for resource tracking is noted as flaky because it relies on reflect.DeepEqual for a slice generated from non-deterministic map iteration.

@Yuan325 Yuan325 force-pushed the cli-apply-flags branch 2 times, most recently from ba50564 to 1d17605 Compare March 31, 2026 19:55
@Yuan325
Copy link
Copy Markdown
Contributor Author

Yuan325 commented Mar 31, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds dry-run and prune capabilities to the apply command, enabling simulated updates and the removal of resources not defined in the configuration. Key changes include a GetRemaining method for identifying orphaned resources and a deletePrimitive function for deletions. The test suite was updated to cover these new features. Feedback addresses a flaky test due to non-deterministic map iteration, suggests lowercasing resource types for consistency, and identifies redundant code and stale TODOs for removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants