Skip to content

docs: state what the code does, not what it replaced - #68

Merged
noahbclarkson merged 2 commits into
noahbclarkson:mainfrom
adehad:chore/comment-rot
Aug 9, 2026
Merged

docs: state what the code does, not what it replaced#68
noahbclarkson merged 2 commits into
noahbclarkson:mainfrom
adehad:chore/comment-rot

Conversation

@adehad

@adehad adehad commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Six comments landed in #62 and #65 that explain the change which introduced them rather than the code as it stands:

  • DiffSource's doc comment argued the enum against the earlier staged: bool + commit_id pair
  • key_handler.rs opened with "Two mechanisms replace what used to be hand-rolled here"
  • keymap/registry.rs noted that Workspace && !modal "replaces the hand-rolled any_overlay_active gate"
  • keymap/shadow.rs described what "used to go completely unreported", and a test doc named the binding that motivated it
  • keymap/summary.rs labelled a test with "the drift that motivated this work"
  • keymap/display.rs described a fixture as the literal the help "used to carry"

A reader arriving later has no memory of the prior code, so that text is noise at best and misleading once the surrounding code moves again. The rationale belongs in the commit message and the PR description, which is where I have put it.

Each is rewritten to state the constraint or invariant that still holds — what DiffSource's variants mean and why only two of them can be staged, what !modal scopes, why predicate comparison alone cannot see nested contexts, and what each test pins. My fault for letting them through in the first place.

No behaviour change.

cargo test --workspace                                 -> 1146 passed, 6 ignored
cargo clippy --workspace --all-targets -- -D warnings  -> clean
cargo fmt --all -- --check                             -> clean

🤖 Generated with Claude Code

Several comments explained the change that introduced them — the DiffSource
enum against the earlier staged/commit_id pair, the keymap registry against
the any_overlay_active gate, shadow detection against the gap it filled. That
reasoning belongs in the commit and PR that made the change; in the source it
is stale the moment a reader arrives without memory of the prior code.

Keep the facts a future maintainer needs, drop the comparisons.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@noahbclarkson
noahbclarkson merged commit 9ba0fc0 into noahbclarkson:main Aug 9, 2026
3 checks passed
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.

2 participants