Repository navigation
feat(campaigns): support fromNumbers in the campaign helper, deprecate phone_ids - #153
Conversation
…e phone_ids Campaign.create gains keyword-only from_numbers, sent as fromNumbers per the current API contract (caller IDs, rotated, frozen at creation). The legacy phone_ids path keeps working, including positional use, but emits a DeprecationWarning pointing at from_numbers and the telephony migration guide; after the migration window the API removes the phoneNumberIds field it maps to. Entries must be non-empty strings with a leading plus; ownership and full E.164 validation stay server-side. Supplying neither argument raises before any HTTP. When both are sent the server prefers fromNumbers, matching the documented behavior. Mocked regression tests assert the wire payloads.
|
crim doesn't review pull requests automatically here. Comment |
|
The failing compile gate is pre-existing on main, not introduced here: |
The wire-coverage gate resolved a namespace to the first wire file whose stem contained the namespace substring, so atoms analytics could match test_waves_analytics.py (9 tests) instead of test_atoms_analytics.py (18 tests) depending on glob order, failing every PR on a phantom coverage gap. The matcher now requires the exact normalized test_atoms_<namespace> stem. Regression tests cover both file orders and assert waves files cannot satisfy atoms coverage.
|
crim review |
|
crim is reviewing this pull request. Findings will be posted shortly. |
There was a problem hiding this comment.
LGTM
Assessment
Solid, surgical change that adds from_numbers/fromNumbers to the hand-written campaign helper while preserving phone_ids backward compatibility, plus a well-targeted fix to the wire-coverage namespace matcher.
What this PR does
Adds a keyword-only from_numbers argument to Campaign.create (serialized as fromNumbers), with light client-side validation (list of strings starting with +). Legacy phone_ids remains positional/optional and emits a DeprecationWarning; both fields are sent when supplied, leaving precedence to the server. It also tightens scripts/verify.py wire-coverage matching from a substring check to an exact test_atoms_<ns> match (fixing atoms namespaces previously matching test_waves_* files), and adds regression tests for both.
Findings
No issues found.
- Backward compatibility verified: positional
phone_idscallers still work; the helper is standalone (CLI/generated clients useatoms.campaigns.create, not this helper), so the signature change does not break the call sites in the impact analysis. - The
verify.pyexact-match fix correctly handles underscore/camelCase namespaces (e.g.knowledge_base->test_atoms_knowledgeBase.py) and excludestest_waves_*files. - Validation error wording ("non-empty strings") is enforced implicitly via
startswith("+"); empty strings are rejected, consistent with tests.
Good to mergeA deprecation path with a migration link, mocked-HTTP tests, and a verify-script bug fix thrown in for free — this PR sends both |
The campaign helper only sends the legacy
phoneNumberIdsfield, which is deprecated on the API (responses carryDeprecation: true) and is removed after the telephony migration window, at which point campaign creation through this SDK breaks.This adds keyword-only
from_numbers(sent asfromNumbers), keepsphone_idsworking with aDeprecationWarningpointing at the migration guide, validates entries as non-empty+-prefixed strings (full E.164 and ownership stay server-side), raises before HTTP when neither argument is given, and sends both when both are supplied since the server documentsfromNumbersprecedence. Mocked tests assert the exact wire payloads; changelog entry under Unreleased.Known follow-ups, out of scope here: other helpers still sending deprecated telephony fields (
telephonyProductIdon agent writes,fromProductIdon outbound calls).