Skip to content

fix: Migration wizard now opens reliably right after a compile-error restart#1955

Merged
hatayama merged 11 commits into
v3-betafrom
feature/migration-error-driven-autoscan-integration
Jul 23, 2026
Merged

fix: Migration wizard now opens reliably right after a compile-error restart#1955
hatayama merged 11 commits into
v3-betafrom
feature/migration-error-driven-autoscan-integration

Conversation

@hatayama

@hatayama hatayama commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Third-party tool migration detection now reacts to compile errors as they appear, instead of relying on a full project scan every time. On upgrade, the migration wizard opens automatically right after a compile-error domain reload, showing the affected files with no scan at all — clicking "Migrate" performs the one and only project scan, then rewrites the files.
  • Fixes an underlying Unity Editor startup issue that could silently prevent this auto-detection (and other startup checks) from ever firing.

User Impact

  • Before: after upgrading and hitting compile errors from legacy API usage, the migration wizard either didn't appear reliably or required a manual full-project scan to find the affected files.
  • After: the wizard opens automatically and instantly lists the files matched from the compile error log — no scan runs until "Migrate" is clicked, which then scans the project once and rewrites the affected files.
  • Manual "Scan for third-party tool migration" from the menu and its "Check" button are unchanged and still do a full project scan.

Changes

  • Detects migration targets by matching compile error log entries against known legacy API signatures, instead of always walking every asset file.
  • The auto-detection window shows the compile-error-matched file list directly, with no preview scan of its own; "Migrate" remains the only step that scans the project and writes changes.
  • Fixed a Unity Editor behavior discovered during manual verification: once the native "Scripts have compiler errors" dialog appears at Editor startup, EditorApplication.delayCall stops firing for the rest of that process's lifetime (confirmed via repeated live probes; EditorApplication.update keeps working normally). Since compile-error-driven detection needs to run in exactly this scenario, both the Setup Wizard startup check and the migration auto-scan trigger were moved from delayCall to a self-unsubscribing EditorApplication.update tick / poll loop, removing this dependency from the startup critical path entirely.
  • Error log retrieval for migration detection now goes through the same log-reading infrastructure used by the get-logs tool, so compiler diagnostics are classified consistently.

