gate hand-written downtime list for generated takeover - #886
Merged
Merged
Conversation
MintsInc
marked this pull request as ready for review
October 2, 2026 09:49
Contributor
There was a problem hiding this comment.
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.
🤖 Bits Code Review · Commit 4ae3689 · @DataDog review to ask questions
nogates
approved these changes
Oct 2, 2026
platinummonkey
approved these changes
Oct 2, 2026
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
pup downtimeis moving from hand-written to generated-from-spec commands one operation at a time.get,createandcancelare already generated;listis the last hand-written verb. Once the generatedlistlands, the hand-written one must compile out, otherwise clap panics withCommand downtime: command name 'list' is duplicated.Changes
listvariant, dispatch arm, handler, itsListDowntimesOptionalParamsimport and its test behindcfg(not(generated_op = "downtime.list")), the same pattern used forget/create/cancel. This is a no-op until the generated module includeslist.src/commands/downtime.rsis compiled and its shared imports would failclippy -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. Takinglistback 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 generatedlistlands.cli_surface_matches_reviewed_projection_for_sample_commandnow switches thelistexpectation oncfg!(generated_op = "downtime.list"). The post-migration shape (--current-only,--include,--page-limit,--page-offset) is taken fromopenapi-transformer pup describe-surface.downtimeis already in place, so no change is needed there.Tests
cargo clippy --all-targets -- -D warningsandcargo fmt --checkpass.downtime.listtosrc/generated/surface.txtand replacedsrc/generated/downtime.rswith the module rendered byopenapi-transformer generate client --generator pup. Without this change, tests that build the CLI panic on the duplicatelist. With it, clippy passes, the downtime and surface-projection tests pass, andpup downtime --helplistscancel, create, get, listin order.downtime listwith no flags is unchanged: same singleListDowntimescall with default params, same formatter. Agent-mode output gainsmetadata.count/command.