Skip to content

refactor(campaigns): extract CPM_BANNER_CAMPAIGN to _campaigns_cpm_banner.py (#613)#619

Open
axisrow wants to merge 2 commits into
mainfrom
ao/issue-602-cpm-banner
Open

refactor(campaigns): extract CPM_BANNER_CAMPAIGN to _campaigns_cpm_banner.py (#613)#619
axisrow wants to merge 2 commits into
mainfrom
ao/issue-602-cpm-banner

Conversation

@axisrow

@axisrow axisrow commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Step 2 of the incremental campaigns.py split (epic #602). Stacked on PR #612 (Step 0 — shared helpers). Extracts the CPM_BANNER_CAMPAIGN add/update subtype-block composition into a new sibling module.

Smallest campaign type → validates the per-type extraction mechanics before the larger types.

What moved

The former inline elif campaign_type_norm == "CPM_BANNER_CAMPAIGN": branches in add (~34 lines) and update (~45 lines) → new module direct_cli/commands/_campaigns_cpm_banner.py:

  • build_add_block(p, campaign_data, parsed_settings, counter_ids_obj, frequency_cap_obj)
  • build_update_block(p, sub_block)

Both commands now snapshot their CLI parameters once (p = dict(locals())) and delegate; the per-type builder pulls only the CPM-relevant flags from p.

CLI surface

No breaking changes. Every flag, every --dry-run payload byte-for-byte identical. Pure internal relocation — no legacy aliases, strict WSDL parity preserved.

Tests run

  • pytest tests/test_dry_run.py -k cpm: 28 passed
  • pytest (full offline tier): 2507 passed, 8 skipped (identical to baseline)
  • pytest tests/test_wsdl_parity_gate.py tests/test_api_coverage.py: 263 passed, 6 skipped (green)
  • black + flake8 — my files clean (only pre-existing E501 long-line warnings)

Risks / follow-ups

Closes #613. Part of #602.

🤖 Generated with Claude Code

@axisrow

axisrow commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

📋 Review summary — all cycles (local review)

Reviewed locally with /review (Claude) + Codex companion (gpt-5.6-sol, xhigh). No GitHub bots pinged. Both reviewers approved across both cycles.

Cycle Reviewer Finding Verdict Resolution
1 claude # noqa: F401 on genuinely-useded Dict import is misleading SKIP→fixed Removed in 5384996 (cycle-2 cleanup)
1 claude p = dict(locals()) captures Click ctx (cycles) SKIP Left as-is — negligible; noted for future serializable-p needs
1 codex — (behaviorally equivalent, 19 tests pass) approve
2 claude cleanup is correct, no behavioral change approve
2 codex Ship: no critical issue, 13 tests pass approve

Totals: 0 FIX, 1 SKIP (1 later applied as cleanup), 0 UNVERIFIED. CLI surface byte-for-byte identical.

Local review is review-only on merge — merge is yours to trigger (PR is stacked on #612, so rebase to main after #612 lands first).

@axisrow
axisrow changed the base branch from ao/issue-602-campaigns to main July 23, 2026 00:54
axisrow and others added 2 commits July 23, 2026 08:55
…nner.py (#613)

Step 2 of the incremental campaigns.py split (epic #602, follows shared-helpers
extraction in PR #612). Moves the CPM_BANNER_CAMPAIGN add/update subtype-block
composition out of the inline `elif campaign_type_norm == "CPM_BANNER_CAMPAIGN":`
branches into a new sibling module direct_cli/commands/_campaigns_cpm_banner.py
(build_add_block / build_update_block).

Both commands now snapshot their CLI parameters once via `p = dict(locals())`
and delegate; the per-type builder pulls only the CPM-relevant flags from `p`.
CLI surface, every flag and every --dry-run payload is byte-for-byte identical
(28 test_campaigns_*cpm* fixtures green, offline tier 2507 passed, WSDL parity +
API coverage green).

Smallest campaign type, used to validate the per-type extraction mechanics
before the larger types (mobile_app, smart, dynamic, unified, text).

Part of #602.

Co-Authored-By: Claude <noreply@anthropic.com>
`from typing import Dict` is genuinely used (Dict[str, object] annotations),
so the `# noqa: F401` was misleading. flake8 stays clean without it.

Co-Authored-By: Claude <noreply@anthropic.com>
@axisrow
axisrow force-pushed the ao/issue-602-cpm-banner branch from 5384996 to 6aacef1 Compare July 23, 2026 00:56
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.

refactor(campaigns): extract CPM_BANNER_CAMPAIGN to _cpm_banner.py (#602, step 1)

1 participant