Skip to content

scaffold generated CLI integration point in main.rs#656

Merged
MintsInc merged 1 commit into
mainfrom
ulysse.mavrocordatos/AAWF-1384/wire-generated-cli-v2
Jul 20, 2026
Merged

scaffold generated CLI integration point in main.rs#656
MintsInc merged 1 commit into
mainfrom
ulysse.mavrocordatos/AAWF-1384/wire-generated-cli-v2

Conversation

@MintsInc

Copy link
Copy Markdown
Member

Context

openapi-transformer will regenerate pup CLI command modules from the OpenAPI spec into src/generated.rs — #651 is the pilot run for this pipeline. This PR lands the main.rs wiring ahead of that so the integration point is stable: every future openapi-transformer regeneration only adds variants to GeneratedCommand (and sibling modules) inside generated.rs, and main.rs never needs to change again.

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 — generated subcommands will appear as top-level peers (e.g. pup downtime get ...), matching how every other domain is exposed today. Routed the new arm through main_inner() following the existing per-domain pattern (cfg.validate_auth() then dispatch).

src/generated.rs here is a placeholder with an empty GeneratedCommand enum, not #651's actual generated output. #651 introduces a generated Downtime variant that collides on the subcommand name with pup's existing hand-written top-level downtime command (list/get/create/cancel): clap panics at runtime with "command name downtime is duplicated" on any invocation that builds the full Command tree. That collision needs a product decision — retire/merge the hand-written downtime command, or pick a different pilot operation upstream in datadog-api-spec — before any generated variants can land. This PR only establishes the scaffold; once that decision is made, #651 becomes a pure additive diff to generated.rs and its sibling modules, with no main.rs changes required.

Tests

  • cargo build, cargo clippy --all-targets -- -D warnings, and cargo fmt --check all pass.
  • cargo test passes except 4 pre-existing failures unrelated to this change (DNS lookup failures against unused.local in commands::cases, commands::dbm, commands::monitors, commands::traces tests) — confirmed identical on a clean main checkout.
  • Manually confirmed pup --no-agent --help renders without panicking (no subcommand collision, since the placeholder enum has zero variants).

openapi-transformer will regenerate pup CLI command modules from the
OpenAPI spec into src/generated.rs (see #651, the pilot run
for this pipeline). Land the wiring ahead of that so main.rs never needs
touching again on future regenerations: mod generated, flatten
GeneratedCommand into the Commands enum so generated subcommands appear
as top-level peers, and route the arm through main_inner() following the
existing per-domain pattern.

src/generated.rs here is a placeholder with an empty GeneratedCommand
enum, not #651's actual generated output - #651 hand-writes a top-level
downtime command (list/get/create/cancel) that collides on the
subcommand name with the generated Downtime variant it introduces
(clap panics at runtime: "command name `downtime` is duplicated"). That
collision needs a product decision - retire/merge the hand-written
downtime command, or pick a different pilot operation upstream - before
any generated variants land. This PR only establishes the scaffold; #651
becomes a pure additive diff to generated.rs (and new sibling modules)
once that decision is made.
@MintsInc
MintsInc marked this pull request as ready for review July 20, 2026 08:07
@MintsInc
MintsInc requested a review from a team as a code owner July 20, 2026 08:07
@MintsInc
MintsInc merged commit 92abde1 into main Jul 20, 2026
6 checks passed
@MintsInc
MintsInc deleted the ulysse.mavrocordatos/AAWF-1384/wire-generated-cli-v2 branch July 20, 2026 08:41
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