refactor: migrate Group-4 get commands to make_get_command (#588)#601
Conversation
Move the five migratable "complex" get commands onto the shared make_get_command factory, reusing only its existing hooks (no new factory parameter): - adgroups get, keywords get: criteria-limit + 8/2 nested *FieldNames; the --status/--statuses mutual-exclusion guard lives in the per-module criteria_builder. - creatives get: require-filter + 4 nested. - strategies get: require-filter + 16 nested (the largest set so far). - audiencetargets get: criteria-limit + long require-filter message, no nested. Factory ordering fix: nested *FieldNames are now parsed (and their provided-but-empty-CSV UsageError raised) before both criteria-limit enforcement and the empty-criteria require guard, matching the order every hand-rolled command used. A "--<nested> ''" combined with no filter or an over-limit array reports the nested error, not the require/limit one. The parsed dict is still merged after the common params, so payload key order is unchanged; this also restores the pre-factory nested-before-limits order for the migrated bidmodifiers get. A new test_dry_run regression test pins the precedence. --help, --dry-run payloads and the error-precedence edge cases are byte-identical, verified against 33 pre-migration baselines captured via CliRunner from the pre-migration tree. As with every prior factory migration, --dry-run is now a token-free test seam for these commands. ads get and campaigns get stay hand-rolled as documented carve-outs (see _get.py): ads always emits TextAdFieldNames with a per-field default (like keywordbids); campaigns' --fields rejects an explicitly empty CSV rather than falling back to the default FieldNames. Net -278 lines. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@claude @codex review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Claude finished @axisrow's task in 2m 52s —— View job Code Review — Group-4
|
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ 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". |
Что
Завершает мигрируемую поверхность #588 — переводит 5 «сложных» Group-4
get-команд на общую фабрикуmake_get_command, переиспользуя только её существующие хуки (новых параметров фабрики нет):criteria_limits+ 8 вложенных*FieldNames; конфликт--status/--statuses— вcriteria_buildercriteria_limits+ 2 вложенных; тот же конфликт в builderrequire_criteria_message+ 4 вложенныхrequire_criteria_message+ 16 вложенных (крупнейший набор)criteria_limits+ длинное require-сообщение, без вложенныхФикс порядка проверок в фабрике
Вложенные
*FieldNamesтеперь парсятся (и ихUsageErrorна пустой CSV поднимается) до enforcement criteria-лимитов и до require-guard'а — как было во всех hand-rolled командах.--<nested> ""вместе с «нет фильтра» или с over-limit массивом отдаёт ошибку вложенного поля, а не require/limit. Парсенный dict по-прежнему мёрджится после common-params, поэтому порядок ключей payload не меняется. Побочно это восстанавливает исходный порядок nested-before-limits для уже мигрированногоbidmodifiers get. Добавлен регрессионный тест вtest_dry_run.Инварианты
--help(порядок опций, все вложенные опции, choice/default у--is-archived),--dry-runpayload'ы и edge-кейсы порядка ошибок (empty-nested vs no-filter и vs over-limit) — байт-идентичны, проверено на 33 эталонах через CliRunner, снятых с pre-migration дерева (git stash). Как и во всех прошлых миграциях фабрики, клиент резолвится только на live-пути →--dry-runдля этих команд теперь token-free test seam.Carve-out'ы (осознанно hand-rolled, задокументированы в
_get.py)TextAdFieldNamesвсегда эмитится с per-field дефолтом (как у carved-outkeywordbids); фабрика делает provided-only проекции.--fieldsчерез_parse_csv_optionотвергает пустой CSV вместо silent-fallback к дефолтнымFieldNames.Проверки
/simplify(4 линзы: reuse / simplification / altitude / byte-identity) — altitude поймал инверсию nested-vs-limits, исправлено; byte-identity подтвердил остальное идентичным.Closes #588
🤖 Generated with Claude Code