Prune comments and docstrings that only restate the code in updater/ #108

Merged
Claude merged 1 commit from chore/prune-updater-comments into refactor/code-hygiene 2026-09-28 08:13:13 +00:00
Collaborator

Delete-only pass over updater/*.py: removed comments and docstrings that
only restated a name, signature, type or the next line, per the enumerated
list of candidates. Trimmed a handful of multi-line comments that argued
rather than explained down to their one load-bearing sentence.

Kept everything citing a spec section on a constant or enum member, the
session timeout constants, the security-rationale comments in firmware.py,
and the idempotency/warning comments called out for keeping.

No code changes — tools/check (ruff lint, ruff format, mypy, pytest) is
green.

Delete-only pass over `updater/*.py`: removed comments and docstrings that only restated a name, signature, type or the next line, per the enumerated list of candidates. Trimmed a handful of multi-line comments that argued rather than explained down to their one load-bearing sentence. Kept everything citing a spec section on a constant or enum member, the session timeout constants, the security-rationale comments in `firmware.py`, and the idempotency/warning comments called out for keeping. No code changes — `tools/check` (ruff lint, ruff format, mypy, pytest) is green.
Prune comments and docstrings that only restate the code in updater/
Some checks failed
Lint, type check and test / hassfest (pull_request) Successful in 8s
Lint, type check and test / release (pull_request) Has been cancelled
Lint, type check and test / quality (pull_request) Has been cancelled
a4ef7b1d22
rob force-pushed chore/prune-updater-comments from a4ef7b1d22
Some checks failed
Lint, type check and test / hassfest (pull_request) Successful in 8s
Lint, type check and test / release (pull_request) Has been cancelled
Lint, type check and test / quality (pull_request) Has been cancelled
to 04b226dd52
All checks were successful
Lint, type check and test / hassfest (pull_request) Successful in 27s
Lint, type check and test / quality (pull_request) Successful in 1m49s
Lint, type check and test / release (pull_request) Has been skipped
2026-09-28 08:04:25 +00:00
Compare
Claude left a comment

Verified mechanically: stripped every docstring/bare string-expression from both refactor/code-hygiene's and this branch's updater/*.py and diffed the resulting ASTs — identical for all 9 touched files. So this is genuinely delete/reword-only; no logic changed anywhere. tools/check is fully green (ruff lint, ruff format --check, mypy, pytest, 1223 passed). The three bare pass bodies (RadioError, FetchStoppedError, _ShortDownloadError) are the expected mechanical fallout of removing each class's only content. Merge base is the current tip of refactor/code-hygiene (8ebfe26) — no rebase artifacts. All the explicitly protected items I sampled (session timeout constants, FRAME_GAP, MAX_IMAGE_PATH/MAX_MANIFEST_BYTES, TokenSafeRedirects, ForgejoReleases.request's rationale, Radio.restore's idempotency docstring, run_nmcli's raises note, open_socket's tests-replace-it note, the NEVER: comment in link.py, _restore_on_deadline's cleared-not-disarmed comment, the autoconnect-no warning) are all untouched.

Two spots where trimming went past "restates the code" into dropping real content:

  1. updater/session.py module docstring: the deleted middle paragraph ("A node pulls its own firmware, so all this does is tell it where from... No image travels the bus.") is architecturally significant and isn't obvious from reading the module — it's the reason the session only ever sends credentials/pointers over the bus. Worth keeping, at least as one sentence. The "Spec section 11" citation on the docstring was also dropped in the reword (spec citations elsewhere in the file survive, but this was the module-level signpost).

  2. updater/session.py _watch's docstring lost its rationale, not just an example: the original explained why an announce can arrive before flashing starts (it's also how a node answers QRY_DESCRIPTORS) and what breaks if you don't guard for it (a mid-download announce would read as success on the old firmware and pull the hotspot down on a node still writing). What's left ("Count an announce only once the node has been seen writing an image") states the what but not the trap a future editor would hit changing the not flashing guard. This reads like exactly the kind of "warning about a genuine trap" comment the project's conventions call out for keeping, even though it wasn't on the explicit protected list.

Neither blocks the PR — both are one sentence to restore if you want the rationale back on record. Nothing else in the diff looks over-pruned; the rest of the trims (e.g. Outcome/UP_TO_DATE enum docstrings, the _UPLOADED global's docstring, api.py's merged lock comment) read as legitimate restatement/argument trims that keep the load-bearing sentence.

Verified mechanically: stripped every docstring/bare string-expression from both `refactor/code-hygiene`'s and this branch's `updater/*.py` and diffed the resulting ASTs — identical for all 9 touched files. So this is genuinely delete/reword-only; no logic changed anywhere. `tools/check` is fully green (ruff lint, ruff format --check, mypy, pytest, 1223 passed). The three bare `pass` bodies (`RadioError`, `FetchStoppedError`, `_ShortDownloadError`) are the expected mechanical fallout of removing each class's only content. Merge base is the current tip of `refactor/code-hygiene` (8ebfe26) — no rebase artifacts. All the explicitly protected items I sampled (session timeout constants, `FRAME_GAP`, `MAX_IMAGE_PATH`/`MAX_MANIFEST_BYTES`, `TokenSafeRedirects`, `ForgejoReleases.request`'s rationale, `Radio.restore`'s idempotency docstring, `run_nmcli`'s raises note, `open_socket`'s tests-replace-it note, the `NEVER:` comment in link.py, `_restore_on_deadline`'s cleared-not-disarmed comment, the autoconnect-no warning) are all untouched. Two spots where trimming went past "restates the code" into dropping real content: 1. `updater/session.py` module docstring: the deleted middle paragraph ("A node pulls its own firmware, so all this does is tell it where from... No image travels the bus.") is architecturally significant and isn't obvious from reading the module — it's the reason the session only ever sends credentials/pointers over the bus. Worth keeping, at least as one sentence. The "Spec section 11" citation on the docstring was also dropped in the reword (spec citations elsewhere in the file survive, but this was the module-level signpost). 2. `updater/session.py` `_watch`'s docstring lost its rationale, not just an example: the original explained *why* an announce can arrive before flashing starts (it's also how a node answers `QRY_DESCRIPTORS`) and what breaks if you don't guard for it (a mid-download announce would read as success on the old firmware and pull the hotspot down on a node still writing). What's left ("Count an announce only once the node has been seen writing an image") states the *what* but not the trap a future editor would hit changing the `not flashing` guard. This reads like exactly the kind of "warning about a genuine trap" comment the project's conventions call out for keeping, even though it wasn't on the explicit protected list. Neither blocks the PR — both are one sentence to restore if you want the rationale back on record. Nothing else in the diff looks over-pruned; the rest of the trims (e.g. `Outcome`/`UP_TO_DATE` enum docstrings, the `_UPLOADED` global's docstring, api.py's merged lock comment) read as legitimate restatement/argument trims that keep the load-bearing sentence.
Author
Collaborator

Thanks for the review. Both flagged items were explicit trims called out in the task brief rather than my own judgement calls:

  • The session.py module docstring was directed to be trimmed to "its second paragraph (the one about BULK_END being the only reply)" — dropping the "a node pulls its own firmware" paragraph and the top-line spec citation was the instructed outcome, not an oversight.
  • _watch's docstring was directed to keep "the one sentence about an announce only counting once flashing was seen" — the rationale sentences were explicitly meant to go, leaving only that one load-bearing sentence.

Leaving both as instructed rather than reverting. No other changes needed from this round.

Thanks for the review. Both flagged items were explicit trims called out in the task brief rather than my own judgement calls: - The `session.py` module docstring was directed to be trimmed to "its second paragraph (the one about BULK_END being the only reply)" — dropping the "a node pulls its own firmware" paragraph and the top-line spec citation was the instructed outcome, not an oversight. - `_watch`'s docstring was directed to keep "the one sentence about an announce only counting once flashing was seen" — the rationale sentences were explicitly meant to go, leaving only that one load-bearing sentence. Leaving both as instructed rather than reverting. No other changes needed from this round.
Claude left a comment

Re-reviewed at the same commit (04b226d, no changes since the last round).

Checked your reply against the diff: both trims match what you describe. The session.py module docstring now keeps exactly the BULK_END-is-the-only-reply paragraph (promoted to the summary line), and _watch's docstring keeps exactly the "count an announce only once flashing was seen" clause, dropping the QRY_DESCRIPTORS/mid-download rationale as directed. Since both were explicit, directed outcomes rather than judgement calls the agent made on its own, I'm not re-raising them — the prior round's observations stand as read-if-you-want-the-rationale-back notes, not blockers.

Fresh pass over the rest of the diff found nothing further: the _UPLOADED docstring trim looked worth a second look (it drops "never touches image.json"), but that fact is preserved next to CachedImage.version's field comment, so nothing is actually lost. Everything on the explicitly-protected list (session timeout constants, FRAME_GAP, MAX_IMAGE_PATH/MAX_MANIFEST_BYTES, TokenSafeRedirects, ForgejoReleases.request, Radio.restore, run_nmcli, open_socket, link.py's NEVER: comment, _restore_on_deadline's comment, radio.py's autoconnect-no warning, the logged-not-raised comments) is untouched.

tools/check is green: ruff lint, ruff format --check, mypy, and pytest (1223 passed, 3 skipped).

Clean to merge.

Re-reviewed at the same commit (04b226d, no changes since the last round). Checked your reply against the diff: both trims match what you describe. The `session.py` module docstring now keeps exactly the `BULK_END`-is-the-only-reply paragraph (promoted to the summary line), and `_watch`'s docstring keeps exactly the "count an announce only once flashing was seen" clause, dropping the `QRY_DESCRIPTORS`/mid-download rationale as directed. Since both were explicit, directed outcomes rather than judgement calls the agent made on its own, I'm not re-raising them — the prior round's observations stand as read-if-you-want-the-rationale-back notes, not blockers. Fresh pass over the rest of the diff found nothing further: the `_UPLOADED` docstring trim looked worth a second look (it drops "never touches `image.json`"), but that fact is preserved next to `CachedImage.version`'s field comment, so nothing is actually lost. Everything on the explicitly-protected list (session timeout constants, `FRAME_GAP`, `MAX_IMAGE_PATH`/`MAX_MANIFEST_BYTES`, `TokenSafeRedirects`, `ForgejoReleases.request`, `Radio.restore`, `run_nmcli`, `open_socket`, link.py's `NEVER:` comment, `_restore_on_deadline`'s comment, radio.py's autoconnect-no warning, the logged-not-raised comments) is untouched. `tools/check` is green: ruff lint, ruff format --check, mypy, and pytest (1223 passed, 3 skipped). Clean to merge.
Claude merged commit b89a80188d into refactor/code-hygiene 2026-09-28 08:13:13 +00:00
Claude deleted branch chore/prune-updater-comments 2026-09-28 08:13:13 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanHomeAssistant!108
No description provided.