Trim remote_build_layout.py prose (275 → 122 lines)#643
Merged
Conversation
The module had a 47-line module docstring, an 89-line ``data_dir`` method docstring, and constant-block comments that paraphrased what the values already say. Per CLAUDE.md: consumer-facing, no padding with rationale. * Module docstring: layout shape + a one-sentence pointer at the three accessors. The three-consumer enumeration and "why a shared module" rationale belong in commit history, not the header. * ``data_dir``: dropped the per-mode walk-through (default / addon / env override — same fallback chain documented on ``CORE.data_dir`` itself), the "why pin ESPHOME_DATA_DIR" section (paraphrase of the per-dashboard isolation point), and the cleanup-asymmetry follow-up note (belongs in an issue, not a docstring). Kept: the actual returned path shape, the per-dashboard scope rationale (two non-obvious reasons: toolchain warmth + #578 basename-collision isolation), and the split-from-subtree pointer. * ``subtree`` / ``bundle``: dropped consumer enumerations. * Constants: stripped down to the non-obvious bit each one carries. * ``parse_from_configuration``: dropped the inline reverse-engineering of the layout shape; the function body shows it. 3176 tests pass, ruff + mypy clean.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #643 +/- ##
==========================================
+ Coverage 99.22% 99.24% +0.01%
==========================================
Files 103 103
Lines 11097 11097
==========================================
+ Hits 11011 11013 +2
+ Misses 86 84 -2
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 trims documentation in helpers/remote_build_layout.py to reduce large docstrings/comments while keeping the file as the canonical description of the receiver-side remote-build on-disk layout.
Changes:
- Replaced the long module docstring with a shorter description of the remote-build layout and the
RemoteBuildPath/parse_from_configurationentry points. - Shortened docstrings for
RemoteBuildPath.subtree(),.bundle(),.data_dir(), andparse_from_configuration(). - Reduced module-level constant comments to focus on only the non-obvious details.
* ``REMOTE_BUILDS_SUBDIR`` comment said the extract lives "adjacent to StorageJSON / build dirs" — true on default installs but false on HA-addon mode where StorageJSON + build dirs live under /data (``CORE.data_dir``) while the extract sits under ``/config/esphome/.esphome/``. Reworded to focus on the actual invariant: the extract stays out of the top-level config dir. * ``data_dir`` docstring said "sibling to :meth:`subtree`", which conflates the two paths' roots. They share the ``<dashboard_id>`` partition but different roots (``subtree`` on config_dir, ``data_dir`` on ``CORE.data_dir``) — same on default installs, divergent on the addon. Reworded to spell out the split-root relationship.
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?
remote_build_layout.pyhad a 47-line module docstring, an89-line
data_dirmethod docstring, and constant-blockcomments that paraphrased what the values already convey. Per
CLAUDE.md's docstring rule: consumer-facing, no padding with
rationale. Trim aggressively.
275 → 122 lines (−55%), zero code changes.
What was cut
(it's a one-line pointer to the accessors now) and the
"why a shared module" rationale. That argument belongs in
the commit history of the module's introduction, not in
every read of the file.
data_dir: dropped the per-mode walk-through (default /addon /
ESPHOME_DATA_DIRenv override — same fallbackchain documented on
CORE.data_dir), the "why pinESPHOME_DATA_DIRat all" section (paraphrase of theper-dashboard isolation point made elsewhere), and the
cleanup-asymmetry follow-up note (belongs in an issue, not
a docstring readers hit on every IDE hover).
subtree/bundle: dropped the per-consumerenumeration. The path each returns is self-evident from
the body.
non-obvious bit (the leading-dot hides it from
ls; thePOSIX parts are pre-split because configuration paths are
forward-slash on every platform; the bundle is outside the
extract target because of
prepare_bundle_for_compile).parse_from_configuration: dropped the reverse-engineeringof the layout shape inside the docstring; the function body
shows it directly.
What stayed
The non-obvious why's that don't have an obvious home
elsewhere:
data_dir's per-dashboard scope: toolchain warmth acrosssubmits + Isolate receiver-side remote builds under per-build ESPHOME_DATA_DIR #578 basename-collision isolation.
data_dirlives underCORE.data_dirrather thanconfig_dir: the multi-GB artefacts belong on/data(theaddon's per-instance volume), not the user's
/configHAmount.
BUNDLE_SUFFIX's "sibling, not child" placement vs theupstream pre-extract wipe (PR Fix Bundle file not found on every remote-build submit #552).
Behaviour preservation
Docstring + comment edits only — zero functional changes.
3176 tests pass; ruff + mypy clean.
Related issue or feature (if applicable):
is the same author's pass on a single file flagged for the
same "text wall" issue.
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.