feat: Warn when patching methods called from physics callbacks - #1911
Conversation
enable-pause-point's cached-dispatch warning previously fired only when the patched method itself was named after a Unity physics message method (OnCollisionEnter2D etc.). A method that is merely called from one hits the exact same dispatch-caching risk but got no warning at all, so agents had no signal before hitting a silent miss. - Add SourcePausePointPhysicalCallbackCallSiteScanner: reads the compiled assembly with Mono.Cecil and checks whether any physics message method in the same assembly calls the patch target one level deep. - Wire it into SourcePausePointPatcher.BuildPatchWarning as a fallback when the direct name/type check does not match, surfacing a new PhysicalCallbackIndirectCallMayMissExistingInstanceWarning. - Extend the Go-side PAUSE_POINT_EXPIRED hint (pausePointExpiredHint) with the same non-firing-pattern guidance already present in the timeout hint, extracted into a shared pausePointNonFiringPatternsHint constant so the two hints cannot drift apart.
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (7)
✨ Finishing Touches🧪 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 |
5cc6932
into
feature/round6-pause-point-improvements
Summary
enable-pause-pointnow warns about the same cached-dispatch risk even when the target line is a helper method called from a physics callback, not just when the target itself is namedOnCollisionEnter2D/OnTriggerEnter2D/etc.PAUSE_POINT_EXPIREDtimeout diagnosis now includes the same non-firing-pattern guidance the plain timeout diagnosis already had.User Impact
OnCollisionEnter2D) calls into produced no warning at enable time, even though it can silently miss a GameObject that already existed when the pause point was enabled. Agents only discovered this the hard way, via a confusingHitCount == 0timeout.enable-pause-point's response Warning field flags this case up front and suggests the same workarounds (recreate the GameObject, or embedUloopPausePoint.Pause("id")directly). Additionally, when a marker expires (PAUSE_POINT_EXPIRED) before being hit, the CLI now surfaces the same non-firing-pattern checklist that a plain timeout already showed, instead of a much shorter message.Changes
SourcePausePointPhysicalCallbackCallSiteScanner: reads the compiled assembly with Mono.Cecil and checks (one call level deep) whether any Unity physics message method in the same assembly calls the patch target.SourcePausePointPatcher.BuildPatchWarningas a fallback when the direct name/type check doesn't match, adding a newPhysicalCallbackIndirectCallMayMissExistingInstanceWarningconstant.pausePointExpiredHintwith the same non-firing-pattern guidance already present inpausePointTimeoutHint, extracting the shared text into apausePointNonFiringPatternsHintconstant so the two hints can't drift apart.enable-pause-pointcall rather than on a hot path.Verification
dist/darwin-arm64/uloop compile --project-path <repo>: 0 errors, 0 warnings.dist/darwin-arm64/uloop run-tests(EditMode, filterPausePoint): 225/225 passed (was 223 before this PR; +2 new tests).SourcePausePointPatcherTests) before re-enabling it, which then passed 27/27 again.sh scripts/check-go-cli.sh: format/vet/lint (0 issues) and tests all passed, including the updatedproject-runnertest package.