Skip to content

fix: UTF-16BE skill files keep their byte order during setup - #1618

Merged
hatayama merged 1 commit into
v3-betafrom
fix/hatayama/prioritize-utf16-bom
Jul 8, 2026
Merged

hatayama merged 1 commit into
v3-betafrom
fix/hatayama/prioritize-utf16-bom

Conversation

@hatayama

@hatayama hatayama commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • UTF-16 big-endian skill files now keep their byte order when valid content resembles a little-endian carriage return.
  • BOM-less UTF-16 line-ending detection remains unchanged.

User Impact

  • Previously, a UTF-16BE text skill file with an explicit BOM could be routed through the little-endian heuristic when its payload contained bytes such as 0D 00. Setup could then rewrite valid content using the wrong byte order.
  • Explicit UTF-16 BOMs are now authoritative, so generated skill copies preserve their declared encoding while still normalizing CRLF to LF.

Root Cause

  • The little-endian BOM and line-ending heuristic were combined in the first branch. A BE BOM did not match the LE BOM check, but the LE heuristic still scanned the BE payload before the explicit BE BOM branch ran.

Changes

  • Evaluate explicit little-endian and big-endian BOMs before either BOM-less line-ending heuristic.
  • Keep the existing LE-then-BE heuristic order for content without a BOM.
  • Add a regression test containing UTF-16BE U+0D00 followed by CRLF.
  • Add BOM-less LE and BE characterization tests to protect the existing heuristic paths.

Verification

  • TDD Red: the new ambiguous UTF-16BE case failed while the other 8 normalizer tests passed.
  • TDD Green: SkillFileContentNormalizerTests 9 passed.
  • Repo-local Unity compile: 0 errors, 0 warnings.
  • SkillInstallLayoutTests: 18 passed.
  • ToolSkillSynchronizerTests: 52 passed.
  • git diff --check.

Compatibility

  • Only local skill file byte normalization changes. Wire formats and protocol declarations are unchanged.

Review in cubic

An explicit big-endian BOM could be overridden by the little-endian line-ending heuristic when valid BE payload bytes resembled a little-endian carriage return. This could rewrite the content with the wrong byte order.

Prioritize both explicit BOM checks before BOM-less heuristics. Add a reproducer for the ambiguous BE code unit and characterize the existing BOM-less LE and BE paths.
@coderabbitai

coderabbitai Bot commented Jul 8, 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: 18 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: c9f368db-8804-48a4-9475-44f08a64e478

📥 Commits

Reviewing files that changed from the base of the PR and between ed9aed0 and 4c3911b.

📒 Files selected for processing (2)
  • Assets/Tests/Editor/SkillFileContentNormalizerTests.cs
  • Packages/src/Editor/Infrastructure/SkillSetup/SkillFileContentNormalizer.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hatayama/prioritize-utf16-bom

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 7b09e42 into v3-beta Jul 8, 2026
10 checks passed
@hatayama
hatayama deleted the fix/hatayama/prioritize-utf16-bom branch July 8, 2026 13:27
@github-actions github-actions Bot mentioned this pull request Jul 11, 2026
RyanXie123 pushed a commit to RyanXie123/unity-cli-loop that referenced this pull request Sep 22, 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