Inverse of list_route_lists_and_groups — given a destination device,
return every numplan whose direct target is that device. Closes the
highest-priority gap from cucx-docs's prompt-suggestions handoff
(see axl/agent-threads/cucx-prompt-suggestions/001 + 003 for the
multi-message context).
Schema walk: device → devicenumplanmap → numplan, with LEFT JOINs
to routepartition + typepatternusage for friendly output. M:N is the
landmark — numplan does NOT have a direct fkdevice column, which was
cucx-docs's literal multi-attempt schema-discovery experience that
motivated the tool.
Three wildcard-expansion modes per cucx-docs Q2:
- False (default) — patterns intact
- "count" — per-pattern digit-string estimate + total surface;
unbounded patterns (`!`, `@`) reported as None count and force
the total to None so an auditor sees the partial measurement;
per-pattern caps at 10,000 to prevent runaway estimation
- "enumerate" — actual digit-string list, only for tightly-bounded
patterns (no `!`, no `@`, no `.`, ≤ 1,000 expansions); patterns
that violate any constraint return null with a skip reason
Direct-target only per Q1 — full transitive reachability composes
with route_lists_and_groups + route_translation_chain, called out
both in the docstring and in the response's _note field.
37 new tests cover the math layer (count/enumerate helpers in
isolation), the bounds/cap behavior, the unbounded-pattern flagging,
empty-result handling, SQL injection escaping, and the integration
through a FakeAxlClient. Full suite: 219/219 passing.
Live-cluster smoke test pending — cluster TLS intermittently failing
this session; will re-verify once stable.