Skip to content

feat: Add compile-error-based detection groundwork for third-party tool migration#1952

Merged
hatayama merged 2 commits into
feature/migration-error-driven-autoscan-integrationfrom
feature/compile-error-log-detection-rules
Jul 22, 2026
Merged

feat: Add compile-error-based detection groundwork for third-party tool migration#1952
hatayama merged 2 commits into
feature/migration-error-driven-autoscan-integrationfrom
feature/compile-error-log-detection-rules

Conversation

@hatayama

@hatayama hatayama commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds the pure logic needed to detect a V2-to-V3 custom-tool migration from compile errors alone, instead of requiring a full-project file scan just to decide whether migration is needed.

User Impact

  • Currently, the migration wizard has no fast way to tell whether any third-party tool actually needs migrating without scanning the whole project.
  • This lays the groundwork for the wizard to instead recognize the situation instantly from compile errors that already exist right after a V2-to-V3 upgrade (the same trick Unity's own API Updater uses), so a later PR can make the migration prompt appear immediately instead of after a slow scan.
  • This PR only adds the detection logic and its tests; it is not wired into the wizard's startup flow yet.

Changes

  • ThirdPartyToolMigrationDetectionRules: adds a legacy-API token set derived from ThirdPartyToolMigrationRuleCatalog's existing legacy/current name pairs (excluding names that are unchanged between V2 and V3, to avoid false-matching unrelated V3 compile errors), and a boundary-aware ContainsLegacyApiToken check so a token like IUnityTool does not match inside an unrelated identifier such as IUnityToolbarButton.
  • ThirdPartyToolMigrationCompileErrorLogMatcher (new): given a list of compile-error log entries (message, file path, line number), filters to the entries whose message contains a legacy API token and returns the deduplicated set of target file paths. Parsing file/line out of raw console log text is left to the caller that wires this to the real log source.

Verification

  • uloop compile: 0 errors, 0 warnings
  • uloop run-tests (new tests only, regex filter): 12/12 passed
  • uloop run-tests (full EditMode suite): 2309/2322 passed; the 6 failures are pre-existing and unrelated to this change (dispatcher version-pin string drift, a PausePoint InitializeOnLoad ownership check, a Mouse UI GameObject leftover state, a schema DescriptionAttribute check, and a flaky watch-expression compile timing test) — none touch ThirdPartyToolMigration code.

Review in cubic

…-scan

The migration wizard's auto-scan currently must text-scan all of Assets to
decide whether a V2-to-V3 migration is needed. Since V2 API usage always
produces a compile error after the upgrade, this adds a zero-scan detection
shortcut instead (mirrors how Unity's own API Updater uses "(UnityUpgradable"
message matching): a boundary-matched token set derived from
ThirdPartyToolMigrationRuleCatalog's legacy/current name pairs, and a matcher
that filters/dedups compile-error log entries down to migration target file
paths. Wiring this into the actual startup/console-log path is a later PR.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 83d5331d-d74b-4ef7-8370-d8ea8a9e8ed8

📥 Commits

Reviewing files that changed from the base of the PR and between 582f7af and ac75e00.

📒 Files selected for processing (1)
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationDetectionRules.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationDetectionRules.cs

📝 Walkthrough

Walkthrough

Adds legacy API token detection derived from replacement rules and identifier boundaries, introduces compile-error matching with deduplicated target paths, and adds NUnit coverage for detection, filtering, deduplication, mixed entries, empty results, and null inputs.

Changes

Third-party tool migration detection

Layer / File(s) Summary
Legacy API token detection
Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationDetectionRules.cs, Assets/Tests/Editor/ThirdPartyToolMigrationDetectionRulesTests.cs
Legacy tokens are derived from replacement rules, including attribute variants, and matched only at identifier boundaries. Tests cover positive detections and false-positive exclusions.
Compile-error matching
Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationCompileErrorLogMatcher.cs, Assets/Tests/Editor/ThirdPartyToolMigrationCompileErrorLogMatcherTests.cs
Compile-error entries are validated, filtered using legacy-token detection, and returned with deduplicated target file paths. Tests cover matching, ordering, deduplication, mixed entries, empty results, and null input.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CompileErrorEntries
  participant ThirdPartyToolMigrationCompileErrorLogMatcher
  participant ThirdPartyToolMigrationDetectionRules
  CompileErrorEntries->>ThirdPartyToolMigrationCompileErrorLogMatcher: Match(entries)
  ThirdPartyToolMigrationCompileErrorLogMatcher->>ThirdPartyToolMigrationDetectionRules: Check each error message
  ThirdPartyToolMigrationDetectionRules-->>ThirdPartyToolMigrationCompileErrorLogMatcher: Legacy-token match result
  ThirdPartyToolMigrationCompileErrorLogMatcher-->>CompileErrorEntries: Matched entries and deduplicated file paths
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.00% 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: compile-error-based detection groundwork for third-party tool migration.
Description check ✅ Passed The description is directly related to the new detection logic, matcher, and tests added in the PR.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/compile-error-log-detection-rules

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.

Advisor review flagged this as worth a comment: CustomToolManager isn't in
ToolContractTypeReplacementRules, so it wasn't picked up by the token
derivation. It's safe to omit because every V2 file referencing it also
carries a legacy-namespace reference, which already yields a match.
@hatayama
hatayama merged commit 2822b27 into feature/migration-error-driven-autoscan-integration Jul 22, 2026
2 checks passed
@hatayama
hatayama deleted the feature/compile-error-log-detection-rules branch July 22, 2026 14:21
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