Repository navigation
fix: The hot-reload warning about edits outside method bodies now says it counts edits since the last compile - #3182
Conversation
A trial on a large project reported this warning after an edit that only changed XML documentation comments. The drift check compares declarations with SyntaxFactory.AreEquivalent, which ignores trivia, so comments should never count. Each test puts a comment on one of the comparison paths the check uses: a method's leading trivia, a field initializer, a field's first modifier, the type's documentation comment, and the whole-tree compare used when a duplicate field syntax key makes pairing ambiguous.
…compile The check compares the edited file with the source of the last compile, not with the file before this edit. An earlier declaration edit therefore keeps the warning on every reload until uloop compile, and a reader who just changed a comment took the warning to be about that comment. Both forms of the warning now name the baseline, and the test copies of the wording follow.
The skill reference and the hot-reload design doc now say that the warning compares with the source of the last compile, so an earlier declaration edit keeps it on every reload until uloop compile, and that comment-only edits do not count. The generated skill copies are regenerated from the source.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughOutside-method-body drift warnings now specify that edits occurred since the last compile. Tests cover comment-only edits, and the hot-reload guidance describes the comparison source and warning behavior across reloads. ChangesOutside-method-body drift warnings
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The warning, documentation, and regression tests align with the checker’s last-compile baseline and comment-only behavior. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…e warning The outside-method-body check also compares a field's type and its attribute lists, and no test covered either comparison. A block comment after the type and a line comment above an attribute now pin that both ignore comments.
The Known Limits entry still said that edits outside method bodies other than const changes stay silent, which contradicts the warning described earlier in the same document and in the skill reference. Such edits are reported when a verified source baseline is available and stay silent only without one.
c847dc7
into
feature/hot-reload-large-project-feedback
Summary
User Impact
Before: after a reload of a file whose only change was an XML documentation comment, a user saw
and read it as being about the comment, so they had to check each time whether a compile was really needed.
After:
The named form changes the same way, for example
Edits outside method bodies in <File>.cs (field initializer: _value) since the last compile are not applied by hot reload; ....Cause
SyntaxFactory.AreEquivalent, which ignores trivia. All new tests passed on their first run against the unchanged check, so the check's logic is not changed.Changes
scope-and-limits.md) anddocs/hot-reload.mdsay what the warning compares against and that comment-only edits do not count. The generated skill copies are regenerated from the source.docs/hot-reload.mdno longer says that other outside-body edits stay silent. As the skill reference already says, they are reported when a verified source baseline is available and stay silent only without one.Tests
New tests
Each one adds a comment that reaches one comparison of the check and expects no warning:
TransformWorkerClientTests.Run_WithXmlDocCommentOnlyEditOnAMethod_DoesNotEmitOutsideMethodBodyWarningTransformWorkerClientTests.Run_WithBlockCommentOnlyEditInsideAFieldInitializer_DoesNotEmitOutsideMethodBodyWarningTransformWorkerClientTests.Run_WithLineCommentOnlyEditAboveAField_DoesNotEmitOutsideMethodBodyWarningTransformWorkerClientTests.Run_WithBlockCommentOnlyEditAfterAFieldType_DoesNotEmitOutsideMethodBodyWarningTransformWorkerAddedFieldTests.Drift_LineCommentOnlyEditAboveAFieldAttribute_DoesNotWarnTransformWorkerClientTests.Run_WithXmlDocCommentOnlyEditOnTheType_DoesNotEmitOutsideMethodBodyWarningTransformWorkerAddedFieldTests.Drift_DuplicateFieldSyntaxKeyWithCommentOnlyEdit_DoesNotWarnMutation check
Each comparison was replaced by an ordinal comparison of
ToFullString(), which includes trivia, and then reverted.TransformWorkerClientTests|TransformWorkerAddedFieldTests, 176 tests)Run_WithSnapshotDifferingOnlyByEol_TreatsAllMethodsUnchanged; 170 passedOutsideMethodBodyDeclarationDiff)OutsideMethodBodyFieldGroupDiff)OutsideMethodBodyFieldGroupDiff)OutsideMethodBodyDriftChecker)OutsideMethodBodyFieldGroupDiff, both classes, 180 tests)OutsideMethodBodyFieldGroupDiff, both classes, 180 tests)(method: VisibleSibling)for the method doc-comment test(field initializer: _secret)for the initializer test(field: _secret)for both the field line-comment test and the field type test(field attributes: PublicSeed)for the field attribute testLocal runs
TransformWorkerClientTests|TransformWorkerAddedFieldTestswith the first 5 new tests, before the wording change: 176 tests, 176 passed.TransformWorkerClientTests|TransformWorkerAddedFieldTests|TransformWorkerAddedPropertyTests|TransformWorkerAddedMemberTests|HotReloadOrchestratorTestsafter the wording change: 477 tests (the expected count from the five classes), 475 passed, 2 failed.TransformWorkerAddedMemberTestspins of the unresolved signature type skip reason, which fix: Hot reload applies edits to methods using types from another file's global using, and names unresolved signature types #3179 had changed. chore: Align two hot-reload test pins with the unresolved signature type skip reason #3180 updated them.TransformWorkerClientTests|TransformWorkerAddedFieldTestswith all 7 new tests: 180 tests, 180 passed.uloop compile: 0 errors.uloop compile-checkon the head: 0 errors. Its 7 warnings are in test files this PR does not change.rg "are not applied by hot reload; run uloop compile"finds 18 lines, and all of them say "since the last compile".check-skill-size: no SKILL.md over the limit. The generated copies ofscope-and-limits.mdare byte-identical to the source (cmp).