Skip to content

Fix Ruff's docstring findings (D) - #63

Merged
anth-volk merged 3 commits into
mainfrom
claude/ruff-docstrings
Nov 2, 2026
Merged

anth-volk merged 3 commits into
mainfrom
claude/ruff-docstrings

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #62

Part of #53.

What this does

The second of the pull requests stacked on #55 that fix the Ruff findings #55 leaves ignored: the 458 findings in D (pydocstyle), after which pyproject.toml no longer ignores the family. Stacked on #58. Only docstrings change.

  • D209 (58) and D202 (40): Ruff's fixes put closing quotes on their own line and remove the blank line after a function's docstring.
  • D102 (110), D103 (44), D107 (31), D101 (14), D105 (10): new docstrings for the public methods, functions, __init__ methods, classes and magic methods that had none. Each was written from the code it describes: what it returns or changes, and the errors it raises where that matters. In tests, D1 is exempt, as in both services, so these are all in src, packages, scripts, tools and the root conftest.py.
  • D401 (81), D205 (69), D404 (1): summaries. Each summary is now one sentence in the imperative mood on the first line, and the rest of the old docstring is kept as its description. Test docstrings that began with only a review reference keep that text in full as the description, under a summary that says what the test checks.
  • Two placeholder bodies go. In BuildCompleted (the interface's telemetry commands) the docstring replaces pass, and in the Orrery GraphTransport protocol it replaces ..., since Ruff's PIE790 flags a placeholder next to a docstring. The host's ServiceModule and the telemetry Transport protocols keep their ... bodies after the new docstrings, which Ruff accepts.
  • One description is reworded: default_handover_database_path in the interface package said "spool database"; it now says "event queue file", as the emitter's documentation calls it.
  • Ruff no longer ignores D. Every summary fits on the first line; D401 checks the mood of function and method summaries only, so class, property and module summaries may be descriptive phrases.

Four helper agents wrote the docstrings, one per area (the interface package; the Hugging Face, submissions and Orrery services; core, host and telemetry; tests, scripts and tools), from one brief. I checked their work as a whole: see the record below.

Test-first record

There is no red step, since nothing changes behaviour.

Commit Result
fbc62d2 The docstrings ruff check . and ruff format --check . pass with D selected (except D203 and D213, as in both services). All five guards pass with GITHUB_BASE_REF=main. With docstrings and placeholder bodies removed, the syntax tree of each of the 84 changed modules is identical to the base branch's, so no code, import, name or comment changed.
f667e59, 159f95f Merges of #55's round 2 and #58's round 1 ruff check . and ruff format --check . pass; the merged code needed no new docstrings.

Review round 1:

Commit Result
0b3475a Docstring corrections The interface's transition_stage and StageTransition now say how each status is handled: an update for another stage finishes the current one, only a start makes a stage current, and completed or failed ends the current stage. The calibration methods, in the interface and the emitter client, say that only calibration_epoch events are recorded, and that the move to the calibrating stage happens only when the run is not there already. Four smaller corrections; the fragment says only function and method summaries are imperative. ruff check . and ruff format --check . pass; with docstrings removed, the 6 changed modules match the previous head.

No test was run: the only changes to test files are docstrings, which the syntax-tree comparison shows. CI runs the tests.

CI

No workflow, trigger or script changes, and no environment variable or secret is read differently.

Release

The fragment is changelog.d/ruff-docstrings.changed.md, a patch bump: merging releases the next patch version of both distributions, whose docstrings change.

🤖 Generated with Claude Code

@anth-volk
anth-volk added this pull request to stack #46 October 30, 2026 18:03
@anth-volk anth-volk changed the title claude/ruff docstrings Fix Ruff's docstring findings (D) Oct 30, 2026
@anth-volk
anth-volk removed this pull request from stack #46 November 2, 2026 14:03
@anth-volk
anth-volk added this pull request to stack #72 November 2, 2026 14:04
@anth-volk
anth-volk force-pushed the claude/ruff-docstrings branch 2 times, most recently from 3615de5 to e0b0a06 Compare November 2, 2026 15:07
Base automatically changed from claude/ruff-exceptions to main November 2, 2026 16:49
anth-volk and others added 2 commits November 2, 2026 20:49
- D209 and D202: Ruff's fixes put closing quotes on their own line and
  remove blank lines after function docstrings.
- D101, D102, D103, D105 and D107: docstrings for the public classes,
  methods, functions, magic methods and __init__ methods that had none,
  describing what the code does.
- D205, D401 and D404: one-sentence summaries in the imperative mood on
  the first line, with the rest of each docstring kept as its
  description.
- Two docstrings replace a placeholder body (`pass` in BuildCompleted,
  `...` in GraphTransport's methods), which PIE790 would otherwise flag.
  With docstrings removed, every changed module's syntax tree matches
  the base branch's.
- Ruff no longer ignores D.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…les them

- TelemetryRecorder.transition_stage and StageTransition (interface):
  how each status is mapped, that an update for another stage finishes
  the current one first, that only a start makes a stage current (and is
  recorded as progress for the current stage), and that completed or
  failed ends the current stage.
- calibration_progress and transition_calibration_progress (interface
  and emitter client): the service records only calibration_epoch
  events, moves to the calibrating stage only when the run is not there
  already, and the call returns True for an ignored event too.
- GraphPublicationDelivery.__init__ names the three accepted local
  hosts; CollectorSession.invalidate gives the answers that come before
  token_rejected; StageDatasetBundle refuses a whitespace-only commit
  message; HuggingFaceSettings calls the file the event queue file.
- The changelog fragment says only function and method summaries are
  imperative, as D401 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the claude/ruff-docstrings branch from e0b0a06 to c3b68de Compare November 2, 2026 16:49
anth-volk added a commit that referenced this pull request Nov 2, 2026
#63 to #69 were rebased onto main after #58 merged, so this merge
conflicted in the 14 files this branch had changed on top of #69. Each
keeps this branch's side, plus the release's version bump in
pyproject.toml; python -m scripts.rules render left the rules views as
they were. The tree differs from 8776389 exactly by main's release
(ff7d34b..a837a06).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk marked this pull request as ready for review November 2, 2026 17:47
@anth-volk
anth-volk merged commit a16d849 into main Nov 2, 2026
12 checks passed
@anth-volk
anth-volk deleted the claude/ruff-docstrings branch November 2, 2026 17:47
anth-volk added a commit that referenced this pull request Nov 3, 2026
#65 to #69 were rebased onto main after #63 merged, so this merge
conflicted in the 13 files this branch had changed on top of #69. Each
keeps this branch's side, plus the release's version bump in
pyproject.toml; python -m scripts.rules render left the rules views as
they were. The tree differs from 746e71e exactly by main's release
(213b093..ed06bc2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Ruff's docstring findings (D)

1 participant