[codex] Add unified and smart adgroup flags - #329
Conversation
|
Claude finished @axisrow's task in 4m 14s —— View job Review of PR #329
SummaryPR looks correct end-to-end. The new Issue #283 scope — covered
Parity gate — clean
Add-path correctness
Update-path correctness
Non-blocking notes
TestsCoverage looks appropriate for the changes:
VerdictLGTM. No correctness blockers; the four findings above are non-critical polish/follow-ups. |
There was a problem hiding this comment.
Pull request overview
This PR closes parity gaps for adgroups add/update by adding typed CLI flags for Unified and Smart ad group subtype fields, and by enforcing that a single adgroups update item cannot mix subtype-specific update blocks.
Changes:
- Add
UNIFIED_AD_GROUPsupport toadgroups addwith typed--offer-retargeting(emitsUnifiedAdGroup.OfferRetargeting). - Add typed
adgroups updatesupport forSmartAdGroup.AdTitleSource,SmartAdGroup.AdBodySource, andUnifiedAdGroup.OfferRetargeting, with validation rejecting mixed subtype flag combinations per update item. - Update dry-run tests, WSDL optional-field audit status/routing, and README single-line examples to reflect the new flags.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
direct_cli/commands/adgroups.py |
Adds UNIFIED_AD_GROUP handling and --offer-retargeting; adds Smart/Unified update flags and rejects mixed subtype updates. |
tests/test_dry_run.py |
Adds dry-run payload/validation tests for unified add, smart/unified updates, and mixed-subtype rejection. |
tests/test_wsdl_parity_gate.py |
Marks the newly supported WSDL optional paths as covered by the new flags (and removes prior missing-followup routing). |
tests/WSDL_OPTIONAL_FIELD_AUDIT.md |
Updates the generated audit to reflect newly supported Unified/Smart adgroup optional paths and updated counts. |
README.md |
Adds concise one-line examples for unified add and smart/unified update flags. |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Pushed a follow-up fix for the documented Local verification after the fix:
@codex @claude review. Focus on critical issues: bugs, API contract mismatches, logical errors, data loss risks, performance problems, missing tests, docs/audit inconsistencies, and issue #283 scope gaps. Do not nitpick cosmetic style unless it affects correctness or maintainability. |
|
Claude finished @axisrow's task in 4m 15s —— View job Review of v501 routing follow-up (commit
|
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Addressed the non-blocking follow-up from the v501 review:
Local verification after this commit:
@codex @claude review. Focus on critical issues: bugs, API contract mismatches, logical errors, data loss risks, performance problems, missing tests, docs/audit inconsistencies, and issue #283 scope gaps. Do not nitpick cosmetic style unless it affects correctness or maintainability. |
|
Claude finished @axisrow's task in 2m 46s —— View job Review of documentation/test follow-up (commit
|
| Prior finding | Status in this commit |
|---|---|
| #2 — Document WSDL-vs-runtime rationale for v501 routing | Closed via inline comment at direct_cli/commands/adgroups.py:415-417. Explains that v5 WSDL declares UnifiedAdGroup but the runtime requires v501, and also documents the single-item-batch assumption inline (which subsumes my finding #4). |
#3 — Document adgroups_v501 mapping rationale |
Closed at direct_cli/_vendor/tapi_yandex_direct/resource_mapping.py:13 with a one-line comment. Minor: the comment doesn't include a docs URL — future maintainers would still have to grep adgroups.py for the why. Not worth a follow-up. |
| Test gap — Smart-only update stays on v5 | Closed by test_adgroups_update_smart_keeps_v5_endpoint (tests/test_cli.py:225-256). Asserts both the resource ("adgroups") and that the SmartAdGroup block survives intact. |
| Test gap — Unified update with base field + subtype block | Closed by extending test_adgroups_update_unified_uses_v501_endpoint to send --name "Updated Unified" alongside --offer-retargeting NO (tests/test_cli.py:177-192). This proves _uses_unified_adgroup_endpoint keys on the nested UnifiedAdGroup block, not on payload shape. |
Routing predicate review (unchanged in this commit, re-verified)
_uses_unified_adgroup_endpoint (adgroups.py:405-421) and _post_adgroups (:424-428) — sound:
- Predicate is
any(... "UnifiedAdGroup" in adgroup ...)overparams.AdGroups. With the new comment, the single-item-batch assumption is now explicit. - Defensive type guards (
isinstance(params, dict),isinstance(adgroups_payload, list)) preserve a benign fallback to v5 for malformed bodies. - Both call sites (
_post_adgroups(client, body)at:852for add and:1138for update) flow through the same routing helper — no path skips it.
Audit / parity gate consistency
tests/WSDL_OPTIONAL_FIELD_AUDIT.md:2744-2747, 2797-2804rows are unchanged and still correctly markedsupportedagainst the new flags. No drift introduced by this commit.direct_cli/_vendor/tapi_yandex_direct/tapi_yandex_direct.pyi:136exposesadgroups_v501(), matching the resource mapping — type-checked path is consistent.direct_cli/smoke_matrix.pystill registers onlyadgroups.{add,update,delete,get}and no--type UNIFIED_AD_GROUPinvocation inscripts/test_sandbox_write.sh— so the sandbox-v501 404 concern I raised in the previous round remains theoretical (unified-on-sandbox isn't auto-exercised today). Leave as-is unless/until sandbox-write smoke grows a unified case.
Standing follow-ups (still non-blocking, unchanged)
Re-flagging only so they don't get lost — none gate this PR:
RUNTIME_ROUTED_METHODSregistry — finding Add 1Password auth and simplify build config #2 was addressed with a comment; the structural option (sibling toRUNTIME_DEPRECATED_METHODSindirect_cli/wsdl_coverage.py:139-148) is still open if a third runtime-routing case ever lands. One-off comment is fine for one case.- v501 WSDL not cached — parity gate validates against v5 only. If Yandex ships a new
minOccurs=1field or renamesOfferRetargetingin v501, the gate won't catch it. Worth a tracking issue when convenient. PAYLOAD_CASESfixtures —tests/api_coverage_payloads.pystill has no UNIFIED/Smart-update fixture rows. Not a parity-gate violation (operations are already represented), but adding them would lock the dry-run JSON shapes into the regression suite alongside the existingtest_dry_run.pyassertions.nillableclear forSmartAdGroup.AdTitleSource/AdBodySource— WSDLnillable="true"(tests/wsdl_cache/adgroups.xml:343-344) is not exposed by the CLI. Out of adgroups add/update: add UNIFIED_AD_GROUP and SMART_AD_GROUP parity #283 scope.
Verdict
LGTM. Documentation and test coverage gaps from the prior round are closed; the routing logic, parity audit, and pyi stub are all internally consistent. Issue #283 scope is fully covered with appropriate guards against silent data loss and mis-routing.
· branch: codex/issue-283-unified-smart-adgroups
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
UNIFIED_AD_GROUPsupport foradgroups addwith typed--offer-retargetingadgroups updatesupport forSmartAdGroup.AdTitleSource,SmartAdGroup.AdBodySource, andUnifiedAdGroup.OfferRetargetingDocs boundary
adgroups.addlistsUnifiedAdGroup.OfferRetargetingand existingSmartAdGroupadd fields: https://yandex.com/dev/direct/doc/en/adgroups/addadgroups.updatelistsSmartAdGroup.AdTitleSource,SmartAdGroup.AdBodySource, andUnifiedAdGroup.OfferRetargeting: https://yandex.ru/dev/direct/doc/ru/adgroups/updateValidation
python3 -m pytest tests/test_dry_run.py -k 'adgroups and (unified or smart)'python3 -m pytest tests/test_dry_run.py -k adgroupspython3 scripts/build_wsdl_optional_field_audit.py --checkpython3 -m pytest tests/test_wsdl_parity_gate.pypython3 -m pytest tests/test_cli.py tests/test_dry_run.py tests/test_wsdl_parity_gate.pymypy .git diff --checkCloses #283