Trim controller.py prose: 4594 → 3723 lines (−871)#630
Merged
Conversation
The file was 67% prose by line count — overlong docstrings and inline-comment paragraphs that paraphrased the code or recapped design history rather than flagging non-obvious behaviour. Trimmed every docstring / comment block that read as a wall-of-text on first scan; kept the WHY-style notes (hidden invariants, surprising orderings, post-fix bug references) per CLAUDE.md's comment-style rule. Concretely: the module docstring drops from 48 → 18 lines; ``request_pair``, ``submit_job``, ``download_artifacts``, ``unpair``, ``edit_pairing_endpoint``, ``record_pair_request``, ``set_pairing_window``, ``rotate_identity``, ``lookup_peer_for_status``, ``set_settings``, ``set_offloader_settings``, ``set_pairing_enabled`` all lose their args/returns/raises walls (the type signatures already carry the contract) and their multi-paragraph "design rationale" tails. Several ``__init__`` attribute-explainer comment blocks drop from 15-20 lines to 4-8. Net: prose-to-code ratio drops from 67% → 57%. Behaviour preserved — no code lines changed; only comment and docstring lines removed. All 3117 tests pass; ruff / codespell clean.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #630 +/- ##
=======================================
Coverage 99.21% 99.21%
=======================================
Files 90 90
Lines 10757 10757
=======================================
Hits 10673 10673
Misses 84 84
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix?
controllers/remote_build/controller.pywas 67% prose by linecount — overlong docstrings and inline-comment paragraphs that
paraphrased the code or recapped design history rather than
flagging non-obvious behaviour. The file read as a wall of text
that made it hard to scan for the actual logic.
Trimmed every docstring / comment block that paraphrased what
the code already says; kept the WHY-style notes (hidden
invariants, surprising orderings, post-fix bug references) per
CLAUDE.md's comment-style rule.
controller.py: 4594 → 3723 lines (−871, −19%).Prose-to-code ratio: 67% → 57%.
Concretely
summary; dropped the "Manual hosts have no version /
fingerprint resolution yet…" historical note and the
long-form
enabled-flag explanation).request_pair,submit_job,download_artifacts,unpair,edit_pairing_endpoint,record_pair_request,set_pairing_window,rotate_identity,lookup_peer_for_status,set_settings,set_offloader_settings,set_pairing_enabled) all lose their Args/Returns/Raiseswalls. The type signatures already carry that contract; the
trimmed docstring keeps the behaviour summary + any
non-obvious caveats.
__init__attribute-explainer comments drop from 15-20lines down to 4-8 each (the
_pairings,_peer_link_clients,_pending_peers,_approved_peers,_open_peer_links,_offloader_alerts,_peer_queue_status,_offloader_remote_jobs,_pairing_window_clients,_pair_status_listeners,_listenersblocks)._probe_pairing_endpoint,_probe_and_rebind_endpoint,_apply_pair_status_result,_lookup_open_peer_link_client,_validate_submit_job_config,_build_submit_job_bundle,_upsert_host,_sweep_stale_pairings_at_endpoint,peers_snapshot,pairings_snapshot,offloader_alerts_snapshot,build_scheduler_snapshot,_peer_summaries,_on_offloader_peer_link_opened) trimmedsimilarly.
block in
record_pair_request, the 15-line listener-attachrationale at the top of
start, the 13-line queue-statuspush explanation in
register_peer_link_session) reduced tothe one or two sentences a future reader actually needs.
Behaviour preservation
No code lines changed; only comment and docstring lines
removed. All 3117 tests pass. Ruff + codespell clean.
Related issue or feature (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocsmaintenancecidependenciesFrontend coordination
Checklist
ruff,codespell, yaml/json/python checks).tests/where applicable.components.jsonhas not been hand-edited (regenerate viascript/sync_components.pyif a sync is needed).docs/ARCHITECTURE.mdand/ordocs/API.md.