fix: Compile fails fast on asmdef and asmref import errors#1225
Conversation
Use the same current Unity Console source as get-logs to fail compile when .asmdef or .asmref import errors are present. Run the detection only after AssetDatabase.Refresh so fixed assembly definition errors are not blocked by stale pre-refresh Console entries.
Avoid treating arbitrary stale Console errors that merely mention .asmdef or .asmref paths as active import failures. Keep compile blocking focused on Unity Assembly Definition and Assembly Reference importer messages.
Prevent retained Unity Console entries from blocking compile after the referenced asmdef or asmref asset has been fixed or removed. Treat generic asmref parse messages as current failures only when the asset still validates as an import problem.
Count asmref files alongside asmdef files when validating Unity's folder-conflict Console errors so compile fails fast instead of waiting for a start timeout.
Handle malformed asmdef JSON, duplicate references that mix assembly names and GUIDs, and valid Unity asset paths containing parentheses so current Console import errors do not fall through to compile start timeouts.
|
Warning Review limit reached
More reviews will be available in 2 minutes and 23 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an editor-side validator that parses Unity Console import errors for ChangesAssembly Definition Error Validation and Compile Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Ensure compile controller state and task completion are restored even when completion subscribers throw. This keeps abort and finish paths from leaving stale compile flags or pending tasks behind.
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/Compile/AssemblyDefinitionConsoleErrorValidationService.cs`:
- Around line 223-225: To fix incorrect handling of virtual "Packages/..." asset
paths, update ToAbsolutePath to detect paths starting with "Packages/", call
UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath), and when it
returns a PackageInfo use its resolvedPath to map the virtual package prefix to
the package's actual on-disk path (replace the "Packages/<packageName>" prefix
with package.resolvedPath, then continue with existing normalization). This
ensures callers like HasMultipleAssemblyDefinitionFilesInFolder and
ReadAssetText correctly resolve non-embedded package files via
PackageInfo.resolvedPath instead of assuming they live under
<projectRoot>/Packages/.
In `@Packages/src/Editor/FirstPartyTools/Compile/CompileController.cs`:
- Around line 254-258: Capture the current TaskCompletionSource<CompileResult>
into a local variable, immediately set _currentCompileTask = null, then invoke
OnCompileCompleted?.Invoke(result) and finally call task.SetResult(result); do
this in the current completion path and mirror the same ordering in
CompleteCompileWithoutRequest(...) so that subscribers that start a new compile
inside OnCompileCompleted cannot have their new TaskCompletionSource overwritten
by the old SetResult.
🪄 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: 872713f0-3d72-4d31-b62d-b7779336746b
⛔ Files ignored due to path filters (2)
Assets/Tests/Editor/AssemblyDefinitionConsoleErrorValidationServiceTests.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Compile/AssemblyDefinitionConsoleErrorValidationService.cs.metais excluded by none and included by none
📒 Files selected for processing (5)
Assets/Tests/Editor/AssemblyDefinitionConsoleErrorValidationServiceTests.csPackages/src/Editor/FirstPartyTools/Compile/AssemblyDefinitionConsoleErrorValidationService.csPackages/src/Editor/FirstPartyTools/Compile/CompilationStateValidationService.csPackages/src/Editor/FirstPartyTools/Compile/CompileController.csPackages/src/Editor/ToolContracts/UnityCliLoopConstants.cs
💤 Files with no reviewable changes (1)
- Packages/src/Editor/FirstPartyTools/Compile/CompilationStateValidationService.cs
There was a problem hiding this comment.
3 issues found across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Resolve review feedback by cleaning compile startup state on pre-request failures, mapping Package Manager asset paths through resolved package locations, and treating only error import log entries as blocking asmdef or asmref import errors.
Summary
uloop compilenow fails quickly when current Unity Console contains Assembly Definition or Assembly Reference import errors..asmdefor.asmreffile instead of waiting for compilation that Unity never starts.User Impact
uloop compilewaiting indefinitely because Unity did not enter script compilation.Changes
Verification
Packages/src/Cli~/dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"Packages/src/Cli~/dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type exact --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.AssemblyDefinitionConsoleErrorValidationServiceTests"~/.codex/skills/codex-review/scripts/codex-review --parallel-tests '<compile && focused EditMode tests>' v3-beta