Skip to content

downtime: gate hand-written get/create/cancel handlers - #873

Closed
MintsInc wants to merge 1 commit into
DataDog:mainfrom
MintsInc:ulysse.mavrocordatos/gate-downtime-handlers
Closed

MintsInc wants to merge 1 commit into
DataDog:mainfrom
MintsInc:ulysse.mavrocordatos/gate-downtime-handlers

Conversation

@MintsInc

Copy link
Copy Markdown
Member

Context

The downtime prepare change gated the hand-written get, create and cancel clap variants and dispatch arms behind cfg(not(generated_op = ...)), but not the handler functions in src/commands/downtime.rs that those arms call. Once surface.txt lists downtime.get/create/cancel (as in #872), the dispatch arms compile out, the handlers lose their only callers, and cargo clippy --all-targets -- -D warnings fails with function get/create/cancel is never used.

The same switch-over also breaks cli_surface_matches_reviewed_projection_for_sample_command, which pins the downtime CLI surface: the generated downtime get adds optional --include and --with-run-as flags.

Changes

  • The handlers, the GetDowntimeOptionalParams import and test_downtime_get use the same cfg(not(generated_op = "downtime.<verb>")) as their dispatch arms, rather than #[allow(dead_code)]. Dead hand-written code isn't compiled into the binary after the switch-over, and removing the ops from surface.txt still restores the hand-written verbs. list is not migrated and stays unchanged.
  • The CLI surface test switches only its get expectation on cfg!(generated_op = "downtime.get"), and still checks the real downtime command in both states. A test built on a synthetic command would stop breaking on migrations, but it would also stop catching surface changes introduced by generated code.

Tests

  • No-op today: surface.txt is absent on main, so cargo build, cargo clippy --all-targets -- -D warnings and cargo test -- --test-threads=1 pass with no cfgs set.
  • With the generated downtime module, surface.txt and the datadog-api-client bump from opt downtime get/create/cancel into pup generation #872 applied locally (not part of this PR), the same three commands pass. Without this change, clippy fails with the three never used errors above and the CLI surface test fails.
  • The browser WASM build was not run locally (no wasm32 toolchain). Its library doesn't include commands/ or main.rs, so CI's Build browser WASM job covers it.

🤖 Generated with Claude Code

The downtime prepare change gated the clap variants and dispatch arms
behind cfg(not(generated_op = ...)) but not the handler functions they
call, so once surface.txt lists the ops the handlers lose their callers
and clippy -D warnings fails. Gate the handlers, the import only get
uses, and test_downtime_get with the same cfgs, and switch the CLI
surface test's get expectation on the generated_op cfg.
@MintsInc

Copy link
Copy Markdown
Member Author

Superseded by #874, opened from the origin branch.

@MintsInc MintsInc closed this Sep 30, 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