Repository navigation
updater: count doc-comment changes as component changes - #133
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The incremental updater (
--update) decides what changed by hashing and diffing each component'ssource_code.In Rust (and other languages where doc comments sit above the item), the
///doc comment is stored indocstring, outsidesource_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, runscodewiki 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 insidesource_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),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 classifiedbody, and the diff shows the new line.test_docstring_inside_source_is_not_counted_twice: a Python docstring is not added a second time.