Skip to content

gate hand-written downtime list for generated takeover - #886

Merged
platinummonkey merged 1 commit into
mainfrom
ulysse.mavrocordatos/gate-downtime-list
Oct 2, 2026
Merged

platinummonkey merged 1 commit into
mainfrom
ulysse.mavrocordatos/gate-downtime-list

Conversation

@MintsInc

@MintsInc MintsInc commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Context

pup downtime is moving from hand-written to generated-from-spec commands one operation at a time. get, create and cancel are already generated; list is the last hand-written verb. Once the generated list lands, the hand-written one must compile out, otherwise clap panics with Command downtime: command name 'list' is duplicated.

Changes

  • Gates the hand-written list variant, dispatch arm, handler, its ListDowntimesOptionalParams import and its test behind cfg(not(generated_op = "downtime.list")), the same pattern used for get/create/cancel. This is a no-op until the generated module includes list.
  • With all four ops generated, nothing in src/commands/downtime.rs is compiled and its shared imports would fail clippy -D warnings. The module declaration is gated on all four ops rather than repeating the gate on each import. This gate only covers the all-generated case. Taking list back out of the generated surface returns to today's state and compiles, but reverting an already-generated op (create, cancel) on its own is not supported and would trip unused-import warnings. That is acceptable because the hand-written module is deleted in a follow-up once the generated list lands.
  • cli_surface_matches_reviewed_projection_for_sample_command now switches the list expectation on cfg!(generated_op = "downtime.list"). The post-migration shape (--current-only, --include, --page-limit, --page-offset) is taken from openapi-transformer pup describe-surface.
  • The help-order sort line for downtime is already in place, so no change is needed there.

Tests

  • cargo clippy --all-targets -- -D warnings and cargo fmt --check pass.
  • Simulated the post-migration state locally: added downtime.list to src/generated/surface.txt and replaced src/generated/downtime.rs with the module rendered by openapi-transformer generate client --generator pup. Without this change, tests that build the CLI panic on the duplicate list. With it, clippy passes, the downtime and surface-projection tests pass, and pup downtime --help lists cancel, create, get, list in order.
  • Non-agent output of downtime list with no flags is unchanged: same single ListDowntimes call with default params, same formatter. Agent-mode output gains metadata.count/command.

@MintsInc
MintsInc marked this pull request as ready for review October 2, 2026 09:49
@MintsInc
MintsInc requested a review from a team as a code owner October 2, 2026 09:49

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

In partial-generation configurations (e.g., only create or cancel remaining hand-written), shared and test-support imports in the downtime module become unused, causing cargo clippy --all-targets -- -D warnings to fail and breaking the advertised per-operation fallback. These imports must be gated on the relevant hand-written operations remaining active.

Open Bits AI session

🤖 Bits Code Review · Commit 4ae3689 · @DataDog review to ask questions

Comment thread src/commands/downtime.rs
@platinummonkey
platinummonkey merged commit b51de6e into main Oct 2, 2026
6 checks passed
@platinummonkey
platinummonkey deleted the ulysse.mavrocordatos/gate-downtime-list branch October 2, 2026 14:19
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.

3 participants