Type: Refactoring / Architecture
Guideline Match: "Refactor god-files into clean modules." / "Extend, don't duplicate. Design one shared interface."
Description:
tui_gateway/server.py is a god file: 13,905 lines on main (42708f8bb3). Repo-wide policy (2026-08): all god files are sharded, never reverted — the only correct answer is to shard the entire thing. Precedent: gateway/run.py (#54962) — sharding SHIPPED via 38 extraction PRs (all individually linked on the epic #78647). Nothing here is a request to revert, shrink-truncate, or abandon the file.
Proposed Changes:
- Graph-gated decomposition (gate 1 first): model the whole module (not pre-seeded clusters) with double-blind independent trees, merge to one typed graph under agreement provenance (≥4/5 agreed = load-bearing), then quality-gate the graph before any cut.
- One PR per clean cluster/mixin, in waves: byte-verbatim moves (docstrings, comments, exclusive constants), identity-preserving re-exports (
<module>.<name> stays green), Part of linkage to this issue, suite-green on current main before open.
- Zero behavior change. No reverts. Full shard or untouched — partial "just extract this one class" escapes are not the policy.
- Test contracts move with the code: monkeypatch/logger patch targets and source-scanning tests that read this file get their targets updated in the same extraction PR.
Tracking: consolidated under the repo-wide god-file epic (meta issue, created with this series).
Type: Refactoring / Architecture
Guideline Match: "Refactor god-files into clean modules." / "Extend, don't duplicate. Design one shared interface."
Description:
tui_gateway/server.pyis a god file: 13,905 lines onmain(42708f8bb3). Repo-wide policy (2026-08): all god files are sharded, never reverted — the only correct answer is to shard the entire thing. Precedent:gateway/run.py(#54962) — sharding SHIPPED via 38 extraction PRs (all individually linked on the epic #78647). Nothing here is a request to revert, shrink-truncate, or abandon the file.Proposed Changes:
<module>.<name>stays green),Part oflinkage to this issue, suite-green on current main before open.Tracking: consolidated under the repo-wide god-file epic (meta issue, created with this series).