chore: Fail CI on high-confidence C# dead code and remove leftover readiness probes - #1995
Conversation
These three symbols had zero callers after readiness probing moved to get-version in 7e45f1e. Delete them rather than rewire the old path, which would let user-disabled tools block Editor startup again. Co-authored-by: Cursor <cursoragent@cursor.com>
The scanner already existed but was never wired into GitHub Actions, so unused C# symbols could land unnoticed. Run it on package and scanner path changes with --fail-on high-confidence only. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributors need to know which categories fail CI and which still need manual review of non-C# references. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 41 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 Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe pull request removes unused dynamic-code warmup and readiness helpers, adds a GitHub Actions dead-code scanning workflow for pull requests and manual runs, and documents the CI failure criteria. ChangesDead code cleanup and CI gate
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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
🧹 Nitpick comments (1)
.github/workflows/dead-code.yml (1)
3-11: 🩺 Stability & Availability | 🔵 TrivialConfirm this path-filtered workflow is not a globally required check.
PRs targeting
mainorv3-betathat touch unrelated files will not receive a workflow result. If branch protection requiresDead Code Gatefor every PR, those changes can be blocked; use an always-running workflow with conditional expensive steps instead.Based on learnings, always-required checks should use an always-running workflow rather than a path-filtered workflow.
🤖 Prompt for 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. In @.github/workflows/dead-code.yml around lines 3 - 11, Update the workflow trigger so it runs for every pull request targeting main or v3-beta, removing the path filter from the on.pull_request configuration. Keep the dead-code scope restrictions within conditional job or step execution so unrelated changes still produce the required Dead Code Gate result without running expensive scanning unnecessarily.Source: Learnings
🤖 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 @.github/workflows/dead-code.yml:
- Around line 23-24: Add persist-credentials: false to the actions/checkout step
in the dead-code workflow, keeping the existing pinned checkout action
unchanged.
In `@docs/dead-code-scanner.md`:
- Around line 22-24: Update the workflow trigger description in the dead-code
documentation to state that it runs only for pull requests targeting main or
v3-beta, and include .github/workflows/dead-code.yml itself among the triggering
path changes. Preserve the existing listed source, scanner, test, and script
paths.
---
Nitpick comments:
In @.github/workflows/dead-code.yml:
- Around line 3-11: Update the workflow trigger so it runs for every pull
request targeting main or v3-beta, removing the path filter from the
on.pull_request configuration. Keep the dead-code scope restrictions within
conditional job or step execution so unrelated changes still produce the
required Dead Code Gate result without running expensive scanning unnecessarily.
🪄 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 Plus
Run ID: 9faa9984-dbf8-4af5-8314-150b82ae7ea6
📒 Files selected for processing (5)
.github/workflows/dead-code.ymlPackages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeForegroundWarmupRunner.csPackages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/ExecuteDynamicCodeReadinessProbe.csPackages/src/Editor/FirstPartyTools/FirstPartyToolsEditorStartup.csdocs/dead-code-scanner.md
💤 Files with no reviewable changes (3)
- Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/ExecuteDynamicCodeReadinessProbe.cs
- Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeForegroundWarmupRunner.cs
- Packages/src/Editor/FirstPartyTools/FirstPartyToolsEditorStartup.cs
CodeRabbit flagged credential persistence on a PR-triggered workflow that runs repository scripts, and the docs omitted the base-branch filter and self-path trigger that the YAML already enforces. Co-authored-by: Cursor <cursoragent@cursor.com>
The CI gate only fails when --fail-on high-confidence is parsed and findings are classified as high-confidence candidates. Without tests on either side, a broken parse or inverted category check would stay green forever while the gate looked effective. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
User Impact
Unused/UnusedPrivateMember/UnusedLocalfindings fail the new Dead Code Gate.PublicCandidateandTestOnlystill require manual review and do not fail CI.Changes
.github/workflows/dead-code.yml(scanner unit tests +--fail-on high-confidencescan; no advisory artifacts).DynamicCodeForegroundWarmupRunner.TryRunBackgroundSequenceAsync— never had a caller since introduction.FirstPartyToolsEditorStartup.CreateExecuteDynamicCodeReadinessProbeCode— leftover after commit7e45f1e7intentionally switched the Editor readiness probe fromexecute-dynamic-codetoget-versionso user-disabled tools cannot block startup. Rewiring the old path would reverse that design; deletion is correct.ExecuteDynamicCodeReadinessProbe.CreatePrimaryReturnStringProbeCode— only called by the deleted helper above; removed in the same change.docs/dead-code-scanner.md.Out of scope
[UnityCliLoopKeep(reason)]) is intentionally not included. There are no remaining intentional-keep call sites after this cleanup, public API shape cannot be renamed later, and a keep attribute can hide stale symbols instead of forcing review. Follow-up triage ofPublicCandidatefindings will decide whether any keep mechanism is needed.Verification
scripts/check-dead-code.sh ... --fail-on high-confidence→ exit 0origin/v3-beta: 244 → 242 (PublicCandidate187 → 185)dotnet test tests/UnityCliLoop.DeadCodeScanner.Tests/...→ Passed 4 / Failed 0cd cli/release-automation && go test ./internal/architecture -run 'TestWorkflowActions|TestPullRequestWorkflow' -count=1→ okdist/darwin-arm64/uloop compile→ ErrorCount 0, WarningCount 0Refs #1987