Skip to content

CTC Analysis

Generated from production code/runtime analysis. This file is historical reference; source-of-truth rules live in .agents/rules/.

Strengths

Area Current state Value
Multi-tenancy CLIENT_ID scoped tables Can support SaaS-style tenants.
API pattern TYPE/ACTION Consistent enough to route by module.
Domain helpers Query/post helpers by domain Existing logical seams can become module boundaries.
Audit KJDatabase mutation snapshots Operational debugging and accountability.
Sync OrderSyncService Cross-entity consistency mechanism exists.
Menu T_MENU, roles, default menu Can connect to module page registry.

Main Bottlenecks

Bottleneck Impact
Large shared files High merge/regression risk.
Shared controllers include many domains Namespace/load coupling.
Tenant-specific logic in shared paths Harder to sell/configure as SaaS.
Legacy popup/table patterns Wide frontend impact for small changes.
Hardcoded settings Tenant onboarding requires code edits.

Current CTC Operating Center

  • Office export hub combines transload, booking, equipment, files, and status work.
  • Mobile driver execution updates delivery/equipment status.
  • Appointment/transload execution coordinates dock, loader, and warehouse flow.
  • Yard map and dispatch queue own physical yard coordination.
  • Billing/scale/reporting complete operational back office flow.

Module Mapping

Product module Current code/data
Platform auth/menu login.php, T_USER, T_ROLE, T_MENU
YMS yard map yard-map, T_YARD_LOCATION
YMS yard move dispatch queue and move/reserve handlers
TMS transload T_TRANSLOAD, T_LOADING_PLANNER, appointment screens
TMS delivery T_DELIVERY, driver pages
OMS/WMS/BMS MK migration work around T_LOAD, inventory, rates, tickets
Add-ons Gmail, Telegram, AI extraction, reports

Runtime Evidence Summary

  • Actual traffic confirms query.php, post.php, and jTable remain important shared entrypoints.
  • Module direct endpoints should be added and verified before removing shared branches.
  • Page shell rendering and AJAX behavior both need module-disabled checks.

Migration Implications

  • Guardrails must be added before removing shared controller code.
  • Direct endpoint pilots should be validated with enabled/disabled tenant cases.
  • Helper cleanup should remove wrapper names, not add compatibility aliases.
  • Docs should point to .agents/rules/ instead of historical analysis.

Sources

  • Current rules: .agents/rules/ARCHITECTURE.md, API_CONTRACTS.md, DB_SCHEMA.md
  • Product target: docs/PRODUCT.md; target design: docs/DESIGN.md
  • Current migration status: .agents/rules/API_V2_CONTRACT_INVENTORY.md
  • Future migration order: docs/ROADMAP.md P2/P5/P7 Tasks

---

Source: .agents/reference/CTC_ANALYSIS.md — ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.