Bug #11
openFax Tone/Send Module Modernization — Table Consolidation, Strategy Pattern, REST API v3, Queue Monitoring & Security Hardening
0%
Description
User Story¶
As a platform engineering team member,
I want the Fax Tone/Send module modernized to consolidate its dual-family table/code pattern, unify REST API versions, decompose the monolithic controller, and convert synchronous monitoring to queue-based processing,
So that we reduce the maintenance surface by ~40%, close validation and security gaps, improve scalability, and enable sustainable feature development within the module.
Background¶
The Fax Tone/Send module (test type 6) schedules automated calls to customer fax DIDs to validate fax service health — either by detecting CNG/answer tones ("Fax Tone Detection") or by sending an actual fax document end-to-end ("Send Fax").
Current state suffers from:
- Dual-family duplication — 14 tables, 17 models, pervasive if/switch branching for Plain vs Verify+ families
- REST API sprawl — v1/v2/v3 controllers duplicated with validation gaps
-
Controller bloat —
KcFaxSchedulerControllerhandles CRUD + CDR + stuck-test + billing + alerts - Monitoring scalability — synchronous cron degrades linearly with DID count
- Security gaps — shared dashboard access control unclear; REST auth unverified
Stack: PHP 8.x / Laravel / Eloquent / MySQL / MongoDB (audit)
Scope¶
In Scope¶
-
Table consolidation (14 → 7) using a
typediscriminator column with database views for backward compatibility -
Strategy pattern replacing scattered
fax_test_typeif/switch branching with polymorphicToneSendStrategy/VerifyPlusStrategy - REST API v3 consolidation — v1 deprecated immediately, v2 sunset in 6 months, new Form Requests close validation gaps
- Controller decomposition — CDR, stuck-test, and billing extracted from the monolithic scheduler controller
- Queue-based monitoring — synchronous cron converted to per-DID dispatched jobs with retry/backoff
- Event-driven alerts — mail decoupled from business logic via Laravel Events
- Security hardening — scoped token middleware for shared dashboard, route middleware audit, row-level locking
Out of Scope¶
- Cross-module consumers (reporting, billing, PDF)
- Test engine integration
- Platform constants
- Frontend
Implementation Plan (42 tasks, 5 phases)¶
| Phase | Tasks | Key Work |
|---|---|---|
| 1. Analysis & Design Alignment | T-01, T-02 | Validate stack detection and map all findings to tasks |
| 2. Foundations & Data Layer | T-03 – T-07 |
config/fax.php, Strategy pattern, unified migration (14→7 tables), backfill, backward-compat views |
| 3. Incremental Implementation | T-08 – T-31 | Model unification (17→9), repository extension, service merging, controller decomposition, REST API v3 consolidation, queue-based monitoring, event-driven alerts, security hardening, naming standardization |
| 4. Testing & Quality Control | T-32 – T-39 | Unit tests (strategy, services), integration tests (migration, REST API, monitoring, middleware), regression tests, build verification |
| 5. Handoff Summary | T-40 – T-42 | Rollback docs, manual review flags, final traceability audit |
Technical Notes¶
- All changes stay strictly within the Fax Tone/Send module boundary
- Cross-module consumers preserved via database views
- Critical path: T-01 → T-05 → T-06 → T-07 → model/service unification → controller/API work → testing
- Dependency graph is acyclic
Labels: ai-created, modernization, fax-tone-send, technical-debt, security
No data to display