Skip to content

Put insert's summary line back on insert - #480

Merged
jonassaa merged 1 commit into
mainfrom
fix/log-cache-doc-comment
Sep 17, 2026
Merged

jonassaa merged 1 commit into
mainfrom
fix/log-cache-doc-comment

Conversation

@jonassaa

Copy link
Copy Markdown
Owner

One line moved. has_walk was inserted between insert's doc comment and
insert in #479, so the comment was swallowed:

    /// File a freshly prepared walk, evicting the least recently used one.
    /// Whether a walk for `key` is already filed, whatever it can answer.
    ///
    /// Not the same question as `first_page`, ...
    pub fn has_walk(...)

    pub fn insert(&self, repo: &RepoId, key: WalkKey, order: Arc<WalkOrder>) {

Two consequences. has_walk's rustdoc summary line — the one line that
shows in generated docs, in an IDE hover and in a symbol list — read "File a
freshly prepared walk, evicting the least recently used one", which describes
insert and is the opposite of what has_walk does: it counts no hit and
moves nothing. And insert, the function that actually evicts, was left
undocumented.

Why nothing caught it. It compiles, every test passes, and no content was
lost — both sentences were present, attached to the wrong functions. The only
tell is reading the file, which is how it was found: diffing the merged branch
against main to prove the content had landed byte-identically.

The cause is worth naming, because the tool makes it easy: anchoring an
insertion on pub fn insert puts the new item above that line, and a Rust
doc comment sits above the signature it documents — so an insert anchored on a
signature lands inside the preceding item's documentation. Anchor on the
doc comment's first line, or on the blank line before it.

🤖 Generated with Claude Code

has_walk was inserted between insert's doc comment and insert in #479, so the
comment was swallowed: has_walk's rustdoc SUMMARY LINE -- the one line shown
in generated docs, an IDE hover and a symbol list -- read "File a freshly
prepared walk, evicting the least recently used one", which describes insert
and is the opposite of what has_walk does (it counts no hit and moves
nothing). insert, the function that actually evicts, was left undocumented.

One line moved, nothing else.

**Why it got through:** it compiles, every test passes, and no content was
lost -- both sentences were present, attached to the wrong functions. The only
tell is reading the file. It came from anchoring an insertion on `pub fn
insert` when the doc comment for that function sits ABOVE the line anchored
on; an insert anchored on a signature lands inside the preceding item's
documentation.

Refs #473

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jonassaa
jonassaa merged commit bc65aed into main Sep 17, 2026
17 checks passed
@jonassaa
jonassaa deleted the fix/log-cache-doc-comment branch September 17, 2026 17:22
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.

1 participant