5# OCT-LINT: disable=tests_exist reason="Re-export shim; the module it names is covered by oc_orchestrator/tests/, and this path by test_272_hub_shims.py"
6"""
7The hub's contract. — moved to :mod:`oc_orchestrator.hub`.
8
9Purpose
10-------
11Plan 272 P4, in the shape plans 270 and 271 established. This module's
12code now lives in the standalone ``oc_orchestrator`` package; this file
13keeps ``oc_chat.core.hub`` working for every importer that has always
14spelled it that way.
15
16It is a REBINDING, not a wrapper: the last statement replaces this
17module's entry in :data:`sys.modules` with the moved module itself, so
18``oc_chat.core.hub`` and ``oc_orchestrator.hub`` are one object. That is
19what keeps every private name reachable, every ``monkeypatch`` effective
20across the seam, and every ``isinstance`` true — a wrapper that merely
21re-exported public names would break all three quietly. The concrete
22reason here is narrower than the queue's but no weaker: ``core/hub_bus``
23and ``registry/hub_log`` build :class:`HubMessage` and
24:class:`HubEntry` objects that the moved ``Hub`` then handles, and
25``tests/unit/test_259_dispatch_hooks.py`` reaches the file log through
26THIS path while the hooks it drives reach it through the package's.
27Two bindings would make those ``isinstance`` checks answer differently
28depending on which import a caller happened to use.
29
30Responsibilities
31----------------
32- Bind the moved module to this path. Nothing else: no behaviour, no
33 defaults, no wiring. ``scripts/hub_manage.py`` is the shim that carries
34 oc_chat's wiring, because only it has defaults — the program name and
35 the registry log factory — that differ from the package's.
36
37Diagnostics
38-----------
39Domain: OC_CHAT.MAIN
40Levels:
41 L2 - lifecycle events
42 L3 - semantic details
43 L4 - deep tracing (the rebinding)
44
45Contracts
46---------
47- Retirement rule (plan 272 P4, the plan-270 rule carried forward): this
48 path stays until an explicit retirement plan retargets its importers.
49 Nothing new should import it — new code names ``oc_orchestrator.hub``
50 directly.
51- Adds no behaviour of its own, so it can never drift from the module
52 it names.
53
54Dependencies
55------------
56- oc_diagnostics (structured debug logging via _dbg)
57- oc_orchestrator.hub (the moved module this path binds)