Skip to content

wire generated CLI commands into main.rs#652

Closed
MintsInc wants to merge 2 commits into
mainfrom
ulysse.mavrocordatos/AAWF-1384/wire-generated-cli
Closed

wire generated CLI commands into main.rs#652
MintsInc wants to merge 2 commits into
mainfrom
ulysse.mavrocordatos/AAWF-1384/wire-generated-cli

Conversation

@MintsInc

@MintsInc MintsInc commented Jul 17, 2026

Copy link
Copy Markdown
Member

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 downtime is 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

  • cargo build and cargo clippy --all-targets -- -D warnings pass.
  • cargo test passes, including the generated tier-1 smoke test in downtime.rs (it exercises downtime::get directly, not through clap parsing, so it doesn't hit the collision).
  • cargo fmt --check fails, but only inside the generated src/downtime.rs file itself (two multi-line #[arg(long)] formatting diffs) — not touched here since it's marked "DO NOT EDIT" and is upstream's generated output.
  • Manually confirmed the collision: pup --no-agent --help panics with "Command pup: command name downtime is duplicated". This PR should not merge until that's resolved.

dd-octo-sts Bot and others added 2 commits July 17, 2026 14:17
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.
@datadog-prod-us1-5

This comment has been minimized.

@MintsInc
MintsInc changed the base branch from main to datadog-api-spec/generated/6183 July 20, 2026 07:45
@MintsInc
MintsInc changed the base branch from datadog-api-spec/generated/6183 to main July 20, 2026 07:46
@MintsInc

Copy link
Copy Markdown
Member Author

Superseded — reworked to avoid pulling in #651's commit. See replacement PR.

@MintsInc MintsInc closed this Jul 20, 2026
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.

1 participant