Skip to content

feat(campaigns): support fromNumbers in the campaign helper, deprecate phone_ids - #153

Merged
abhishekmishragithub merged 3 commits into
mainfrom
feat/campaign-from-numbers
Nov 11, 2026
Merged

abhishekmishragithub merged 3 commits into
mainfrom
feat/campaign-from-numbers

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

The campaign helper only sends the legacy phoneNumberIds field, which is deprecated on the API (responses carry Deprecation: 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 as fromNumbers), keeps phone_ids working with a DeprecationWarning pointing 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 documents fromNumbers precedence. 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 (telephonyProductId on agent writes, fromProductId on outbound calls).

…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-app

crim-app Bot commented Nov 3, 2026

Copy link
Copy Markdown

crim doesn't review pull requests automatically here.

Comment crim review on this pull request whenever you want a review.

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator Author

The failing compile gate is pre-existing on main, not introduced here: python3 scripts/verify.py at origin/main (61370fc) fails the same way, analytics methods=18 wiretests=9 (plus three import failures in wire tests), because the analytics surface grew without matching wire tests after the last green main run. This PR touches only the campaign helper, its tests, and the changelog; lint and the campaign tests pass. Happy to add the nine missing analytics wire tests in a separate PR if useful.

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.
@abhishekmishragithub

Copy link
Copy Markdown
Collaborator Author

crim review

@crim-app

crim-app Bot commented Nov 11, 2026

Copy link
Copy Markdown

crim is reviewing this pull request. Findings will be posted shortly.

@crim-app crim-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ids callers still work; the helper is standalone (CLI/generated clients use atoms.campaigns.create, not this helper), so the signature change does not break the call sites in the impact analysis.
  • The verify.py exact-match fix correctly handles underscore/camelCase namespaces (e.g. knowledge_base -> test_atoms_knowledgeBase.py) and excludes test_waves_* files.
  • Validation error wording ("non-empty strings") is enforced implicitly via startswith("+"); empty strings are rejected, consistent with tests.

@crim-app

crim-app Bot commented Nov 11, 2026

Copy link
Copy Markdown

Good to merge

A deprecation path with a migration link, mocked-HTTP tests, and a verify-script bug fix thrown in for free — this PR sends both fromNumbers and good vibes, and lets the server sort out precedence. Ship it.

@abhishekmishragithub
abhishekmishragithub merged commit f4e1678 into main Nov 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant