Skip to content

fix(tests): force UTF-8 in non-ASCII SKILL.md fixture (Windows CI hotfix)#979

Merged
danielmeppiel merged 1 commit intomainfrom
fix/test-non-ascii-frontmatter-utf8
Apr 27, 2026
Merged

fix(tests): force UTF-8 in non-ASCII SKILL.md fixture (Windows CI hotfix)#979
danielmeppiel merged 1 commit intomainfrom
fix/test-non-ascii-frontmatter-utf8

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

Problem

tests/unit/test_skill_bundle.py::TestSkillBundleValidation::test_non_ascii_frontmatter_warning fails on Windows runners on the v0.9.4 release branch (job 73133340014).

Path.write_text() defaults to the system locale encoding. On windows-latest that is cp1252, so the non-ASCII description bytes are written incorrectly. The validator then fails to decode the file as UTF-8 and surfaces a hard parse error:

'utf-8' codec can't decode byte ... position 39: invalid continuation byte

The test asserts is_valid == True and a "non-ASCII" warning — i.e. the validator's tolerant code path for valid UTF-8 with non-ASCII bytes. The fixture has to actually be valid UTF-8 for that path to fire.

Fix

Pin encoding="utf-8" on the one write_text call that contains non-ASCII content. The other 24 write_text calls in the file are ASCII-only and are unaffected.

Verification

uv run pytest tests/unit/test_skill_bundle.py -x
============================== 31 passed in 0.62s ==============================

Scope

  • One-line test fix, no production code touched.
  • Should be cherry-picked to v0.9.4 to unblock the release.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

test_non_ascii_frontmatter_warning fails on Windows runners because
Path.write_text() defaults to the system locale (cp1252 on
windows-latest). The non-ASCII description bytes get mangled on disk,
the validator fails to decode as UTF-8, and the test sees a hard error
instead of the intended warning.

Pin encoding='utf-8' so bytes-on-disk are valid UTF-8 on every platform,
which exercises the actual non-ASCII warning code path the test asserts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 05:23
@danielmeppiel danielmeppiel merged commit 5c0976b into main Apr 27, 2026
17 checks passed
@danielmeppiel danielmeppiel deleted the fix/test-non-ascii-frontmatter-utf8 branch April 27, 2026 05:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Windows CI-only test failure by ensuring the non-ASCII SKILL.md fixture is written as valid UTF-8, so the validator exercises the intended "non-ASCII warning" (not decode error) path.

Changes:

  • Set encoding="utf-8" on the Path.write_text() call that writes non-ASCII frontmatter content in test_non_ascii_frontmatter_warning.
Show a summary per file
File Description
tests/unit/test_skill_bundle.py Writes the non-ASCII SKILL.md fixture using UTF-8 to avoid cp1252 corruption on Windows and keep the test exercising the warning path.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

sd.mkdir()
(sd / "SKILL.md").write_text(
"---\nname: unicode-skill\ndescription: Ünïcödé description\n---\n# x\n"
"---\nname: unicode-skill\ndescription: Ünïcödé description\n---\n# x\n",
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file contains non-ASCII characters directly in the Python string literal ("Unic..." with accented letters). Repo guidelines require source files to remain printable ASCII; please spell these characters using Unicode escape sequences (e.g., \u00dc) so the source stays ASCII while still writing non-ASCII content into SKILL.md via UTF-8.

Copilot generated this review using guidance from repository custom instructions.
danielmeppiel pushed a commit that referenced this pull request Apr 27, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants