Skip to content

fix(release): write the native version transform as exact UTF-8 LF bytes - #120

Merged
abrichr merged 1 commit into
mainfrom
fix/desktop-native-release-windows
Aug 19, 2026
Merged

fix(release): write the native version transform as exact UTF-8 LF bytes#120
abrichr merged 1 commit into
mainfrom
fix/desktop-native-release-windows

Conversation

@abrichr

@abrichr abrichr commented Aug 19, 2026

Copy link
Copy Markdown
Member

What

Make set_native_version produce byte-identical output on every platform.

Why

main failed on windows-latest for Python 3.11 and 3.12 after #115:

FAILED tests/test_native_release.py::test_git_version_transform_requires_the_exact_reconstructed_tree
FAILED tests/test_native_release.py::test_git_version_advance_refuses_a_stale_or_equal_target
ValueError: native tag differs from the exact deterministic set-version output:
package.json, package-lock.json, src-tauri/Cargo.toml, src-tauri/Cargo.lock,
src-tauri/tauri.conf.json

validate_git_version_transform reconstructs the five-file transform from the
base ref and compares every byte with the candidate tag's Git blobs, which
store LF. set_native_version wrote those files with Path.write_text, which
opens in text mode and rewrites every \n as \r\n on Windows. Two reads also
omitted encoding=, so they decoded with the locale default. All five files
therefore differed. test.yml runs the Linux lane only for pull requests, so
the exact-head checks on #115 could not see it.

This is a portability defect, not a tag defect. The release workflow runs on
ubuntu-22.04, so no published release was affected — but a byte-exactness
guarantee should not depend on which platform evaluates it.

How

  • set_native_version reads and writes all five sources as explicit UTF-8
    bytes, so the transform emits LF everywhere.
  • The test fixture writes UTF-8 LF bytes, and each temporary repository sets
    core.autocrlf=false. Git for Windows defaults that to true and would
    otherwise rewrite the very blobs the transform is compared against.
  • New test_set_native_version_writes_utf8_lf_bytes_on_every_platform pins the
    invariant so a future text-mode write fails on any runner, not only Windows.

Tests

  • Full suite: 1027 passed.
  • ruff check engine/ tests/ scripts/: passed.

🤖 Generated with Claude Code

`validate_git_version_transform` reconstructs the five-file version transform
from the base ref and compares every resulting byte with the candidate tag's
Git blobs. `set_native_version` produced those bytes with `Path.write_text`,
which opens the file in text mode: on Windows every `\n` becomes `\r\n`, and
two of the reads omitted `encoding=` so they decoded with the locale default.

The reconstruction therefore never matched an LF blob on Windows. All five
files were reported as differing, and `main` failed on windows-latest for
Python 3.11 and 3.12:

    ValueError: native tag differs from the exact deterministic set-version
    output: package.json, package-lock.json, src-tauri/Cargo.toml,
    src-tauri/Cargo.lock, src-tauri/tauri.conf.json

Read and write the five sources as explicit UTF-8 bytes. The transform is now
byte-identical on every platform, which is what the comparison assumes.

The tests carried the same platform dependence, so make them exact too: the
fixture writes UTF-8 LF bytes, and each temporary repository sets
`core.autocrlf=false` so the committed blobs equal those bytes. Git for Windows
defaults that setting to `true` and would otherwise rewrite the blobs the
transform is compared against.

New test `test_set_native_version_writes_utf8_lf_bytes_on_every_platform` pins
the invariant directly, so a future text-mode write is caught on any runner
rather than only on Windows.

Tests: full suite 1027 passed. Ruff passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrichr
abrichr merged commit f4f1235 into main Aug 19, 2026
17 checks passed
@abrichr
abrichr deleted the fix/desktop-native-release-windows branch August 19, 2026 22:58
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