Ryan Malloy 99986daa45 route_plan: cti_failsafe_reachability fix-suggestion handles dotted patterns
Limitation surfaced by the live Bingham smoke-test (cti-audit-prompts/004):
the canonical 912-CTI-RP finding got the broken-forward flag correct,
but the suggested-fix message couldn't name CER911-PT (where pattern
'10.911' lives) because the exact-literal lookup
`WHERE np.dnorpattern = '10911'` doesn't match the dot-form `10.911`.

The CUCM separator-dot in patterns is purely visual — represents
access-code boundary, not a digit. A destination string `10911`
should match a configured pattern `10.911` since both represent the
same dialed digits.

Two-stage match in _suggest_failsafe_fix:

  1. Exact-literal: WHERE np.dnorpattern = '<dest>' (current behavior)
  2. Dot-stripped: pull all patterns with `.` in them, filter
     Python-side by `pattern.replace('.', '') == dest`

Stage 2 only runs when stage 1 returns no partitions, so the common
case (exact-literal hit) takes the fast path. Falls back to the
wildcard-investigation generic message only when neither stage finds
a match.

The fix message also distinguishes the two cases:
  - Exact-literal hit → "Pattern '10911' lives in partition X..."
  - Dot-stripped hit → "Pattern '10.911' (matches destination '10911')
    lives in partition X..."

Naming both the pattern form and the destination keeps the operator
oriented when the dialed digits and the configured pattern look
different.

Tests: +5 in TestDotStrippedFixSuggestion exercising:
  - dot-stripped match cites the dotted pattern form
  - exact-literal takes precedence over dotted match
  - multi-partition dotted match
  - no-exact-no-dotted falls back to generic
  - irrelevant dot-positions correctly excluded from match

One existing assertion updated from "no exact-literal pattern" to
"no exact-literal or dot-stripped pattern" (more accurate after the
patch).

Full mcaxl suite: 264 → 269 passing (+5 dot-stripped tests).
The 1 unrelated test_wildcard.py timing flake is pre-existing
(regex-backtracking timing assertion fails by 36ms under load).

Cross-references:
  - Live smoke-test findings: agent-threads/cti-audit-prompts/004
  - Original tool: agent-threads/cti-audit-prompts/002, commit d33cd7c
2026-05-09 03:36:51 -06:00
..
2026-04-25 20:29:18 -06:00