feat: add dry-run and prune flag for apply command#2912
feat: add dry-run and prune flag for apply command#2912
Conversation
There was a problem hiding this comment.
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.
ba50564 to
1d17605
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
1d17605 to
bdddf34
Compare
New flags that will be introduced in this subcommand:
The
--dry-runFlag: 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
--pruneFlag: Users must explicitly pass --prune to tell the CLI to delete missing resources.