wire generated CLI commands into main.rs#652
Closed
MintsInc wants to merge 2 commits into
Closed
Conversation
PR #651 added src/generated.rs and src/downtime.rs (openapi-transformer's first end-to-end run) but nothing referenced them, so they were dead code: not compiled, not linted, not reachable by any command. Add mod generated, flatten GeneratedCommand into the Commands enum so generated subcommands appear as top-level peers (pup downtime get ..., not pup generated downtime get ...), and route the new arm through main_inner() following the existing per-domain pattern. Known blocker, not resolved here: pup already hand-writes a top-level downtime command (list/get/create/cancel). The generated GeneratedCommand::Downtime collides with it - clap's debug assertion panics at runtime ("command name `downtime` is duplicated") on any invocation that builds the full Command tree (e.g. --no-agent --help). cargo build/test pass because neither constructs that tree. This needs a product decision (retire/merge the hand-written downtime command, or pick a different pilot operation upstream in datadog-api-spec) before this can actually ship.
This comment has been minimized.
This comment has been minimized.
Member
Author
|
Superseded — reworked to avoid pulling in #651's commit. See replacement PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
PR #651 (#651) is openapi-transformer's first end-to-end run generating pup CLI command modules from the OpenAPI spec (src/generated.rs, src/downtime.rs). Nothing in main.rs referenced either file, so they were dead code — not compiled, not linted, not reachable by any command. This PR wires them in.
Note: this branch was cut from #651's branch, so it carries #651's commit plus the wiring change. Intent is for this PR to merge first (landing both the generated files and the wiring together); #651 should then be closed or rebased as a no-op.
Changes
Added mod generated alongside the other top-level module declarations, and flattened GeneratedCommand into the Commands enum with #[command(flatten)] rather than nesting it under a pup generated subcommand — this keeps the generated surface as top-level peers (pup downtime get ..., not pup generated downtime get ...), matching how every other domain is exposed today. generated.rs is designed as the stable, one-time integration point: future openapi-transformer regenerations only add variants inside that file and never need to touch main.rs again.
Known blocker, not resolved here: pup already hand-writes a top-level downtime command (list/get/create/cancel). The generated GeneratedCommand::Downtime collides with it on the subcommand name — clap's debug assertion panics at runtime ("command name
downtimeis duplicated") on any invocation that builds the full Command tree (e.g. pup --no-agent --help). This is a product decision — retire/merge the hand-written downtime command, or pick a different pilot operation upstream in datadog-api-spec — not something resolved unilaterally in this PR.Tests
downtimeis duplicated". This PR should not merge until that's resolved.