Skip to content

fix: Duplicate skills now follow stable source priority#1614

Merged
hatayama merged 1 commit into
v3-betafrom
fix/hatayama/preserve-skill-source-root-order
Jul 8, 2026
Merged

fix: Duplicate skills now follow stable source priority#1614
hatayama merged 1 commit into
v3-betafrom
fix/hatayama/preserve-skill-source-root-order

Conversation

@hatayama

@hatayama hatayama commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Duplicate skill names now resolve using a stable source priority.
  • Unity skill discovery now guarantees the same ordered-root structure as the native CLI.

User Impact

  • When the same skill name exists in multiple roots, the earlier configured source consistently wins.
  • Assets remain ahead of direct packages, direct packages ahead of manifest-local packages, and manifest-local packages ahead of PackageCache entries.

Changes

  • Store normalized source roots in an ordered list while using a separate ordinal set only for deduplication.
  • Added a behavior test covering each adjacent priority boundary available in a temporary project.
  • Kept CLI-only root behavior unchanged; its current-project-only gate is not exposed through a test-only seam.

Verification

  • Characterization approach: the priority test passed before the implementation on the current Mono runtime, because its present HashSet behavior happens to preserve insertion order. The change removes reliance on that unspecified API behavior rather than reproducing a deterministic failure.
  • dist/darwin-arm64/uloop compile --project-path <PROJECT_ROOT> (0 errors, 0 warnings)
  • SkillInstallLayoutTests (11 passed)
  • ToolSkillSynchronizerTests (52 passed)
  • git diff --check

Review in cubic

Keep discovery roots in an ordered list while using a separate set for
path deduplication, so duplicate skill names consistently honor the
CLI-only, Assets, package, manifest, and cache priority.
@coderabbitai

coderabbitai Bot commented Jul 8, 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: 9e3499e7-24f7-4a83-828a-1db1d59da9e6

📥 Commits

Reviewing files that changed from the base of the PR and between 49f0302 and 0629486.

📒 Files selected for processing (2)
  • Assets/Tests/Editor/SkillInstallLayoutTests.cs
  • Packages/src/Editor/Infrastructure/SkillSetup/SkillSourceRootEnumerator.cs

📝 Walkthrough

Walkthrough

SkillSourceRootEnumerator now returns skill source roots in deterministic discovery order via an ordered list combined with a deduplication set, replacing prior HashSet iteration. A new test validates that GetSkillSourceInfos resolves overlapping skill names from the earlier-precedence source root, using a new WriteSourceSkill test helper.

Changes

Deterministic Source Root Ordering

Layer / File(s) Summary
Ordered root enumeration
Packages/src/Editor/Infrastructure/SkillSetup/SkillSourceRootEnumerator.cs
EnumerateSkillSourceRoots and AddSkillSourceRoot are reworked to build an orderedRoots list alongside a seenRoots set, normalizing paths and yielding roots in discovery order.
Precedence test coverage
Assets/Tests/Editor/SkillInstallLayoutTests.cs
Adds GetSkillSourceInfos_WhenNamesOverlap_PrefersEarlierSourceRoot and a WriteSourceSkill helper to verify overlapping skill names resolve ToolName from the earlier-precedence source root.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#951: Directly affects the layout-aware skill source discovery logic introduced in SkillInstallLayout that this PR tests and reorders.
  • hatayama/unity-cli-loop#980: Both PRs touch SkillInstallLayout skill-source resolution and precedence behavior.
  • hatayama/unity-cli-loop#1588: Both PRs extend SkillInstallLayoutTests.cs to validate GetSkillSourceInfos behavior for overlapping skill names across source roots.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making duplicate skill resolution follow stable source priority.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the source-priority fix and verification.
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 fix/hatayama/preserve-skill-source-root-order

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 2 files

Re-trigger cubic

@hatayama
hatayama merged commit 95270bb into v3-beta Jul 8, 2026
10 checks passed
@hatayama
hatayama deleted the fix/hatayama/preserve-skill-source-root-order branch July 8, 2026 12:05
@github-actions github-actions Bot mentioned this pull request Jul 11, 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