Trim doc-heavy small methods in remote_build/controller.py#634
Merged
Conversation
User feedback (screenshot of ``_fire_offloader_pair_peer_revoked``): a 5-line typed-payload event-firer with an 11-line docstring explaining receiver-side REJECTED semantics. The signal-to-noise ratio on these small helpers was the actual readability problem. Reduced docstring on every method where the docstring was ≥5 lines AND ≥2× the body's code-line count. Each one collapses to a single-line summary; surrounding context that the caller already knows (receiver-side state machine, four-cause collapse, etc.) is gone since the caller's site is the right place for that context. Affected methods: * Event firers: ``_fire_offloader_pair_status_changed``, ``_fire_offloader_pair_pin_mismatch``, ``_fire_offloader_pair_peer_revoked``, ``_fire_pair_status_changed``. * Snapshot accessors: ``peer_queue_status_snapshot``, ``offloader_remote_jobs_snapshot``, ``pairings_snapshot``, ``peers_snapshot``, ``offloader_alerts_snapshot``, ``hosts_snapshot``, ``remote_builds_enabled_snapshot``, ``get_pairing``, ``approved_peer_label``. * Internal getters: ``get_submit_job_receiver``, ``get_artifacts_download_sender``. * Identity / settings WS commands: ``get_identity``, ``get_offloader_settings``. * Trivial helpers: ``_serialize_pairings``, ``_serialize_peers``, ``_schedule_pairings_save``, ``_close_peer_link_resolver``, ``_track_task``, ``_dismiss_offloader_alert``, ``_clear_pending_peers_on_window_close``, ``_commit_endpoint_rebind``, ``_respawn_peer_link_at_new_endpoint``, ``_upsert_host``, ``_spawn_pair_status_listener``, ``is_pairing_window_open``, ``_pairing_window_remaining``, ``_on_offloader_peer_link_closed``, ``_on_offloader_queue_status_changed``, ``_current_settings_view``, ``build_scheduler_snapshot``. ``controller.py``: 3186 → 2837 lines (−349). Prose-to-code ratio: 0.98 → 0.72. Behaviour preserving — no code lines changed. All 3117 tests pass.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #634 +/- ##
=======================================
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:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces verbosity in RemoteBuildController by trimming overlong docstrings on small, mostly self-explanatory helper methods, improving scan-ability of the remote-build controller without changing runtime behavior.
Changes:
- Collapses docstrings on many small helpers (event firers, snapshot accessors, internal getters, and trivial utilities) to shorter summaries.
- Removes receiver/offloader state-machine narrative from typed-payload “event firer” helpers and similar short wrappers.
- Keeps only concise intent-focused documentation where needed, reducing overall file size substantially.
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?
Your screenshot of
_fire_offloader_pair_peer_revokedwas thekey data point: a 5-line typed-payload event-firer with an
11-line docstring explaining receiver-side REJECTED semantics.
The signal-to-noise ratio on these small helpers was the actual
readability problem after the previous two trim passes.
Reduced the docstring on every method where the docstring was
≥5 lines AND ≥2× the body's code-line count. Each collapses
to a single-line summary; the surrounding context that the
caller already knows (receiver-side state machine, four-cause
collapse, etc.) is removed — that context belongs at the call
site, not on a typed-payload firer.
controller.py: 3186 → 2837 lines (−349).Prose-to-code ratio: 0.98 → 0.72.
Affected methods
_fire_offloader_pair_status_changed,_fire_offloader_pair_pin_mismatch,_fire_offloader_pair_peer_revoked,_fire_pair_status_changed.that had multi-paragraph docstrings):
peer_queue_status_snapshot,offloader_remote_jobs_snapshot,pairings_snapshot,peers_snapshot,offloader_alerts_snapshot,hosts_snapshot,remote_builds_enabled_snapshot,get_pairing,approved_peer_label.get_submit_job_receiver,get_artifacts_download_sender.get_identity,get_offloader_settings._serialize_pairings,_serialize_peers,_schedule_pairings_save,_close_peer_link_resolver,_track_task,_dismiss_offloader_alert,_clear_pending_peers_on_window_close,_commit_endpoint_rebind,_respawn_peer_link_at_new_endpoint,_upsert_host,_spawn_pair_status_listener,is_pairing_window_open,_pairing_window_remaining,_on_offloader_peer_link_closed,_on_offloader_queue_status_changed,_current_settings_view,build_scheduler_snapshot.Behaviour preservation
Strictly mechanical — no code lines changed; only docstring
lines removed. All 3117 tests pass.
Related issue or feature (if applicable):
3 specifically targets the small-method-bloated-docstring
problem the earlier passes left behind.
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.