fix: close #108 with single source of truth for default FieldNames#117
Conversation
Eliminate dual-source FieldNames defaults by routing every CLI get command through COMMON_FIELDS via get_default_fields(), and harden the schema gate so future regressions cannot slip past CI. - Migrate 14 commands off inline FieldNames literals to get_default_fields - Extend COMMON_FIELDS to support multi-FieldNames resources via dict (ads: FieldNames + TextAdFieldNames; keywordbids: + Search/Network) - Drop invalid "TextAd" from ads defaults (not in WSDL TextAdFieldEnum) - Schema gate now validates COMMON_FIELDS directly against WSDL enums (not only wire payload) and adds three new failure buckets: uncovered_get_groups, waiver_misuse, missing_field_name_params - SCHEMA_GATE_WAIVERS allow-list with justifications (only dictionaries) - Regression tests prove gate fails on uncovered groups, missing waivers, stale waivers, and missing multi-FieldNames coverage - Refresh coverage checklist to drop stale #108 references Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Use COMMON_FIELDS as the single source of truth for default FieldNames and wire those defaults into relevant CLI commands (agencyclients, changes, keywordsresearch). Add/adjust COMMON_FIELDS entries and update docs/README examples. Refactor build_api_coverage_report to detect and validate enum-backed *FieldNames for operations beyond just get, add capture fixtures, handle operation->CLI name mapping, and introduce missing_common_fields checks and related reporting. Update tests to cover the new validation paths and expectations.
|
@claude 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 4m 55s —— View job Code Review — PR #117Tasks
Findings1.
|
- Dedupe field_name_mismatches: skip wire_payload entries duplicating COMMON_FIELDS-source mismatches for the same value (avoids ambiguous double-reporting that would break single-issue assertions). - Add orphan_common_fields gate bucket: COMMON_FIELDS keys that match neither a CLI group nor an API service (typos like 'dynamicfeedadtarget') used to be silently skipped by _common_field_resource_targets and never validated; now they fail the gate. - Replace try/except TypeError in _capture_operation_body with explicit inspect.signature arity check, so internal TypeErrors in capture functions surface instead of being silently retried with one argument. - Make _CapturedResponse.data per-instance instead of a class-level mutable default, preventing cross-test state bleed if any future command mutates result.data. - Make changes check --timestamp required: WSDL declares Timestamp minOccurs=1 maxOccurs=1, so the previous optional treatment was a WSDL-spec violation independent of the FieldNames issue raised in #117. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Addressed review findings in 78da917. #1 changes.check FieldNames behavioral change — verified the WSDL claim and the picture is the opposite of a regression:
#2 double-reporting in field_name_mismatches — fixed. After #3 _capture_operation_body swallowing internal TypeError — fixed. Replaced the #4 _CapturedResponse.data mutable class attribute — fixed. Moved #5 silent skip of orphan COMMON_FIELDS keys — fixed. Added a new gate bucket Verification: |
|
@claude 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 4m 49s —— View job Code Review — PR #117 (Post-Fix Pass)Tasks
All five findings from the prior review were correctly addressed in 78da917. The gate tests pass, the dedup logic is correct, Findings1. Non-get operations: wire payload is never captured by the gate (design gap)
The main loop in if "get" not in get_cli_methods_for_service(cli_name):
continue
Today this is fine because both commands call This is a design limitation inherited from the gate architecture, not introduced by this PR. Worth documenting so the next contributor doesn't assume these commands are fully covered. 2. Inconsistent
|
All three capture_errors.append sites now include a "source" field, so consumers iterating the list never hit a KeyError on missing key. Values: - "COMMON_FIELDS" — error during COMMON_FIELDS validation - "wsdl_fetch" — error fetching/parsing WSDL for the service - "wire_payload" — error capturing the CLI request body Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Thanks for the post-fix pass. #1 non-get groups: wire payload not captured — accurate observation; this is a known design gap, not a regression. Tracked separately as #118 ("Extend WSDL schema gate to mutating operations"), which I opened earlier today specifically for this. The issue includes the rationale for keeping #117 scoped to #2 inconsistent capture_errors shape — fixed in ff5a907. All three Verification: |
Summary
Closes #108 by eliminating the architectural causes of WSDL FieldName regressions, not just the latest symptoms.
FieldNamesnow flows throughCOMMON_FIELDS+get_default_fields(). No inline literals remain indirect_cli/commands/(exceptdictionaries, where the list is required CLI input).COMMON_FIELDSentries can be dicts keyed by WSDL request param. Used forads(FieldNames+TextAdFieldNames) andkeywordbids(FieldNames+SearchFieldNames+NetworkFieldNames).build_schema_gatenow validatesCOMMON_FIELDSdirectly against WSDL*FieldEnum(not only wire payload), and exposes five failure buckets —field_name_mismatches,capture_errors,uncovered_get_groups,waiver_misuse,missing_field_name_params. Any non-empty bucket flipsschema_parity_oktofalse.SCHEMA_GATE_WAIVERSrequires a justification string for anygetcommand without WSDL*FieldEnum(currently onlydictionaries). Stale waivers (where Yandex later adds an enum) fail the gate aswaiver_misuse.COMMON_FIELDS, uncovered new commands, missing waivers, stale waivers, and incomplete multi-FieldNames coverage.Why this closes #108 permanently: there is no longer a way to add a new
getresource that bypasses validation. Adding a command without aCOMMON_FIELDSentry (or explicit waiver) fails CI.Test plan
pytest -q— 89 passed in test_api_coverage.py, full suite greenpython3 scripts/build_api_coverage_report.py—schema_parity_ok: true, all 5 schema buckets emptypython3 scripts/check_wsdl_drift.py— 29 services, 0 driftbids,bidmodifiers,audiencetargets,keywordbids,dynamicads,strategies,dynamicfeedadtargets) — noerror_code=8000🤖 Generated with Claude Code