Skip to content

test(desktop): restore exact host bytes in the reversion tests on Windows - #2281

Merged
abrichr merged 1 commit into
mainfrom
test/desktop-release-intent-windows-newlines
Nov 19, 2026
Merged

abrichr merged 1 commit into
mainfrom
test/desktop-release-intent-windows-newlines

Conversation

@abrichr

@abrichr abrichr commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

#2277 fixed the macOS hang but broke four tests on Windows. Packages run 44561131756 on main (43402aa) failed both Windows engine-test jobs:

  • test_exact_reversion_after_combination_discards_merged_feature_intent[fix-patch] and [chore-None]
  • test_test_merge_keeps_a_canceled_feature_out_of_surviving_intent[fix-patch] and [chore-None]

Each reported assert 'minor' == 'patch' or assert 'minor' == None.

Cause

The fault is in the tests, not in the release scripts. Both tests restore a file to its earlier content with:

host.write_text(_git(repo, "show", base + ":src/host.txt") + "\n")

On Windows the fixture's src/host.txt blob holds CRLF, because write_text wrote it and the fixture turns core.autocrlf off. Before #2277 the test helper ran git with text=True, which turned CRLF into LF, and write_text then wrote CRLF again, so the bytes matched. #2277 changed the helper to decode the raw output, which keeps CRLF, and write_text then wrote CR CR LF. The restore was no longer exact, so the merged feature commit stayed in the release intent and the level came out as minor.

The dispatched run on the #2277 branch (44554323294) had the same four Windows failures. I reported that pull request while its Windows jobs were still running and did not go back to them.

Fix

  • The two tests write the blob's bytes back (host.write_bytes(_blob(...))), which is what "restore the exact host" means on every platform.
  • The test helper _git normalizes line endings to \n, as the text-mode call did, so no other caller changes behaviour.

Only tests/ changes. No version bump; check_release_intent.py passes.

Testing

  • Local, macOS, Python 3.12: the four tests pass.
  • Windows: in dispatched Packages run 44568487040 at d3b20c4, both Windows engine-test jobs passed (py3.12: 2004 passed, 42 skipped, 0 failed), and the four tests above show PASSED. In the same run the Linux jobs and macOS py3.11 passed; macOS py3.12 was cancelled before it finished.

…dows

Since #2277 the test helper returns git output without text-mode newline
translation. Two tests wrote a CRLF blob back with write_text, which on
Windows turned each CRLF into CR CR LF, so the reversion was no longer
exact and the feature commit stayed in the release intent. The tests now
write the blob's bytes back, and the helper normalizes line endings as the
text-mode call did.
@abrichr

abrichr commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: d3b20c4

This is a tests-only change, and it fixes the cause the author describes. The two reversion tests now write the blob's exact bytes back with _blob(). _git() turns CRLF and lone CR into LF, the way text=True used to. No release script changes. I found nothing blocking.

Tests at this head (Linux x86_64, locked desktop env)

  • tests/test_release_intent.py: 389 passed on Python 3.11. Ruff check and format are clean.
  • Windows reproduced on Linux. I added a small pytest plugin that makes Path.write_text write \r\n, as it does on Windows, so the test repos commit CRLF blobs.
    • On main (43402aa), the four reported tests fail: exact_reversion_after_combination...[fix-patch|chore-None] and test_merge_keeps_a_canceled_feature...[fix-patch|chore-None].
    • At this head all four pass.
  • Under the same simulation, the full module has 3 other failures on both main and this head: test_a_stuck_git_command_fails_with_its_name and generated_version_resolution...[True-*]. They weren't among the four Windows failures. The likely cause is my blanket CRLF patch, for example a CRLF shebang in the fake git script. I count them as artifacts of the simulation, not findings. A real Windows run is the only proof.

Can the release scripts mishandle CRLF the same way? (coordinator's question) I don't see a path.

CI

  • PR checks: 23 pass, 29 skipped by the path filter, and packages-gate pending when I looked.
  • The Windows proof, dispatched Packages run 44568487040 at this head, was still running. Windows engine tests py3.11 and py3.12 were in progress. Ubuntu py3.11/3.12 and macOS py3.11 engine tests passed, and so did the Windows native installer.
  • Please don't merge until both Windows engine-test jobs in that run are green. ci(desktop): start git without forking in the release tooling and its tests #2277's own run showed these failures before it merged.

Generality gate: test-harness change only, with no app- or customer-specific terms. Pass.

Limits: I couldn't run anything on Windows or macOS. The CRLF result above is a Linux simulation.

@abrichr
abrichr merged commit 1cf891e into main Nov 19, 2026
114 of 116 checks passed
@abrichr
abrichr deleted the test/desktop-release-intent-windows-newlines branch November 19, 2026 17:31
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