Skip to content

📝 Scope the round-trip byte-for-byte promise to UTF-8#209

Merged
frenck merged 1 commit into
mainfrom
frenck/docs-utf8-roundtrip-scope
Jul 3, 2026
Merged

📝 Scope the round-trip byte-for-byte promise to UTF-8#209
frenck merged 1 commit into
mainfrom
frenck/docs-utf8-roundtrip-scope

Conversation

@frenck

@frenck frenck commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Breaking change

None. Documentation only, no behavior change.

Proposed change

YAMLRocks reads UTF-16 and UTF-32 (the YAML 1.2 spec requires it, detected by a byte order mark or the leading-byte pattern), but it decodes to text internally and re-emits as UTF-8. So a UTF-16 file loads to the right data, yet re-emitting it under OPT_ROUND_TRIP produces that text as UTF-8, not the original UTF-16 bytes.

The byte-for-byte guarantee only ever meant UTF-8, which is what configuration files use in practice. This scopes the claim explicitly in the two places that make it, the round-trip guide and the stability roadmap, rather than imply an encoding-preserving round-trip that is not offered. It documents current behavior; nothing changes in code.

Context: the yamlrocks-vs-PyYAML round-trip differential surfaced UTF-16 inputs as non-byte-identical on re-emit. That is expected (transcoding to UTF-8), so the fix is to state the guarantee's scope, not to change the round-trip.

Type of change

  • Dependency or tooling upgrade
  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Deprecation (replaces or removes a feature, with a migration path)
  • Breaking change (a fix or feature that changes existing behavior)
  • Code quality, refactor, or test-only change
  • Documentation only

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to: the yamlrocks-vs-PyYAML differential oracle
  • Link to a separate documentation pull request:

Checklist

  • I have read the AI Policy, and this pull request was not created by an autonomous agent.
  • I fully understand the code in this pull request and can explain every line, including any AI-assisted changes.
  • The change is covered by tests, and uv run pytest passes locally. A pull request cannot be merged unless CI is green.
  • uv run ruff check . and uv run ruff format --check . pass.
  • cargo fmt --check and cargo clippy --all-targets -- -D warnings pass.
  • Round-trip fidelity is preserved: an unmodified document still re-emits byte-for-byte.
  • No commented-out or dead code is left in the pull request.

If the change is user-facing:

  • Documentation under docs/ is added or updated, and docs/verify_examples.py still passes.

YAMLRocks reads UTF-16 and UTF-32 (the YAML spec requires it, detected by a byte
order mark or the leading-byte pattern), but it decodes to text internally and
re-emits as UTF-8. So a UTF-16 file loads to the right data, yet re-emitting it
under OPT_ROUND_TRIP produces that text as UTF-8, not the original UTF-16 bytes.

The byte-for-byte guarantee only ever meant UTF-8, which is what configuration
files use in practice. Say so in the round-trip guide and the stability roadmap,
rather than imply an encoding-preserving round-trip we do not offer. No behavior
change; this documents what already happens.
Copilot AI review requested due to automatic review settings July 3, 2026 21:46
@frenck frenck added the documentation Solely about the documentation of the project. label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@frenck, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b09fba78-eb1b-40a1-8e2b-0d08789554df

📥 Commits

Reviewing files that changed from the base of the PR and between a8fa1b7 and 726e648.

📒 Files selected for processing (2)
  • docs/src/content/docs/guides/round-trip.md
  • docs/src/content/docs/stability-roadmap.md

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.

@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing frenck/docs-utf8-roundtrip-scope (726e648) with main (a8fa1b7)

Open in CodSpeed

Copilot AI 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.

Pull request overview

This documentation-only PR clarifies that YAMLRocks's round-trip "byte-for-byte" guarantee applies only to UTF-8 input. YAMLRocks reads UTF-16/UTF-32 (per the YAML 1.2 spec, detected by BOM or null-byte pattern) but transcodes them to UTF-8 internally, so re-emitting a non-UTF-8 file produces the same text as UTF-8 rather than the original bytes. The change adds this scope to the two most prominent contract pages (the round-trip guide and the stability roadmap) without altering any code behavior. I verified the claims against detect_encoding/bytes_to_string in src/ffi/mod.rs and the UTF-8-only real-world corpus filter — both accurately support the documented behavior.

Changes:

  • Adds a :::note[Byte fidelity is a UTF-8 guarantee] block to the round-trip guide explaining the UTF-16/UTF-32 transcoding behavior and advising UTF-8 conversion for byte-for-byte editing.
  • Qualifies the stability roadmap's "Round-trip preservation" contract to specify an unmodified UTF-8 document re-emits byte-for-byte.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/src/content/docs/guides/round-trip.md Adds a note scoping the byte-for-byte promise to UTF-8 and describing UTF-16/32 transcoding.
docs/src/content/docs/stability-roadmap.md Qualifies the round-trip preservation contract to UTF-8, noting UTF-16/32 re-emit as UTF-8.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/src/content/docs/guides/round-trip.md
@codecov-commenter

codecov-commenter commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.07%. Comparing base (aea7f2d) to head (726e648).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   92.56%   93.07%   +0.51%     
==========================================
  Files          40       40              
  Lines       12051    12672     +621     
==========================================
+ Hits        11155    11795     +640     
+ Misses        896      877      -19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frenck frenck merged commit eb7572a into main Jul 3, 2026
72 of 73 checks passed
@frenck frenck deleted the frenck/docs-utf8-roundtrip-scope branch July 3, 2026 21:58
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Solely about the documentation of the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants