Skip to content

chore: Move asmdef reference migration policy into Domain - #1575

Merged
hatayama merged 1 commit into
v3-betafrom
chore/extract-asmdef-reference-policy
Jul 7, 2026
Merged

hatayama merged 1 commit into
v3-betafrom
chore/extract-asmdef-reference-policy

Conversation

@hatayama

@hatayama hatayama commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Move pure asmdef reference migration decisions into Domain.
  • Keep Infrastructure responsible only for JSON parsing and applying the final reference list.

User Impact

  • No user-visible behavior change; third-party tool migration keeps producing the same asmdef rewrites.
  • The remaining C4-11 asmdef policy is now separated from JObject/JArray mutation, making the architecture boundary clearer.

Changes

  • Add a Domain result DTO for migrated asmdef references.
  • Add a pure Domain policy method that returns the final reference list and replacement count.
  • Trim Infrastructure asmdef migration rules to convert JArray values to strings, call the Domain policy, and write the resulting JArray only when changed.
  • Add direct Domain tests while preserving the existing facade behavior pins.

Verification

  • dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)" -> 0 errors / 0 warnings
  • 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.ThirdPartyToolMigrationRulesTests" -> 168/168 passed

Review in cubic

Move the pure asmdef reference decision logic into Domain so Infrastructure only adapts JObject/JArray data to string references and applies the final reference list.

Keep existing facade migration behavior pinned while adding direct Domain tests for expansion, required-reference addition, and current reference deduplication.
@coderabbitai

coderabbitai Bot commented Jul 7, 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: d1aee4cf-d09c-4915-989a-e8c98d597ab9

📥 Commits

Reviewing files that changed from the base of the PR and between b095e5f and 5f48d66.

📒 Files selected for processing (4)
  • Assets/Tests/Editor/ThirdPartyToolMigrationRulesTests.cs
  • Packages/src/Editor/Domain/ThirdPartyToolMigrationAsmdefReferenceRules.cs
  • Packages/src/Editor/Domain/ThirdPartyToolMigrationRuleData.cs
  • Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationAsmdefRules.cs

📝 Walkthrough

Walkthrough

Adds a new ThirdPartyToolMigrationAsmdefReferenceMigrationResult struct and a public MigrateAsmdefReferences domain method that maps, deduplicates, and appends required current references. Rewires MigrateAsmdefSource in the Infrastructure layer to use this centralized method, and adds corresponding tests.

Changes

Asmdef Reference Migration Centralization

Layer / File(s) Summary
Migration result contract
Packages/src/Editor/Domain/ThirdPartyToolMigrationRuleData.cs
Adds ThirdPartyToolMigrationAsmdefReferenceMigrationResult readonly struct storing References, ReplacementCount, and a derived Changed flag, with constructor validation.
Domain migration and required-reference helpers
Packages/src/Editor/Domain/ThirdPartyToolMigrationAsmdefReferenceRules.cs
Adds public MigrateAsmdefReferences method that maps references to migrated replacements, deduplicates via a HashSet key, counts replacements, and appends required current references (ToolContracts, Application, Domain, FirstPartyScreenshot) based on boolean flags.
Infrastructure caller rewiring
Packages/src/Editor/Infrastructure/ThirdPartyToolMigration/ThirdPartyToolMigrationAsmdefRules.cs
Updates imports/aliases, removes old in-file helper methods, and rewrites MigrateAsmdefSource to read references into a string array, delegate to MigrateAsmdefReferences, and rebuild the JSON references array via new ReadReferenceValues/CreateReferencesArray helpers.
Tests for migration result and reference migration
Assets/Tests/Editor/ThirdPartyToolMigrationRulesTests.cs
Adds tests for null-reference validation, legacy reference expansion, missing required reference addition, and duplicate deduplication in MigrateAsmdefReferences.

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

Possibly related PRs

  • hatayama/unity-cli-loop#1125: Touches the same third-party asmdef reference migration/rewriting logic and test coverage.
  • hatayama/unity-cli-loop#1386: Adjusts V3 asmdef reference migration expectations around Application/Domain/FirstPartyTools GUID handling and dedup.
  • hatayama/unity-cli-loop#1570: Modifies the same ThirdPartyToolMigrationAsmdefReferenceRules/ThirdPartyToolMigrationAsmdefRules implementation and requiresToolContractsReference handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main refactor: moving asmdef reference migration policy into the Domain layer.
Description check ✅ Passed The description matches the changeset, describing the Domain policy extraction, Infrastructure adapter changes, and added tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 chore/extract-asmdef-reference-policy

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

@hatayama
hatayama merged commit 8cd2402 into v3-beta Jul 7, 2026
10 checks passed
@hatayama
hatayama deleted the chore/extract-asmdef-reference-policy branch July 7, 2026 00:33
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