Skip to content

fix: Avoid dependency conflicts from bundled metadata DLLs#1288

Open
hatayama wants to merge 4 commits into
mainfrom
fix/issue-1284-memorypack-unsafe
Open

fix: Avoid dependency conflicts from bundled metadata DLLs#1288
hatayama wants to merge 4 commits into
mainfrom
fix/issue-1284-memorypack-unsafe

Conversation

@hatayama

@hatayama hatayama commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Prevent consuming Unity projects from implicitly referencing bundled metadata validation DLLs from Unity CLI Loop.
  • Keep Unity CLI Loop metadata validation working through explicit editor-only package references.

User Impact

  • Projects that install packages such as MemoryPack can keep their own System.Runtime.CompilerServices.Unsafe dependency without Unity CLI Loop bundled DLLs being selected accidentally.
  • This reduces dependency clashes without changing the public workflow.

Changes

  • Move the bundled metadata validation dependency DLLs under the editor metadata validation package area.
  • Mark those DLLs as explicitly referenced only so Unity does not expose them as implicit project references.
  • Give the bundled dependency assemblies private package-specific identities and update their internal references to match.
  • Remove the orphaned Plugins metadata left after moving the DLLs.
  • Add package metadata tests for the explicit-reference flags, private assembly identities, and orphaned metadata removal.

Verification

  • Unity compile via the project-local CLI: 0 errors, 0 warnings
  • Kensho project compile via the project-local CLI: 0 errors, 0 warnings
  • npm --prefix Packages/src/Cli~ run lint
  • npm --prefix Packages/src/Cli~ run build
  • npm --prefix Packages/src/Cli~ run test:cli
  • npm --prefix Packages/src/Cli~ run test:cli -- --runTestsByPath src/tests/package-metadata.test.ts
  • codex-review --mode branch main

Closes #1284

Keep bundled CodeAnalysis dependencies explicit-only so consuming Unity projects do not receive uLoop's System.Runtime.CompilerServices.Unsafe.dll through implicit plugin references.
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds test-only constants for Unity dependency .dll.meta paths and private assembly identities, repo-relative helpers to read Unity asset text and DLL bytes, and Jest tests that (1) assert each dependency meta file contains isExplicitlyReferenced: 1, (2) verify DLL bytes include declared assembly reference names, and (3) expect loading an orphaned Plugins.meta path to throw.

Changes

Package metadata tests

Layer / File(s) Summary
Test data: meta paths and private assembly list
Packages/src/Cli~/src/__tests__/package-metadata.test.ts
Defines explicit dependency .dll.meta paths and a structured list of private assembly identities with expected referenced assembly names.
Repo-relative Unity asset loaders
Packages/src/Cli~/src/__tests__/package-metadata.test.ts
Adds loadUnityPackageText(relativePath) and loadUnityPackageBytes(relativePath) helpers to read checked-in Unity asset text and raw DLL bytes from stable repo-relative locations.
Meta explicit-reference tests and orphaned path error
Packages/src/Cli~/src/__tests__/package-metadata.test.ts
Adds a Jest test asserting each listed .dll.meta contains isExplicitlyReferenced: 1 and a test expecting reading an orphaned Plugins.meta path to throw.
Private assembly DLL bytes reference test
Packages/src/Cli~/src/__tests__/package-metadata.test.ts
Adds a Jest test that loads configured private assembly DLL bytes and asserts the bytes contain the primary assembly identity and all declared referenced assembly names.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Linked Issues check ✅ Passed The PR addresses issue #1284 by marking bundled CodeAnalysis plugin DLLs as explicitly referenced only and adding metadata regression tests, preventing implicit exposure that caused compilation conflicts.
Out of Scope Changes check ✅ Passed All changes are scoped to test additions verifying metadata validation settings for bundled DLLs, directly supporting the linked issue objective of preventing package conflicts.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions 'bundled metadata DLLs' but the PR's primary objective is to prevent package conflicts by marking CodeAnalysis DLLs as explicitly referenced only, not about avoiding dependency conflicts in general.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/issue-1284-memorypack-unsafe

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 and usage tips.

@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 added 3 commits June 5, 2026 23:34
Move the bundled System.* metadata validation assemblies under the owning editor assembly with uLoop-specific file names, so consumer asmdefs that reference System.Runtime.CompilerServices.Unsafe.dll resolve their own package dependency instead of uLoop's private copy.
Rename the bundled metadata validation dependency assembly identities to match their uLoop-specific DLL names, so Unity and Burst do not resolve them as System.* assemblies while consumer packages keep using their own dependencies.
Delete the empty package Plugins folder metadata left after moving the metadata validation DLLs, and add package metadata coverage so clean Unity imports do not recreate an empty folder or warn about the orphan.
@hatayama hatayama changed the title fix: Avoid package conflicts from bundled CodeAnalysis DLLs fix: Avoid dependency conflicts from bundled metadata DLLs Jun 5, 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.

A Error about Unsafe.dll.

1 participant