chore: Keep Screenshot editor sources under 500 lines#1782
Conversation
Expose pure helper methods as internal and pin timeout/response/metadata/sanitization outputs so Extract Class on Screenshot files cannot silently change behavior. RaycastGridAnnotator already has extensive dedicated coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Extract Class on ScreenshotUseCase, UIElementAnnotator, and RaycastGridAnnotator so capture orchestration, annotation rendering/styling, and raycast summary/physics builders each have one clear responsibility without changing screenshot behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 17 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 selected for processing (3)
📝 WalkthroughWalkthroughScreenshot capture responsibilities are extracted into validation, metadata, file-writing, response, raycast-building, and annotation-rendering helpers. ChangesScreenshot capture and annotation
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Packages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastPhysicsColliderBuilder.cs`:
- Around line 14-15: The clustered grid dimensions are duplicated between the
builder and annotator, allowing bounds and sampling to diverge. In
Packages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastPhysicsColliderBuilder.cs:14-15,
change CLUSTERED_GRID_COLUMNS and CLUSTERED_GRID_ROWS to internal const and use
them as the shared source of truth; in
Packages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastGridAnnotator.cs:16-17,
remove the local constants and reference
RaycastPhysicsColliderBuilder.CLUSTERED_GRID_COLUMNS and CLUSTERED_GRID_ROWS
from CollectClusterSamples.
- Around line 62-80: The physics-collider type literal is duplicated between
construction and rendering, allowing mismatches. In
RaycastPhysicsColliderBuilder.cs lines 62-80, add a shared internal constant
named TYPE_PHYSICS_COLLIDER with value "PhysicsCollider" and assign it to
UIElementInfo.Type; in UIElementAnnotationRenderer.cs lines 228-231, update
IsPhysicsColliderElement to compare against that shared constant instead of the
raw literal.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3968976a-b2fb-4945-a379-169c46490bd1
⛔ Files ignored due to path filters (9)
Assets/Tests/Editor/ScreenshotUseCaseCharacterizationTests.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastLayerSummaryBuilder.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastPhysicsColliderBuilder.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotCoordinateMetadata.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotFileWriter.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotParameterValidator.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotResponseFactory.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/UIElementAnnotationRenderer.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Screenshot/UIElementAnnotationStyling.cs.metais excluded by none and included by none
📒 Files selected for processing (12)
Assets/Tests/Editor/ScreenshotUseCaseCharacterizationTests.csPackages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastGridAnnotator.csPackages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastLayerSummaryBuilder.csPackages/src/Editor/FirstPartyTools/Screenshot/RaycastAnnotation/RaycastPhysicsColliderBuilder.csPackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotCoordinateMetadata.csPackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotFileWriter.csPackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotParameterValidator.csPackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotResponseFactory.csPackages/src/Editor/FirstPartyTools/Screenshot/ScreenshotUseCase.csPackages/src/Editor/FirstPartyTools/Screenshot/UIElementAnnotationRenderer.csPackages/src/Editor/FirstPartyTools/Screenshot/UIElementAnnotationStyling.csPackages/src/Editor/FirstPartyTools/Screenshot/UIElementAnnotator.cs
Keep sample-loop density and physics annotation Type checks on a single source of truth after the Extract Class split so the two sides cannot drift independently. Co-authored-by: Cursor <cursoragent@cursor.com>
4ca41e8
into
feature/god-class-split-integration
Summary
User Impact
Changes
ScreenshotUseCase→ orchestration + coordinate metadata / parameter validator / file writer / response factory helpersUIElementAnnotator→ collection/overlay entrypoints +UIElementAnnotationRenderer/UIElementAnnotationStylingRaycastGridAnnotator→ grid orchestration +RaycastLayerSummaryBuilder/RaycastPhysicsColliderBuilderVerification
uloop compile→ 0/0wc -lall target + extracted files < 500Screenshot|RaycastGrid|UIElementAnnotator→ 93 passeddotnet test tests/UnityCliLoop.CodeComplexity.Tests→ 12 passedMade with Cursor