Skip to content

feat(number,tollfree): Dashboard TN read surface and toll-free template lookup - #44

Open
kshahbw wants to merge 2 commits into
mainfrom
feat/number-reads-tollfree
Open

feat(number,tollfree): Dashboard TN read surface and toll-free template lookup#44
kshahbw wants to merge 2 commits into
mainfrom
feat/number-reads-tollfree

Conversation

@kshahbw

@kshahbw kshahbw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What

Read-only commands over two surfaces the CLI didn't cover:

band number (Dashboard per-TN reads)

  • number details <tn> — full Dashboard view via /tns/{tn}/tndetails: geography (LATA/state/rate center), vendor, sub-account/location, features (E911/LIDB/DLDA), messaging settings incl. assigned NN route, TN attributes, and the per-number OriginationRoutePlan (priority + weight per endpoint) where configured
  • number nnroutes <tn> — available NetNumber routes
  • number count — totals endpoints (--disconnected, --subaccount, --location) instead of paging the whole inventory
  • number list — new filters: --npa-nxx, --state, --ratecenter, --lata, --subaccount, --location, --disconnected. The bare command still uses /tns so credentials without the inservice role see no change.

band tollfree (new group)

  • tollfree template <tn...> — toll-free routing template names via tollFreeTemplateAssignments/search (up to 5000 TFNs/call). Account-gated by TollFreeTemplateAssignmentSearch; 403 maps to an actionable "ask your account manager" message (exit 2), same pattern as the portin TF-automation gate.

Why

Common operational questions for toll-free-heavy accounts — which routing template a TFN is assigned to, and how a number routes across weighted endpoints — had no CLI answer. All of the above are reads on publicly documented APIs; templateName is returned verbatim (no internal carrier mapping is shipped). The per-TN read gap was worth closing for every account — number list previously returned bare strings and nothing could answer "what's configured on this number?"

Validation

  • go test ./... green (incl. doc-contract); make build clean. Local golangci-lint panics on a Go 1.26/1.27 toolchain mismatch unrelated to this change — relying on CI lint.
  • Live prod probes (read-only): template gating 403 → exit 2 with mapped message; tndetails/availableNnRoutes foreign-TN 404 → exit 3; flag conflicts → exit 6 before any HTTP. Happy paths need a credential with the Numbers/inservice role and an entitled account — flagged for follow-up validation; response-shape handling is unit-tested against the spec examples, and unexpected shapes pass through raw rather than vanishing.

Notes for review

  • --ratecenter casing differs per endpoint in the published specs (account: ratecenter, site: rateCenter); the CLI follows each endpoint's documented casing.
  • extractFullNumbers learned the bare-string <TelephoneNumber> shape used by inserviceNumbers/discnumbers alongside the existing /tns object shape.

This PR was substantially AI-generated (Claude Code), reviewed and directed by @kshahbw.

🤖 Generated with Claude Code

…te lookup

Add read commands over the Dashboard (legacy platform) per-TN surface and
the toll-free routing template search:

- band number details <tn>: full Dashboard view via /tns/{tn}/tndetails —
  geography, features, messaging settings, TN attributes, and the
  per-number OriginationRoutePlan (priority/weight per endpoint) where
  configured
- band number nnroutes <tn>: available NetNumber routes
- band number count: totals endpoints (account, sub-account, location,
  disconnected) instead of paging the full inventory
- band number list: geography filters (--npa-nxx, --state, --ratecenter,
  --lata), sub-account/location scoping, and --disconnected; the bare
  command keeps using /tns so credentials without the inservice role are
  unaffected
- band tollfree template <tn...>: routing template names via
  tollFreeTemplateAssignments/search; gated per account, 403 maps to an
  actionable message (exit 2)

All commands are read-only. Live-probed against production: template
gating (403 -> exit 2), tndetails/nnroutes not-found (404 -> exit 3), and
flag-conflict validation (exit 6); happy paths need an entitled account
and are tracked in the design spec.
@kshahbw
kshahbw requested review from a team as code owners August 24, 2026 20:12
@bwappsec

bwappsec commented Aug 24, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

joshraub-bw
joshraub-bw previously approved these changes Aug 24, 2026
…idation

Review findings from an independent pass:

- The inserviceNumbers/discnumbers endpoints define 'page' as the 1-based
  ID of the first element (1, 1001, 2001, ...), not a page number — paging
  1,2,3 re-fetched overlapping records past the first page. The sippeer
  tns endpoint DOES use page numbers; listQuery now carries the dialect.
- Terminate pagination via the response's TotalCount instead of only the
  short-batch heuristic, which misread a full final page as 'more to
  come' and issued a needless, failable extra request on exact multiples
  of the page size.
- Reject vanity/non-digit input in tollfree template client-side
  (ClassifyNumber checks only length and area code, so 800ABC-DEFG
  previously reached the API).
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.

3 participants