Verification

  • uloop compile: 0 errors, 0 warnings.
  • uloop run-tests (full suite, 2336 tests): 2325 passed, 4 failed, 7 skipped. The 4 failures are pre-existing and unrelated to this change (confirmed identical on the current v3-beta baseline, touching unrelated files/mechanisms).
  • Manual verification on a live Unity Editor (uloop launch -r):
    • Cold restart with a pre-existing compile error (legacy API usage) and an old lastSeenSetupWizardVersion: migration wizard opens automatically and immediately lists the correct affected files, with no scan delay.
    • Cold restart with no compile error and a lastSeenSetupWizardVersion on the same major version: no regression — the migration wizard does not spuriously appear, lastSeenVersion updates correctly, and there is no duplicate/double-firing of the startup check.
    • Invoking the migration ("Migrate" button's underlying logic) directly: the detected legacy files are correctly rewritten to the current API, and the project compiles cleanly afterward.

Known limitations

  • If the native "Scripts have compiler errors" dialog appears at Editor startup and you click "Quit" instead of "Ignore", the whole Editor process exits (this is existing Unity behavior, not something this PR changes).
  • Upgrading from V2 to V3 while the Editor is already running (no restart) does not trigger auto-detection immediately: Unity does not reload the domain while a compile error is present, so the new V3 detection code never runs until either the compile error is fixed (triggering a domain reload) or the Editor is restarted. This constraint also applied to the previous implementation — it is not a regression introduced here.

Manual verification steps for reviewers

  1. Checkout this branch.
  2. Add a temporary .cs file under Assets/ that references a legacy (pre-migration) third-party tool API, to force a compile error.
  3. Restart the Unity Editor for this project.
  4. Confirm the native "Scripts have compiler errors" dialog appears (click "Ignore", not "Quit" — clicking "Quit" exits the Editor process).
  5. Confirm the migration wizard opens automatically shortly after, with the affected file already listed and no scanning delay.
  6. Click "Migrate" and confirm the project scans once, rewrites the file, and compiles cleanly afterward.
  7. Remove the temporary file before verifying the no-compile-error path.

hatayama added 5 commits July 22, 2026 23:21
… dialog

EditorApplication.delayCall permanently stops flushing for the rest of an
Editor process once the native "Scripts have compiler errors" dialog has
appeared at cold startup (-ignorecompilererrors does not suppress this
dialog). Since that startup scenario is exactly when the compile-error-driven
migration auto-scan needs to run, both the SetupWizard version-change check
and the migration auto-scan trigger now ride on a self-unsubscribing
EditorApplication.update tick / poll loop instead of delayCall.

- SetupWizardWindow.InitializeForEditorStartup now registers a one-shot
  EditorApplication.update callback instead of delayCall.
- SetupWizardStartupFlow.MaybeScheduleThirdPartyToolMigrationAutoScan polls
  compile state via EditorApplication.update (DecideMigrationAutoScanPollAction)
  and falls back to a full project scan if compilation stays failed past a
  timeout (SetupWizardStartupFlowConstants.MigrationAutoScanPollTimeoutSeconds).
- ThirdPartyToolMigrationFileService now reads error logs through LogGetter
  instead of ConsoleLogRetriever directly.
- Updated OnionAssemblyDependencyTests to assert the new
  EditorApplication.update-based startup wiring and the Infrastructure
  assembly's new Common.Console reference.

Verified live via a cold Editor restart with pre-existing compile errors:
the migration wizard now opens and completes detection almost instantly,
where it previously never fired.
csc.rsp is the response file, not the compiler itself; the comment
should refer to csc diagnostics. Pointed out during advisor review.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The migration auto-scan flow detects legacy APIs from compile errors, polls through EditorApplication.update, persists detected file paths for the editor session, and displays auto-scan and completion states in the migration wizard. Tests cover parsing, matching, polling decisions, dependency wiring, and wizard behavior.

Changes

Third-party migration auto-scan

Layer / File(s) Summary
Compile-error parsing and legacy matching
Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/*, Assets/Tests/Editor/ThirdPartyToolMigration*Tests.cs
Compile-error lines are parsed and normalized, legacy API tokens are matched at identifier boundaries, and matching file paths are deduplicated.
Migration detection API and scan pipeline
Packages/src/Editor/Domain/*, Packages/src/Editor/Application/UseCases/*, Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/*
Migration ports and use cases expose compile-error target detection; file inventory traversal and plan construction support the updated scan flow.
Startup polling and seed persistence
Packages/src/Editor/Presentation/Setup/*, Packages/src/Editor/Presentation/PresentationEditorStartup.cs, Packages/src/Editor/CompositionRoot/*, Packages/src/Editor/Domain/IThirdPartyToolMigrationAutoScanSeedRepository.cs, Packages/src/Editor/Infrastructure/Settings/*, Assets/Tests/Editor/SetupWizardWindowTests.cs, Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
Startup dependencies persist auto-scan paths, polling replaces delayed callbacks, and polling decisions select detection, timeout fallback, or termination.
Wizard seed propagation and detected state
Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizard*, Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs, Assets/Tests/Editor/ThirdPartyToolMigrationWizardWindowTests.cs
The wizard consumes seed paths, renders detected and completion states, applies verified count and progress rules, updates text and button states, and performs unscoped scans on refresh.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant UnityEditor
  participant SetupWizardStartupFlow
  participant MigrationUseCase
  participant SeedRepository
  participant MigrationWizard
  UnityEditor->>SetupWizardStartupFlow: invoke update polling callback
  SetupWizardStartupFlow->>MigrationUseCase: detect targets from compile errors
  MigrationUseCase-->>SetupWizardStartupFlow: return target file paths
  SetupWizardStartupFlow->>SeedRepository: store seed paths
  SetupWizardStartupFlow->>MigrationWizard: open auto-scan window
  MigrationWizard->>SeedRepository: read and clear seed paths
  MigrationWizard->>MigrationWizard: show detected migration state
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving migration wizard startup reliability after compile-error restarts.
Description check ✅ Passed The description matches the changeset and accurately describes the new compile-error-based auto-detection and startup fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/migration-error-driven-autoscan-integration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs (1)

231-245: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve auto-scan seeds when reusing an open wizard.

At Line 235, the existing-window branch ignores seedFilePaths. They were already consumed and cleared at Lines 69-78, so the subsequent refresh runs with the controller’s old/empty seeds and falls back to a full-project scan. Pass the new seeds into the existing window/controller before TryStartInitialRefresh().

🤖 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
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`
around lines 231 - 245, Update the existing-window branch in ShowWindowInternal
to pass seedFilePaths into the already open wizard and its controller before
FocusExistingWindow triggers TryStartInitialRefresh(). Preserve the current
focus-and-return flow while ensuring the refresh uses the new auto-scan seeds
instead of falling back to a full-project scan.
🧹 Nitpick comments (1)
Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs (1)

55-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the repository’s assert-only programmer-precondition convention. The new migration seed path adds explicit runtime null exceptions where internal invalid inputs are intended to fail fast through Debug.Assert.

  • Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs#L55-L76: retain the assertions and assign the new dependencies directly rather than adding ?? throw.
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopThirdPartyToolMigrationAutoScanSeedRepository.cs#L18-L23: add a Debug.Assert(filePaths != null, ...) precondition and remove the explicit ArgumentNullException branch.

Based on learnings: invalid internal inputs are programmer errors and should use Debug.Assert rather than explicit runtime exceptions.

🤖 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 `@Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs` around
lines 55 - 76, The new internal dependencies should follow the repository’s
assert-only precondition convention. In
Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs lines 55-76,
retain the Debug.Assert checks and assign dependencies directly without ?? throw
or ArgumentNullException handling. In
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopThirdPartyToolMigrationAutoScanSeedRepository.cs
lines 18-23, add a Debug.Assert precondition for filePaths and remove the
explicit ArgumentNullException branch.

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
`@Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationLightweightAssemblyWalker.cs`:
- Around line 20-50: Update DiscoverAssemblyStructure to replace both raw
recursive Directory.GetFiles calls with a guarded directory traversal helper.
Add a helper that mirrors ThirdPartyToolMigrationProjectFileInventory’s walk,
checks
ThirdPartyToolMigrationProjectFileInventory.ShouldExcludeDirectory(projectRoot,
childDirectoryPath) before descending, and skips reparse-point or excluded
directories while collecting matching asmdef and asmref files.

In `@Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs`:
- Around line 386-397: Update the MigrationAutoScanPollAction handler in the
RunDetection and FallBackToFullScan cases to guarantee polling cleanup on
terminal actions. Wrap TryRunThirdPartyToolMigrationAutoScanDetection in
try-finally so StopThirdPartyToolMigrationAutoScanPolling always executes while
exceptions propagate, and unsubscribe before calling
ScheduleThirdPartyToolMigrationFallbackFullScan.

---

Outside diff comments:
In
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`:
- Around line 231-245: Update the existing-window branch in ShowWindowInternal
to pass seedFilePaths into the already open wizard and its controller before
FocusExistingWindow triggers TryStartInitialRefresh(). Preserve the current
focus-and-return flow while ensuring the refresh uses the new auto-scan seeds
instead of falling back to a full-project scan.

---

Nitpick comments:
In `@Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs`:
- Around line 55-76: The new internal dependencies should follow the
repository’s assert-only precondition convention. In
Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs lines 55-76,
retain the Debug.Assert checks and assign dependencies directly without ?? throw
or ArgumentNullException handling. In
Packages/src/Editor/Infrastructure/Settings/UnityCliLoopThirdPartyToolMigrationAutoScanSeedRepository.cs
lines 18-23, add a Debug.Assert precondition for filePaths and remove the
explicit ArgumentNullException branch.
🪄 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: 3b5f9e3f-6851-477c-a15d-cbb5f6432801

📥 Commits

Reviewing files that changed from the base of the PR and between 5d59f98 and f2cde32.

⛔ Files ignored due to path filters (15)
  • Assets/Tests/Editor/ThirdPartyToolMigrationCompileErrorLogMatcherTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationConsoleErrorParserTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationDetectionRulesTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationLightweightAssemblyWalkerTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationScanScopeResolverTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationScopedPreviewTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Domain/IThirdPartyToolMigrationAutoScanSeedRepository.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopThirdPartyToolMigrationAutoScanSeedRepository.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationCompileErrorLogMatcher.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationConsoleErrorParser.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationLightweightAssemblyWalker.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationScanScopeResolver.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/UnityCLILoop.Infrastructure.asmdef is excluded by none and included by none
  • Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlowConstants.cs.meta is excluded by none and included by none
📒 Files selected for processing (29)
  • Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
  • Assets/Tests/Editor/SetupWizardWindowTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationCompileErrorLogMatcherTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationConsoleErrorParserTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationDetectionRulesTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationLightweightAssemblyWalkerTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationScanScopeResolverTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationScopedPreviewTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs
  • Packages/src/Editor/Application/UseCases/ThirdPartyToolMigrationUseCase.cs
  • Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs
  • Packages/src/Editor/CompositionRoot/UnityCliLoopEditorBootstrapper.cs
  • Packages/src/Editor/Domain/IThirdPartyToolMigrationAutoScanSeedRepository.cs
  • Packages/src/Editor/Domain/ThirdPartyToolMigrationData.cs
  • Packages/src/Editor/Infrastructure/Settings/UnityCliLoopThirdPartyToolMigrationAutoScanSeedRepository.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationCompileErrorLogMatcher.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationConsoleErrorParser.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationDetectionRules.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationFileService.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationLightweightAssemblyWalker.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationPlanBuilder.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationProjectFileInventory.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationScanScopeResolver.cs
  • Packages/src/Editor/Presentation/PresentationEditorStartup.cs
  • Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs
  • Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlowConstants.cs
  • Packages/src/Editor/Presentation/Setup/SetupWizardWindow.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWorkflowController.cs

Comment thread Packages/src/Editor/Presentation/Setup/SetupWizardStartupFlow.cs
hatayama added 2 commits July 23, 2026 16:26
…ning

Manual verification found that clicking "Migrate" after the fast auto-scan
detection triggered a second, slower, full-project scan, hurting perceived
responsiveness. Root cause: the scoped preview never populated the full-scan
plan cache (by design, since a scope-limited plan is unsafe to substitute
for the full plan), so ApplyMigration always fell back to a fresh full scan.

Per the user's decision (after advisor consultation confirming Migrate must
keep doing a full scan for correctness — cascading compile-skip across
dependent assemblies could otherwise hide legitimate migration targets),
the fix is to stop scanning at auto-scan-open time entirely: the window now
displays the compile-error-matched seed file list directly (already known
for free from log matching), with Migrate remaining the sole scan+rewrite
step. This removes the now-unused scoped-scan infrastructure
(ScanScopeResolver, LightweightAssemblyWalker, PreviewMigrationForSeedFilesAsync,
PreviewMigrationInScopeAsync, PlanBuilder.CreateInScopeAsync,
ProjectFileInventory.CreateFromDirectoriesAsync) and their dedicated tests.
The advisor review found two issues in the zero-scan auto-detection
change: "legacy V3 custom tool API" had the migration direction
backwards (V2 is legacy, V3 is the target), and the Migrate confirm
dialog showed the seed-derived file count even when migrating
directly from the auto-scan-detected state, understating scope since
a cascading compile-skip can make the real full scan touch more
files than the compile-error seeds ever revealed.

Corrected the wording in ThirdPartyToolMigrationWizardText, and added
GetMigrationConfirmDialogFileCount (StateRules + Window wrapper) so
the confirm dialog only shows an exact count when it came from a
verified full-project scan, falling back to the generic message
otherwise.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs (1)

231-247: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve seeds when focusing an already-open window.

ShowWindowInternal consumes seedFilePaths but drops them when an instance already exists. FocusExistingWindow then renders using the old window list, so a manually opened wizard can show zero or stale files and the consumed seeds cannot be recovered.

Proposed fix
-                FocusExistingWindow(shouldRefreshAfterCreateGui);
+                FocusExistingWindow(shouldRefreshAfterCreateGui, seedFilePaths);

-private static void FocusExistingWindow(bool shouldRefreshAfterCreateGui)
+private static void FocusExistingWindow(
+    bool shouldRefreshAfterCreateGui,
+    List<string> seedFilePaths)
 {
     ...
     if (!shouldRefreshAfterCreateGui)
     {
         return;
     }

+    window._autoScanSeedFilePaths = seedFilePaths;
     window.TryShowAutoScanDetectedState();
 }

Also applies to: 310-310

🤖 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
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`
around lines 231 - 247, Update ShowWindowInternal so seedFilePaths are applied
to the existing ThirdPartyToolMigrationWizardWindow before calling
FocusExistingWindow, preserving the supplied seeds when the wizard is already
open. Keep the current new-window initialization through _autoScanSeedFilePaths
unchanged.
🧹 Nitpick comments (1)
Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs (1)

23-34: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert that the seeded detected state is actually rendered.

This test only proves that no preview scan runs. A regression that ignores the seed paths or renders the NotChecked state would still pass. Assert the status text/state through the constructed UI root, including the expected detected file count.

🤖 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 `@Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs`
around lines 23 - 34, Extend
ShowInitialState_WhenShouldShowAutoScanDetectedState_DoesNotTriggerAnyPreviewCall
to inspect the constructed UI root after ShowInitialState, asserting that the
auto-scan detected state is rendered with the seeded detected-file count of one.
Keep the existing PreviewMigrationAsyncCallCount assertion and use the
controller’s existing UI/status symbols rather than validating only the
migration port.
🤖 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/Presentation/Setup/ThirdPartyToolMigrationWizardText.cs`:
- Around line 57-76: Update GetAutoScanDetectedStatusText and its summary to use
“legacy V2” for compile-error detections. For the fileCount == 0 fallback, use
neutral wording that does not claim a compile-error match while still
instructing the user to click Migrate to scan and update the project; retain the
existing singular/plural wording for known file counts.
- Around line 78-87: Update GetMigrationConfirmDialogMessage so the nonzero
fileCount path uses the generic scan-and-rewrite confirmation rather than
presenting fileCount as the exact rewrite count. Preserve the existing zero-file
message and fileCount validation, while ensuring seeded compile-error state does
not promise an exact number of rewritten files.

In
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWorkflowController.cs`:
- Around line 87-93: The ShowAutoScanDetectedState method should not assign
seedFilePaths to _pendingMigrationFilePaths, since those paths are only
preliminary matches and can undercount the later full scan. Track the seeded
detection state separately, keep the confirmation dialog on the generic message
until HandleMigrateThirdPartyTools completes its full scan, and reserve
_pendingMigrationFilePaths for confirmed scan results.

---

Outside diff comments:
In
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`:
- Around line 231-247: Update ShowWindowInternal so seedFilePaths are applied to
the existing ThirdPartyToolMigrationWizardWindow before calling
FocusExistingWindow, preserving the supplied seeds when the wizard is already
open. Keep the current new-window initialization through _autoScanSeedFilePaths
unchanged.

---

Nitpick comments:
In `@Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs`:
- Around line 23-34: Extend
ShowInitialState_WhenShouldShowAutoScanDetectedState_DoesNotTriggerAnyPreviewCall
to inspect the constructed UI root after ShowInitialState, asserting that the
auto-scan detected state is rendered with the seeded detected-file count of one.
Keep the existing PreviewMigrationAsyncCallCount assertion and use the
controller’s existing UI/status symbols rather than validating only the
migration port.
🪄 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: 9b479e0b-26a9-4c76-8db3-00730c85a110

📥 Commits

Reviewing files that changed from the base of the PR and between f2cde32 and 040b32a.

📒 Files selected for processing (10)
  • Assets/Tests/Editor/ThirdPartyToolMigrationWizardWorkflowControllerTests.cs
  • Packages/src/Editor/Application/UseCases/ThirdPartyToolMigrationUseCase.cs
  • Packages/src/Editor/Domain/ThirdPartyToolMigrationData.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationFileService.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationPlanBuilder.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationProjectFileInventory.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardText.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardView.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWorkflowController.cs
💤 Files with no reviewable changes (4)
  • Packages/src/Editor/Domain/ThirdPartyToolMigrationData.cs
  • Packages/src/Editor/Application/UseCases/ThirdPartyToolMigrationUseCase.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationFileService.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationPlanBuilder.cs

ProjectFileInventory reports TotalItemCount as 0 while it is still
counting files (the real total isn't known yet). The progress bar
fell back to a highValue of 1 for that unknown-total case, which
clamped any nonzero inspected-file count up to 1 — so the bar
rendered as fully filled the moment Migrate was clicked, well before
the real scan (with a known total) began.

Added GetMigrationProgressBarRange (StateRules + Window wrapper,
matching this file's existing pure-rule pattern) so the bar reports
empty progress until a real total is known, instead of a false 100%.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs (1)

249-264: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve auto-scan seeds when focusing an existing window.

ShowWindowForAutoScan consumes and clears the repository before this method runs. If a wizard instance already exists, this branch calls FocusExistingWindow without assigning seedFilePaths, so TryShowAutoScanDetectedState renders the old list—often empty—and the newly detected files are lost.

Pass the seeds into FocusExistingWindow and assign them before invoking the controller; add a regression test for the already-open-window path.

Suggested fix
 private static void ShowWindowInternal(bool shouldRefreshAfterCreateGui, List<string> seedFilePaths)
 {
     if (HasOpenInstances<ThirdPartyToolMigrationWizardWindow>())
     {
-        FocusExistingWindow(shouldRefreshAfterCreateGui);
+        FocusExistingWindow(shouldRefreshAfterCreateGui, seedFilePaths);
         return;
     }

-private static void FocusExistingWindow(bool shouldRefreshAfterCreateGui)
+private static void FocusExistingWindow(
+    bool shouldRefreshAfterCreateGui,
+    List<string> seedFilePaths)
 {
     ...
     if (!shouldRefreshAfterCreateGui)
     {
         return;
     }

+    window._autoScanSeedFilePaths = new List<string>(seedFilePaths);
     window._shouldRefreshAfterCreateGui = true;
     window.TryShowAutoScanDetectedState();
 }

Also applies to: 328-328

🤖 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
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`
around lines 249 - 264, Update ShowWindowInternal and FocusExistingWindow so
seedFilePaths are passed through the already-open-window branch and assigned to
the existing wizard instance before invoking its controller. Preserve the
new-window assignment behavior, and add a regression test covering
ShowWindowForAutoScan when a wizard is already open, verifying the detected
seeds are rendered.
🤖 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.

Outside diff comments:
In
`@Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs`:
- Around line 249-264: Update ShowWindowInternal and FocusExistingWindow so
seedFilePaths are passed through the already-open-window branch and assigned to
the existing wizard instance before invoking its controller. Preserve the
new-window assignment behavior, and add a regression test covering
ShowWindowForAutoScan when a wizard is already open, verifying the detected
seeds are rendered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b23ce967-b9f1-49f5-a776-d263f7114a3c

📥 Commits

Reviewing files that changed from the base of the PR and between 040b32a and 5bc46e9.

📒 Files selected for processing (6)
  • Assets/Tests/Editor/ThirdPartyToolMigrationWizardWindowTests.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardStateRules.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardText.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardView.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWindow.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardWorkflowController.cs
🚧 Files skipped from review as they are similar to previous changes (2)
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardText.cs
  • Packages/src/Editor/Presentation/Setup/ThirdPartyToolMigrationWizardView.cs

hatayama added 2 commits July 23, 2026 18:06
After a successful Migrate, the window showed a generic "Nothing to
migrate" text that read as an idle/unchanged state, ambiguous with the
background compile Migrate had just triggered via AssetDatabase.Refresh().
It also left both Migrate and Check simultaneously enabled in the
auto-scan-detected state, letting either be clicked at once, and disabled
buttons only looked like a dimmed green rather than a clear gray.

- Add ShowMigrationCompleteState with distinct "Migration complete" wording,
  used only for the post-Migrate path (the manual-Check no-targets path
  keeps its existing generic text)
- Disable the Check button in ShowAutoScanDetectedState while Migrate is
  active, mirroring ShowMigrationTargetsState's existing convention
- Add a `.setup-button--primary:disabled` style matching the Settings
  window's gray disabled-button look
… window

ShowWindowInternal's existing-window branch called FocusExistingWindow
without the newly detected seedFilePaths, so a re-triggered auto-scan
while the wizard was already open re-rendered the controller's stale
constructor-time seed list (or an empty one) instead of the fresh
detection. Flagged by CodeRabbit as a functional-correctness issue on
PR #1955; confirmed still present and fixed before merge.

- Thread seedFilePaths through FocusExistingWindow and
  Window.TryShowAutoScanDetectedState into the controller
- Change WorkflowController.TryShowAutoScanDetectedState to render the
  seeds passed to the call instead of the constructor-captured field
- Add a test asserting the freshly passed seeds are what gets rendered
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Repository owner deleted a comment from qua-hatayama Jul 23, 2026
@hatayama

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

PollThirdPartyToolMigrationAutoScan's RunDetection case only stopped
polling on a successful detection. If TryRunThirdPartyToolMigrationAutoScanDetection
threw, the EditorApplication.update subscription stayed registered and
would retry the same throwing call every editor frame. Also reordered
FallBackToFullScan to unsubscribe before scheduling the fallback scan,
matching the same cleanup-first ordering.

Flagged by CodeRabbit on PR #1955.
@hatayama

Copy link
Copy Markdown
Owner Author

Addressed the outside-diff finding (auto-scan seeds dropped when reusing an already-open wizard window, ThirdPartyToolMigrationWizardWindow.cs:249-264) in commit 68ca08f: seedFilePaths is now threaded through FocusExistingWindow → Window.TryShowAutoScanDetectedState → WorkflowController.TryShowAutoScanDetectedState, which now renders the freshly passed seeds instead of the constructor-captured field. Added a regression test (ThirdPartyToolMigrationWizardWorkflowControllerTests.TryShowAutoScanDetectedState_RendersFreshlyPassedSeedsInsteadOfConstructorSeeds) asserting the fresh seeds are what gets rendered.

Also fixed the exception-safety issue on the auto-scan poll callback (SetupWizardStartupFlow.cs:386-397) in commit 0e07476, per your suggested try-finally ordering.

@hatayama
hatayama merged commit f3feb18 into v3-beta Jul 23, 2026
12 checks passed
@hatayama
hatayama deleted the feature/migration-error-driven-autoscan-integration branch July 23, 2026 11:23
@github-actions github-actions Bot mentioned this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant