Skip to content

refactor(commands): hoist set-bids boilerplate into make_set_bids_command - #746

Merged
axisrow merged 1 commit into
mainfrom
chore/589-commands-dedup
Aug 4, 2026
Merged

refactor(commands): hoist set-bids boilerplate into make_set_bids_command#746
axisrow merged 1 commit into
mainfrom
chore/589-commands-dedup

Conversation

@axisrow

@axisrow axisrow commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #589 (C12).

Investigation of issue #589's three items found #11 (_*_lifecycle()register_lifecycle_commands) and #13 (execute_add/execute_request tail) already implemented and adopted across the codebase in earlier commits — the only remaining gap was C12: set-bids boilerplate duplicated across dynamicads, audiencetargets, smartadtargets, dynamicfeedadtargets.

  • Added direct_cli/commands/_set_bids.py::make_set_bids_command, modeled on the existing _lifecycle.py/_get.py factory pattern.
  • Each module now registers set-bids with one call, passing its resource-specific bid fields as BidField tuples.
  • Preserved two subtle behavioral quirks byte-identically:
    • --priority uses a truthy check (if value:), not is not None, matching all 4 originals.
    • smartadtargets set-bids never actually required a target selector (checked if not bid_data instead of the selector group) — kept via require_selector=False.

Test plan

  • pytest — full offline suite: 3123 passed, 23 skipped (no changes)
  • black/flake8 on touched files — clean
  • Manual --help diff for all 4 set-bids commands — option order/text unchanged
  • Manual dry-run payload checks incl. error paths (missing selector, missing bid, smartadtargets' selector-optional quirk)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rkv1ZdgUPefeXM5q3eepTe

…mand (#589 C12)

dynamicads, audiencetargets, smartadtargets and dynamicfeedadtargets each
duplicated the same set-bids command body (selector/bid field collection,
selector+bid validation, setBids payload assembly). Extract the shared
factory into commands/_set_bids.py, matching the make_lifecycle_command/
make_get_command pattern already used for lifecycle and get commands.

CLI surface, option order, error text, and --dry-run payloads are
byte-identical, including smartadtargets' distinct "no selector required"
validation and the untyped --priority truthy check preserved via
BidField.truthy.
@axisrow

axisrow commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

📋 Review summary — all cycles

Local review (/review + Codex companion, model sol / effort xhigh), no bots pinged.

Cycle Reviewer Finding Verdict Resolution
1 claude (/review) Clean, no issues found
1 codex Clean, approve, no findings

Totals: 0 FIX, 0 SKIP, 0 UNVERIFIED. Both configured reviewers returned a clean verdict on round 1 (head d5ed38e). Offline suite (3123 passed, 23 skipped), black, flake8, and WSDL parity gate all green.

@axisrow
axisrow merged commit f6dd7c3 into main Aug 4, 2026
6 checks passed
@axisrow
axisrow deleted the chore/589-commands-dedup branch August 4, 2026 05:04
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.

commands dedup: lifecycle-обёртки (#11), make_set_bids_command (#12), execute_add (#13)

1 participant