Skip to content

Comment rules, /refactor:tidy-comments, and a first tidy of BoxProvisioning - #4590

Merged
iancooper merged 6 commits into
masterfrom
tidy-comments
Oct 11, 2026
Merged

iancooper merged 6 commits into
masterfrom
tidy-comments

Conversation

@iancooper

Copy link
Copy Markdown
Member

Why

Comments written by agents have been creeping into method bodies: about 1,100 // lines were added to src/ between 1 September and 11 October, many carrying spec or issue numbers, change history or notes to a reviewer. The rules about where comments go were spread across documentation.md and code_style.md, partly contradicted each other, and were missing from the skills agents actually work from.

What

The rule — .agent_instructions/documentation.md gains a Comments in Code section, which is now the single statement of the rule:

  • /// XML documentation on public and protected members of public types only. <summary>, <param> and so on say how to use the API; <remarks> holds notes to the user.
  • On anything else, at most a // or /* */ comment above the signature, when the method is complex or guards against a trap.
  • No comments inside method bodies, as a rule. Use Extract Method to express intent instead. The exceptions are //Arrange //Act //Assert, the reason on an analyser suppression, and a rare one-line trap that cannot be extracted.
  • No issue, PR or spec references, no change history, no notes to a reviewer. Commented-out code is deleted.

code_style.md and CONTRIBUTING.md now align with it, and /test-first, /spec:implement, /spec:ralph-implement, /tidy-first, /bugfix:fix and /spec:review all carry it.

The skill — /refactor:tidy-comments [ref | range] [path...] gives each comment in a unit of work one action: keep, delete, strip a reference, trim, move above the signature, convert /// to //, or replace with Extract Method/Variable. It applies them as a comment-only refactor: commit and then an extraction refactor: commit, with tests unedited and no public signature changed. Rationale missing from an ADR goes to the user, not the bin. It also reports comments that were written instead of a refactoring ("must be called first", "can be null when…") and schedules them. A large scope is sliced per project and the queue is tracked in PROMPT.md.

First slice — src/Paramore.Brighter.BoxProvisioning, from the PR #4039 merge (83e0e5e47):

  • ADR 0058 records two decisions that only lived in comments: why provisioners within a group run in whatever order DI resolves them, and why pre-lock detection and payload validation share one connection.
  • A comment-only pass across 9 files (net −72 lines).
  • Ten private methods replace explanatory comments in SqlBoxMigrationRunner.MigrateAsync, SqlBoxProvisioner.ProvisionAsync and UseBoxProvisioning, e.g. GuardIdentifiers, RollbackWithoutMaskingAsync, ReleaseAsync, ReadHistoryExistsHintAsync, RegisterProvisionersThenMarker. Comments inside method bodies in this package go from 116 lines to none.

Two refactorings the comments had been papering over are filed rather than done here: #4588 (static ApplicationLogging logger in SqlBoxProvisioner) and #4589 (SchemaName conversion from a null or empty string yields a non-null SchemaName).

Testing

  • No behaviour change, and no public or protected signature changed.
  • Paramore.Brighter.BoxProvisioning.Tests: 111/111 passing on net9.0 and net10.0, before and after, with no test edited.
  • Paramore.Brighter.Sqlite.Tests --filter BoxProvisioning: 66/66 passing on net9.0 and net10.0, before and after.
  • The package builds with 0 warnings.
  • The MSSQL, PostgreSQL, MySQL and Spanner box-provisioning tests were not run locally (they need containers); CI covers them.

Next

The remaining slices (the BoxProvisioning backends, the rest of src/, then tests/) follow as separate PRs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7

iancooper and others added 5 commits October 11, 2026 19:43
documentation.md gains a "Comments in Code" section: XML docs on public
members only, at most a comment above the signature elsewhere, none inside
method bodies, and no issue/spec references, history or reviewer notes.
code_style.md and CONTRIBUTING.md now align with it, and the authoring and
review skills carry the rule. /refactor:tidy-comments applies it to a unit
of work and reports comments that side-stepped a refactoring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7
…R 0058

Moves the reasoning from inline comments in BoxProvisioningHostedService and
SqlBoxProvisioner into the ADR, ahead of tidying those comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7
Delete comments that narrate code or record change history, strip spec,
issue and PR references, convert XML docs on a private method to a //
comment, and move the span-tag and pre-lock-hint rationale above the
signatures of the methods they explain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7
Replace explanatory comments in SqlBoxMigrationRunner.MigrateAsync,
SqlBoxProvisioner.ProvisionAsync and UseBoxProvisioning with private
methods whose names carry the intent (GuardIdentifiers, GetMigrations,
RollbackWithoutMaskingAsync, ReleaseAsync, ReadHistoryExistsHintAsync,
RegisterProvisionersThenMarker, ...), keeping a short comment above a
signature only where the name cannot carry a trap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7
…old ranges

Size the scope before reading it and propose one-project slices, named as
'<range> <path>' commands; tidy files as they are now when a range is old,
marking comments added after it for the user to include or not; track the
slice queue in PROMPT.md; add 'file a GitHub issue' to Phase 5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsKD52dnGHFLSEr93VZyR7
@iancooper
iancooper merged commit 6a08e09 into master Oct 11, 2026
32 checks passed
@iancooper
iancooper deleted the tidy-comments branch October 11, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant