refactor: migrate agencyclients/adextensions get to make_get_command (part of #587)#599
Conversation
…587) Finish the #587 get migration with the two structurally-divergent carve-outs: - agencyclients get: no --ids (filters by --logins/--archived). New factory param include_ids=False drops the --ids option; a custom criteria_builder builds {Archived, Logins?} from the resource's own options. - adextensions get: new factory param adextensions_wire_layout=True reproduces its exact recorded wire layout — always emit SelectionCriteria (even empty) and order nested *FieldNames before Page. The empty SelectionCriteria is a recorded API contract (the adextensions_get read cassette replays it; the command is deliberately excluded from _SELECTION_CRITERIA_REQUIRED_GET_COMMANDS). The get callback signature moves ids to a trailing defaulted kwarg so both include_ids modes work (Click passes by keyword; absent --ids -> None). Byte-identity preserved (verified against pre-migration baselines): --help, --dry-run payloads incl. the empty-criteria and nested-before-Page cases, and the read cassettes. Part of #587. Remaining carve-out: leads get (bespoke --datetime option order between --limit and --fetch-all doesn't fit the shared get_options stack). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@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 1m 31s —— View job Review:
|
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
What
Finish the #587
getmigration with the two structurally-divergent carve-outs. Follows #597 (criteria-limits) and #598 (nested*FieldNames).Two more optional factory parameters:
include_ids(defaultTrue) — setFalsefor resources with no id filter.agencyclients getfilters by--logins/--archivedand has no--ids; it supplies a customcriteria_builderbuilding{Archived, Logins?}from its own options.adextensions_wire_layout(defaultFalse) — a single-command flag reproducingadextensions's exact recorded wire layout: always emitSelectionCriteria(even empty) and order nested*FieldNamesbeforePage.The
getcallback signature movesidsto a trailing defaulted kwarg so bothinclude_idsmodes work (Click passes by keyword; absent--ids→None).Why the empty SelectionCriteria is preserved (not "fixed")
It's a recorded API contract, not a latent bug:
tests/cassettes/test_read_cassettes/test_read_command[adextensions_get].yamlreplays{"method":"get","params":{"SelectionCriteria":{},"FieldNames":[...]}}.adextensionsis deliberately excluded fromtest_dry_run._SELECTION_CRITERIA_REQUIRED_GET_COMMANDS— the live API accepts an empty criteria here, unlike adgroups/ads/keywords (which 4001 on it).So
adextensions_wire_layoutpreserves a contract; the docstring and code comments flag it as a do-not-normalize target.Byte-identity
Verified each command against pre-migration baselines — all 11 snapshots identical, including the empty-
SelectionCriteriacase, the nested-*FieldNames-before-Pageordering, the--archived [YES|NO] [default: NO]rendering, and the provided-but-empty*FieldNamesUsageError.Tests
test_read_cassettes,test_dry_run,test_api_coverage,test_comprehensiveincluded.ruff checkclean.Remaining carve-out
leads get— its--datetime-from/--datetime-tooptions sit between--limitand--fetch-all, a bespoke option order the sharedget_optionsstack can't reproduce without a one-off insertion slot. Not worth contorting the factory for a single command; it stays hand-rolled. With this PR,make_get_commandcovers 10 of the 11getcommands in make_get_command: мигрировать get с вложенными полями + criteria-limit (Группы 2-3) #587's scope.🤖 Generated with Claude Code