Skip to content

refactor(tui): extract pet payload into tui_gateway/pet_payload (server.py god-file slice R3) - #79261

Open
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/tui-pet-payload-extract
Open

refactor(tui): extract pet payload into tui_gateway/pet_payload (server.py god-file slice R3)#79261
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/tui-pet-payload-extract

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

tui_gateway/server.py god-file slice R3: extract the pet-payload/spritesheet cluster from tui_gateway/server.py into tui_gateway/pet_payload.py. Part of the repo-wide large-file decomposition (tracker #78647).

What changed and why

  • Pet-payload cluster (window 7989–8282, 294 lines, 23 members — 17 defs + 6 state slots, golden sha 99120f35…) → tui_gateway/pet_payload.py
  • Only external module ref is loggerzero _emit/_sessions/_block coupling (the cleanest slice in the region)
  • server.py re-exports all 23 identity-preserving; zero methods_*.py edits
  • Imports only stdlib → no cycle risk
  • _content_display_text dedup (@6698/@7044) deliberately OUT OF SCOPE (deferred to the wave-2 projection extraction)
  • Double-blind: 2 analysts → consensus (23 members, golden sha re-verified independently) → implementer → 2 blind re-reviewers (both APPROVED)

Testing

  • Baseline 12 pet tests + 1 billing test pass before AND after extraction (byte-identical behavior)
  • 34 new seam/unit tests pass (test_pet_payload_extract.py) — 47 total green
  • Module body byte-identical to the pinned window (verified programmatically, modulo header/logger)
  • Golden sha 99120f354c… matches at original pin AND current HEAD
  • ruff clean · git diff --check clean · LF-only · DCO signed

Coordination / interlock

Part of #78647
Part of #78630

…er.py god-file slice R3)

Extract the pet payload/spritesheet cluster (window 7989-8282, 23 members:
17 functions + 6 module-state slots) from tui_gateway/server.py into
tui_gateway/pet_payload.py, byte-verbatim, per the R3 consensus (epic
NousResearch#78647, target NousResearch#78630).

server.py now re-exports all 23 names identity-preserving, so bare-name
consumers (HandlerRegistry-installed pet handlers, the R1 pet.changed
watcher, test monkeypatches) keep resolving through the server namespace
unchanged. Zero methods_*.py edits.

Verified: golden sha 99120f35... of the moved span matches the pinned
window; 12 baseline pet tests + 1 billing test unchanged-green; 34 new
seam-identity + unit tests added (test_pet_payload_extract.py).

Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Aug 5, 2026
@andrexibiza

Copy link
Copy Markdown
Contributor Author

🔒 This shard is part of the tui_gateway/server.py KILL LOCK — the permanent record of the 13,908-line whole, the mess it caused (#60654 WS-frame stalls/frozen desktop, #60800 cold-start stalls, #33503 shell injection, #76285 board-slug validation, #76701 SessionDB abandonment, FIPS crashes), every shard in the wave, and every open fixer PR still fighting the surface (#72370 #76366 #67628 #58339 #77391 #66874 #77745 #72231 #62598 #33503 #74408 #74350 #65192 #77860 #76298 #78036 #74701 #72295 #73800 #76131 #68468 #51596 #53373 #76701 #70226).

Lock: posted on #78630 · Indexed by the Kill All Gods meta-issue #78647.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants