Skip to content

Test YAML runner writes UTF-8, mangles UserTalk 0xC7 marker; source of #866 false encoding-trap diagnosis #880

Open

Description

@jsavin

Rationale

tests/integration/runner.py:339 writes YAML script files with platform-default encoding (UTF-8), so a literal 0xC7 (UserTalk comment marker) in YAML source arrives as TWO bytes at runtime and breaks single-quoted character constants. This is the exact mangling that produced #866's false "reinstall destroys scripts" report. Fix: document \xc7 escape convention in docs/TESTING_GUIDE.md and consider making the runner write MacRoman or reject non-ASCII with clear error.

Current State

YAML encoding issue identified (2026-08-10):

Consequence:

Desired Outcome

Prevent encoding mangling of UserTalk-specific bytes:

  1. Document 0xC7 escape convention in docs/TESTING_GUIDE.md
  2. Consider making runner write MacRoman (UserTalk native encoding)
  3. OR reject non-ASCII in YAML with clear error message
  4. Verify: test scripts with UserTalk comment markers work correctly

Recommendation

Option A (minimal, documentation):

Option B (runner change):

  • Modify runner to write YAML in MacRoman encoding (UserTalk native)
  • Requires output encoding override in Python
  • More robust but may affect other YAML tooling

Option C (validation):

  • Reject non-ASCII bytes in YAML with clear error: "YAML script contains non-ASCII; use \xNN escapes for UserTalk-specific bytes"
  • Prevents silent corruption

Recommended: A + C (document + validate)

Exit Criteria

Related Context

Methodology Note

This is a classic encoding trap: single-byte MacRoman values when passed through UTF-8 encoding become multi-byte sequences, causing subtle corruption of binary data and character literals. The trap was invisible until #866's investigation required tracing the exact bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2Medium priority - nice to havescope/quick-win< 4 hours, obvious solutiontype/bugDefect in existing functionality, needs fixworkstream/testingTest infrastructure and test cases

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions