Aller au contenu

BC-064E — Legacy Application Final Audit & Certification

Status: HISTORICAL For the current architecture, see: ./dependances.md.

Status

BC-064E1 audit completed. BC-064E2 dead-code cleanup completed. BC-064E3 active ports migration completed for the simple legacy interfaces. BC-064E4 active legacy services rationalized with a canonical MerchantNormalizer source and the final M19 dead slice removed. BC-064E5 final certification completed for the remaining legacy EventPlatform / M12 / M17 / Projection / Realtime slice.

No plugin file changed. No runtime sync. No Composer change.

Scope

Legacy island audited:

  • namespace CMonChoix\Application\...
  • nested declarations under src/Application
  • one misplaced declaration under src/Infrastructure/Lock
  • imports, FQCN strings, autoloadability, plugin/runtime coupling, and serialization cues

Executive summary

The remaining CMonChoix\Application island is real, but it is less dangerous than its file count suggests.

What is proven after E5:

  • 29 PHP files still declare namespace CMonChoix\Application...
  • 10 files still import that namespace explicitly after E4
  • Composer does not autoload CMonChoix\Application\...
  • the WordPress plugin and runtime mirror do not import CMonChoix\Application\... directly
  • the island is therefore mostly an internal, partially disconnected legacy/prototype subtree
  • the only clearly active consumers are inside src/ itself
  • the remaining EventPlatform / M12 / M17 / Projection / Realtime classes are all either wrappers, contracts or orchestration shells with no safe mechanical migration left

This keeps the debt at P2, not P1:

  • no public runtime entrypoint imports the legacy namespace directly
  • no plugin bootstrap depends on it
  • no Composer alias or PSR-4 entry exposes it
  • no serialized CMonChoix\Application\... object persistence path was proven in production runtime

1. Inventory

Counts

Metric Value
Declared legacy namespace files 29
Explicit use CMonChoix\Application\... files 10
Direct plugin/runtime imports 0
Representative Composer-autoloadable legacy FQCNs 0

Result through E5

Migrated to canonical ports:

  • CMonChoix\Platform\Contracts\Event\EventStore
  • CMonChoix\Platform\Contracts\Queue\Queue
  • CMonChoix\Platform\Contracts\Event\EventDispatcher

Legacy wrappers kept for source compatibility:

  • CMonChoix\Application\Contracts\EventStoreInterface
  • CMonChoix\Application\Contracts\QueueInterface
  • CMonChoix\Application\Shared\Event\EventDispatcherInterface

Internal consumers migrated:

  • DatabaseEventStore
  • DatabaseQueue
  • SimpleEventDispatcher
  • AsyncWorkerRunner
  • WorkerOrchestrator
  • WorkerDaemon
  • ControlTower

Deferred intentionally and certified as residual P2 debt after E5:

  • Application\EventPlatform\*
  • Application\M12\*
  • Application\M17\EventBridge
  • Application\Projection\*
  • Application\Realtime\*

Inventory shape

The exhaustive path inventory is stored in:

  • tests/Architecture/fixtures/bc064e_legacy_application_debt.php

That manifest now distinguishes:

  • declared files
  • explicit import files
  • representative non-autoloadable FQCNs
  • active consumer map
  • dead candidates
  • serialization points
  • family grouping
  • E2/E3/E4/E5 priority slices
  • final certification inventory for the audited legacy families

2. Families

Family Classes Consumers Replacement Platform Risk
Catalog 5 internal only MerchantNormalizer canonicalized, ranking chain still legacy P2
Contracts / Shared Event 3 legacy wrappers + 3 canonical ports internal + infrastructure migrated in E3 P2 residual
EventPlatform + M12 + M17 8 internal only partial, but still legacy-named P2
Workers / Queue / Runtime / Realtime 15 mixed internal, many prototypes none proven P2/P3
Control / Projection / Product 9 mixed internal, some dead partial P2/P3

3. Consumers proven active

Active internal anchors

Legacy FQCN Consumer Mode Runtime entrypoint Critical
Application\Contracts\EventStoreInterface Infrastructure/M18/DatabaseEventStore.php implements none no
Application\Contracts\EventStoreInterface M20/Workers/AsyncWorkerRunner.php constructor none no
Application\Contracts\EventStoreInterface M21/Workers/WorkerOrchestrator.php constructor none no
Application\Contracts\EventStoreInterface Control/ControlTower.php constructor none no
Application\Contracts\QueueInterface Infrastructure/M23/PersistentQueue/DatabaseQueue.php implements none no
Application\Contracts\QueueInterface M24/Daemon/WorkerDaemon.php constructor none no
Application\Contracts\QueueInterface Control/ControlTower.php constructor none no
Application\Shared\Event\EventDispatcherInterface Infrastructure/Event/SimpleEventDispatcher.php implements none no
Application\Catalog\MerchantNormalizer Application\Catalog\MerchantNormalizer.php extends canonical wrapper none no
Application\EventPlatform\Bus\EventBus EventPlatform/Kernel/PlatformKernel.php constructor none no
Application\EventPlatform\Bus\EventBus M12/EventBus/EventBus.php extends none no
Application\EventPlatform\Bus\EventBus M17/EventBridge/EventBridge.php constructor none no
Application\Projection\EventSubscriberRegistry Realtime/RealtimeCatalogRebuilder.php constructor none no
Application\Realtime\RealtimeCatalogRebuilder Realtime/Async/AsyncWorker.php constructor none no

Important nuance

“Active” here means “consumed by another src/ file”.

It does not mean:

  • runtime-reachable from WordPress
  • Composer-autoloadable from the outside
  • safe to move without wrappers

4. Autoload conclusion

Composer currently exposes only:

  • CMonChoix\Platform\ => src/

Therefore representative legacy classes are not autoloadable through Composer:

FQCN Autoload
CMonChoix\Application\Contracts\EventStoreInterface missing
CMonChoix\Application\EventPlatform\Bus\EventBus missing
CMonChoix\Application\M12\EventBus\EventBus missing
CMonChoix\Application\M31\Infrastructure\Adapters\RedisLockAdapter missing

This is the single most important E1 finding.

The legacy island is not a normal public namespace tree. It survives mostly through:

  • intra-file inheritance
  • same-tree includes
  • compatibility wrappers
  • historical declarations still present on disk

5. Dead-code cleanup result

BC-064E2 removed the proven dead/prototype slice:

FQCN Why removable Status
Application\ReplayEngine isolated root prototype, no proven consumer removed
Application\Runtime\Buffer isolated utility, no proven consumer removed
Application\M22\Queue\QueueBroker in-memory prototype only removed
Application\M30\Distributed\DistributedCoordinator prototype only removed
Application\M32\EventBus\EventBus distributed prototype only removed
Application\M33\Consistency\ConsistencyEngine prototype only removed
Application\M34\Outbox\OutboxAndGlobalLog prototype only removed
Application\Product\ProductApplicationService explicitly deprecated/dead, no incoming consumer removed
Application\Projection\ProductProjectionHandler explicitly deprecated/dead, no incoming consumer removed
Application\M31\Infrastructure\Adapters\RedisLockAdapter misplaced + non-autoloaded + no consumer removed

E4 then removed the last explicitly documented dead candidate:

FQCN Why removable in E4 Status
Application\M19\Consolidation\EventStoreConsolidator no incoming consumer, no test dependency, no plugin/runtime coupling, no serialized usage removed

6. Reflection / serialization

Reflection-sensitive surfaces

  • interfaces in Application\Contracts\...
  • Application\Shared\Event\EventDispatcherInterface
  • Application\EventPlatform\Bus\EventBus
  • Application\EventPlatform\Kernel\PlatformKernel
  • M12 compatibility wrappers extending EventPlatform classes

Serialization / persistence cues

Only one legacy serialization hotspot was proven:

Legacy type Persisted Storage Risk Strategy
Application\M17\EventBridge\EventBridge yes, event type strings + payload arrays Infrastructure\M16\PersistentEventStore low migrate last, after ports/wrappers

No __PHP_Incomplete_Class usage was found. No plugin/runtime object cache storing CMonChoix\Application\... instances was proven.

7. Plugin/runtime coupling

Direct scan result:

Plugin file Legacy FQCN Context Active Migration risk
none none frontend/admin/CLI/HTTP/worker/cron/bootstrap no low

This confirms BC-064D’s earlier intuition:

  • the remaining island is a source-tree debt
  • not a WordPress adapter/runtime dependency

8. Safe strategies

Family Strategy Compatibility window Risk
Dead prototypes A — suppression directe short low
Legacy interfaces C — legacy interface extends canonical done in E3 low
MerchantNormalizer B — move canonical then wrapper done in E4 low
EventPlatform canonical legacy names B — move to Platform\... + wrappers medium medium
M12 wrappers F temporary, then remove short low
EventBridge serialization F temporary, migrate last medium medium

9. E5 final certification

Remaining audited legacy families

The E5 perimeter is exactly:

  • Application\EventPlatform\*
  • Application\M12\*
  • Application\M17\EventBridge
  • Application\Projection\*
  • Application\Realtime\*

Two files under src/Application/Projection/ are explicitly out of the legacy perimeter because they already declare namespace CMonChoix\Platform\...:

  • BuildProductCreatedEventFromProduct.php
  • CatalogProjectionWriter.php

Final classification

Family Nature Consumer proof E5 verdict
EventPlatform light orchestration + contracts internal only keep as certified P2 debt
M12 thin wrappers over EventPlatform internal only keep as certified compatibility debt
M17 EventBridge persistence + event::class + payload array internal only, serialization-sensitive keep as certified sensitive debt
Projection legacy wiring / registry / replay shell internal only keep as certified orchestration debt
Realtime queue/rebuilder orchestration internal only keep as certified orchestration debt

Reflection

E5 confirms:

  • no new class_alias() was added;
  • Composer still exposes only CMonChoix\Platform\ => src/;
  • autoload.files still contains only src/Support/LegacyProductNamespaceCompat.php;
  • the remaining legacy Application FQCNs are not Composer-autoloadable;
  • existing reflection compatibility tests still validate constructor/method/return-type continuity for the active compatibility wrappers.

Serialization

E5 confirms:

  • no serialize() / unserialize() / __serialize() / __unserialize() usage was added in the legacy Application island;
  • Application\M17\EventBridge\EventBridge remains the only documented legacy serialization-sensitive surface;
  • its sensitivity comes from persisted event::class strings and payload arrays sent to PersistentEventStore.

Plugin / runtime

E5 confirms:

  • no plugin file imports CMonChoix\Application\...;
  • no runtime mirror file imports CMonChoix\Application\...;
  • no runtime sync is required because BC-064E touched only src/, tests and documentation.

10. BC sequence recap

BC-064E2 — Dead code & exact duplicates

Closed.

  • removed only dead candidates proven in E1
  • added gates preventing their return
  • no runtime/plugin impact

BC-064E3 — Active ports / helpers / autoload-safe migration

Partially closed.

Done:

  • canonical replacements for EventStoreInterface, QueueInterface, EventDispatcherInterface
  • legacy wrappers kept via extends
  • internal consumers moved to canonical ports

Done:

  • MerchantNormalizer moved to Platform\Application\Normalization\MerchantNormalizer
  • legacy Application\Catalog\MerchantNormalizer retained as a thin wrapper
  • Application\M19\Consolidation\EventStoreConsolidator removed after dedicated no-usage proof

BC-064E5 — Final certification

  • autoload
  • reflection
  • serialization
  • docs
  • debt manifest closure

11. Decision

BC-064E5 is closed.

BC-064 is closed.

All P0/P1 items targeted by BC-064 are now treated.

The remaining debt is P2 only:

  • legacy EventPlatform / M12 wrappers
  • legacy EventBridge serialization-sensitive orchestration
  • legacy Projection / Realtime orchestration shells

Recommended follow-up:

  • open a separate BC (for example BC-065 EventPlatform / Realtime Legacy Retirement)
  • keep BC-064 closed and do not reopen it for cosmetic namespace cleanup alone