Skip to content

fix: preserve trace SVG byte contract on Windows - #20

Merged
Anionex merged 1 commit into
mainfrom
codex/windows-trace-byte-contract
Aug 14, 2026
Merged

fix: preserve trace SVG byte contract on Windows#20
Anionex merged 1 commit into
mainfrom
codex/windows-trace-byte-contract

Conversation

@Anionex

@Anionex Anionex commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Problem

On Windows, Path.write_text() translates each SVG \n to \r\n, while trace reports len(svg). Multi-line output therefore reports fewer bytes than were written, and strict consumers reject the artifact. len(svg) is also a character count rather than a UTF-8 byte count.

Downstream context: Anionex/dsh-vision-toolkit#8.

Fix

  • encode the finalized SVG once as UTF-8 and write those exact bytes with Path.write_bytes()
  • report the actual byte count returned by the write operation, keeping the on-disk artifact and stdout contract identical
  • cover multi-line LF preservation and non-ASCII byte counting without requiring optional tracing dependencies
  • run the focused trace regression in both the Ubuntu core matrix and the Windows CI job

Verification

  • python3 -m py_compile vision_proxy.py vision_client.py ground.py detect.py bin/glance bin/trace bin/crop
  • required core tests: image rewrite, focus hint, Anthropic rewrite, proxy smoke, and vision client — passed
  • python3 tests/test_trace.py — focused unit regression passed
  • uv run --with pillow --with vtracer python tests/test_trace.py — full trace CLI path passed
  • git diff --check
  • GitHub CI: Python 3.11, Python 3.14, Windows, and extensions — passed

This is a non-UI CLI contract fix; there is no browser path. The byte-for-byte assertion and Windows CI execution cover the affected behavior.

@Anionex
Anionex force-pushed the codex/windows-trace-byte-contract branch from 79cadb4 to 8ccf9d7 Compare August 14, 2026 05:20
@Anionex
Anionex merged commit 9e2a165 into main Aug 14, 2026
4 checks passed
@Anionex
Anionex deleted the codex/windows-trace-byte-contract branch August 14, 2026 06:00
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