Skip to content

feat: Speed up custom-tool migration scans by limiting them to affected assemblies#1953

Merged
hatayama merged 2 commits into
feature/migration-error-driven-autoscan-integrationfrom
feature/assembly-scoped-migration-scan
Jul 22, 2026
Merged

feat: Speed up custom-tool migration scans by limiting them to affected assemblies#1953
hatayama merged 2 commits into
feature/migration-error-driven-autoscan-integrationfrom
feature/assembly-scoped-migration-scan

Conversation

@hatayama

@hatayama hatayama commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a way to scan and build a migration plan for only a specific set of assemblies, instead of always walking the whole project.

User Impact

  • Currently, checking (or previewing) whether a V2-to-V3 custom-tool migration is needed always scans every file under Assets, even when only a couple of tools actually need it.
  • This lays the groundwork for a much faster path: once the wizard already knows which files need migrating (from compile errors, added in a companion PR), it can rescan only the assemblies those files belong to instead of the entire project. This PR only adds the scoped scan/plan/preview machinery and its tests; it is not wired into the wizard's startup flow yet.

Changes

  • ThirdPartyToolMigrationScanScopeResolver (new): resolves a set of seed file paths to their deduplicated assembly directories, reusing the existing FindNearestAssemblyDirectory resolution used by the full scan.
  • ProjectFileInventory.CreateFromDirectoriesAsync (new): walks only the given scope directories instead of the whole Assets tree. Shares its directory-walk logic with the existing full-scan CreateAsync via an extracted WalkDirectoryTreeAsync helper — the full scan's behavior is unchanged.
  • ThirdPartyToolMigrationPlanBuilder.CreateInScopeAsync / ThirdPartyToolMigrationFileService.PreviewMigrationInScopeAsync (new): distinctly-named scope-limited counterparts to the existing Create/CreateAsync/PreviewMigration(Async) methods (the repo forbids method overloading). The scoped preview intentionally does not read or write the existing full-scan preview/plan cache, since a partial-scope plan must never be mistaken for the full plan that ApplyMigration relies on.

Verification

  • uloop compile: 0 errors, 0 warnings
  • uloop run-tests (new + related tests, regex filter): 12/12 passed
  • uloop run-tests (all ThirdPartyToolMigration* tests): 438/438 passed (4 skipped, platform-specific)
  • uloop run-tests (full EditMode suite): 2309/2320 passed; the 4 failures are pre-existing and unrelated to this change (dispatcher version-pin string drift, a schema DescriptionAttribute check, a startup-hook ownership check) — none touch ThirdPartyToolMigration code.

Review in cubic

Scope migration-plan construction to only the assemblies containing
seed files, instead of always walking the whole Assets tree. This is
the second building block for compile-error-driven migration
detection: once a legacy-API compile error identifies which files need
migrating (PR-1), the plan builder should only re-scan the assemblies
those files belong to.

- ThirdPartyToolMigrationScanScopeResolver: resolves seed file paths to
  their deduplicated set of assembly directories via
  FindNearestAssemblyDirectory.
- ProjectFileInventory.CreateFromDirectoriesAsync: walks only the given
  scope directories instead of Assets/, sharing the directory-walk
  logic with the existing full-scan CreateAsync via an extracted
  WalkDirectoryTreeAsync helper (no behavior change to the full scan).
- ThirdPartyToolMigrationPlanBuilder.CreateInScopeAsync and
  ThirdPartyToolMigrationFileService.PreviewMigrationInScopeAsync:
  distinctly-named scope-limited counterparts to the existing
  Create/CreateAsync and PreviewMigration(Async) methods (no
  overloading, per repo convention). The scoped preview intentionally
  bypasses the full-scan preview/plan cache, since a partial-scope plan
  must never be mistaken for the full plan that ApplyMigration relies
  on.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5f470073-b0a4-4ac7-9344-d541bc1ddf32

📥 Commits

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

⛔ Files ignored due to path filters (3)
  • 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
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationScanScopeResolver.cs.meta is excluded by none and included by none
📒 Files selected for processing (6)
  • Assets/Tests/Editor/ThirdPartyToolMigrationScanScopeResolverTests.cs
  • Assets/Tests/Editor/ThirdPartyToolMigrationScopedPreviewTests.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/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationScanScopeResolver.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/assembly-scoped-migration-scan

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.

ResolveScopeAssemblyDirectories returned FindNearestAssemblyDirectory's
synthetic implicit-assembly marker path (e.g.
__UnityCliLoopImplicitEditorAssembly) as-is for seed files with no real
asmdef/asmref ancestor. That marker never exists on disk, and
CreateFromDirectoriesAsync skips scope directories that don't exist,
so a legacy tool living directly under an implicit assembly (no
asmdef, e.g. Assets/Editor/) would silently disappear from the scoped
scan and be misreported as "no migration needed".

ResolveScopeAssemblyDirectories now excludes implicit-assembly markers
from the returned directory list and instead reports
HasImplicitAssemblySeeds, so a caller can fall back to a full scan
instead of silently dropping those seeds.
@hatayama
hatayama merged commit 20452f7 into feature/migration-error-driven-autoscan-integration Jul 22, 2026
1 check passed
@hatayama
hatayama deleted the feature/assembly-scoped-migration-scan branch July 22, 2026 14:28
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