Skip to content

Audit Phase 2: split files by concern so every module is under ~300 lines #178

Open

Description

@charliehuge

Umbrella for Phase 2 of the 2026-11-09 codebase audit. Details per item in docs/audit/2026-11-09/backlog.md §Phase 2 (branch claude/hopeful-fermi-cearzd); evidence in docs/audit/2026-11-09/detail/fundingcaptcha.md §3–4 and detail/showcontrol-core.md §3–4, which name every duplicated block by file:line and propose the module boundaries and public APIs. Do after Phases 0 and 1. Roughly 8–10 person-days, mostly mechanical. Break out into individual issues when picked up.

Goal

No production file over ~300 LOC. No logic duplicated across files. A small-context model can read one module and reason about it without the others.

Items

ID Task Effort Source
P2-01 Extract FundingCAPTCHA/settings.py, camera_feed.py, monitor.py, test_input.py, plugins.py from app.py. Kills the camera thread, monitoring server, settings loader, camera factory, and slab/ROI defaults each existing 2–7 times, and the private from app import _camera_thread in shader_app.py. Make code defaults equal the committed file M fundingcaptcha §3a–e, §4
P2-02 Collapse shader_app into playlist_app --setup; delete Rotation, shader_app.main, shaders/setups.json (duplicate Setup list); rename remainder shader_stage.py; split video_player.py S fundingcaptcha §3j–k
P2-03 shader_test_rig.py (ctx fixture, Rig, mask builders, GLSL-const reader, currently copied 5×) + public Renderer.read_buffer(); move test_<setup>.py into shaders/<setup>/ M fundingcaptcha §3l
P2-04 Prune layout-probing and half-float shader tests to spec-level behaviour (2,804 LOC → <1,500); input-contract tests into one test_shader_contracts.py; CI duration budget M fundingcaptcha §4 tests, §7
P2-05 Kiosk class with per-state ticks replaces the 350-line app.main() and its 15 loose locals; first tests of the show state machine L fundingcaptcha §4, §7
P2-06 Split bodycaptcha_editor.py (847) into editor/{levels_io,widgets,level_model,views}.py; shared levels.py with games/bodycaptcha.py; BodyCaptchaGame takes (w, h) so tests stop opening displays L fundingcaptcha §3i, §4
P2-07 games/grid.py → grid.py + shell.py (ADR-0019 wanted this) + blowup.py; tests for Grid, _LevelBag, blow-up path S fundingcaptcha §4, §7
P2-08 body_grid_tester.py (626): fold into app.py --tester or rebuild on P2-01 modules S fundingcaptcha §4
P2-09 ShowControl/ShowWeb/live.py LiveServer replaces the byte-identical WebSocket/log servers in FlowerBeds/visualizer.py and TreeHouse/visualizer.py; FlowerBeds 240-line HTML string → static file; shared Dashboard/log-panel.js M core §3a, §4
P2-10 OSCFabric/gate.py SignalGate; FabricClient and LocationSender become thin wrappers over it S core §3d
P2-11 FlowerBeds/main.py (454) → controllers.py, calibrate_motors.py, state.py, config.py; layout tool shares the controller module M core §3c, §4
P2-12 IIVision/blob_tracker.py (434) → types.py, calibration.py, detector.py; rename BlobTracker → BlobDetector; add tests for calibrate and detect (the production CV path has none) M core §4
P2-13 TreeHouse/coordinator.py → config.py, garden_state.py, branches.py with BranchController(Controllable) as ADR-0006 intended M core §4
P2-14 shadertoy.py → package (setup, body, keyboard, blobs_contract, renderer) S fundingcaptcha §4
P2-15 DEFAULTS + startup validation for captcha-settings.json (unknown keys currently silently dropped) S fundingcaptcha §5

Done when

  • git ls-files '*.py' | grep -v test_ | xargs wc -l | awk '$1>300' lists nothing but total.
  • grep -rn "from app import" ShowControl/FundingCAPTCHA is empty.
  • Both visualizers are under 60 lines of Python.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions