Skip to content

updater: count doc-comment changes as component changes - #133

Merged
anhnh2002 merged 1 commit into
mainfrom
fix/updater-doc-comments
Oct 12, 2026
Merged

anhnh2002 merged 1 commit into
mainfrom
fix/updater-doc-comments

Conversation

@anhnh2002

Copy link
Copy Markdown
Collaborator

Problem

The incremental updater (--update) decides what changed by hashing and diffing each component's source_code.
In Rust (and other languages where doc comments sit above the item), the /// doc comment is stored in docstring, outside source_code.
So a change that only adds or edits a doc comment is invisible: no change record, no leaf agent, and the page stays as it was.

Seen in practice: a migration tool adds /// doc comments to describe behaviour the docs were missing, runs codewiki generate --update, and nothing on the wiki changes.

Fix

New helper documented_source(node): the component's code with its doc comment in front, unless the code already contains it (Python docstrings live inside source_code, so they are not counted twice).
It is used for:

  • body_hash (change detection),
  • unified_body_diff (the diff shown to the leaf agent),
  • the changed-component code in the leaf agent's prompt.

Rename pairing still compares code only.

Tests

  • test_doc_comment_only_change_is_a_body_change: a Rust component whose only change is a new /// line is classified body, and the diff shows the new line.
  • test_docstring_inside_source_is_not_counted_twice: a Python docstring is not added a second time.
  • Full suite: 259 passed.

Rust (and other languages whose doc comments sit above the item) keep the
doc comment outside the component's source_code. The updater hashed and
diffed source_code only, so a change that only documents behaviour was
invisible: no change record, no leaf agent, the page stayed as it was.

Hash, diff and show the component with its doc comment in front, unless
the code already contains it (Python docstrings).
@anhnh2002
anhnh2002 merged commit 12474de into main Oct 12, 2026
2 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.

1 participant