Skip to content

test(archive): decode and encode archive history as UTF-8, not the locale - #167

Merged
Paul-Kyle merged 1 commit into
phasespace-labs:mainfrom
chiruu12:utf8-archive-history
Aug 30, 2026
Merged

test(archive): decode and encode archive history as UTF-8, not the locale#167
Paul-Kyle merged 1 commit into
phasespace-labs:mainfrom
chiruu12:utf8-archive-history

Conversation

@chiruu12

Copy link
Copy Markdown
Contributor

Part of #93, the fourth and last of the four areas we agreed: /save output paths (#152), daily and status files (#153), executor outputs (#149), and archive history here.

Change

18 sites across test_archive_on_demand_664.py, test_archive_recall_485.py and test_ttl_archive_482.py now name encoding="utf-8". Seventeen are open / read_text / write_text on files Palinode itself wrote; the eighteenth is the _git helper's subprocess.run, which had text=True with no encoding and was caught by the guard rather than by me.

All three files join _SWEPT_TEST_FILES, so the area cannot regress.

Why the fixtures changed too

Every assertion in these files was ASCII, so they passed with or without the fix and would have been a regression guard rather than a reproduction. Two now carry non-ASCII, matching what #153 did:

  • test_archive_preserves_the_body keeps café, 日本語 in the body it asserts survives.
  • test_archive_history_round_trips_non_ascii is new, and puts a non-ASCII reason through the executor's history writer so the sibling file is read back the way palinode trace reads it.

Validation

LC_ALL=C LANG=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0 pytest \
  tests/test_archive_on_demand_664.py tests/test_archive_recall_485.py \
  tests/test_ttl_archive_482.py tests/test_utf8_encoding_guard.py

74 passed under ASCII stdio and under the normal locale. Reverting just the two read sites makes both new fixtures fail with UnicodeDecodeError, so they pin the defect rather than guarding a fix.

Full suite: 3254 passed, 10 skipped, 5 xfailed. ruff clean.

On closing #93

This finishes the four areas, but the issue's acceptance criteria ask for the suite to be exercised on native Windows, which I still cannot do. The ASCII-stdio harness stands in for cp1252 stdio and catches the decode mismatch, but it is not the same as a Windows run. Your call whether that closes #93 or whether it stays open for a real Windows pass.

Copilot AI lite review requested due to automatic review settings August 30, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Paul-Kyle

Copy link
Copy Markdown
Member

That's the fourth area, and the one I want to point at is the eighteenth site — subprocess.run with text=True and no encoding is not something a grep for open( finds, and you said the guard caught it rather than claiming it. You have done that in every one of these four, and it is the reason the ratcheting guard is worth having rather than just a checkbox.

The non-ASCII round-trip test is the right addition too. Every assertion in those files was ASCII, so without it the change would have been a regression guard rather than a reproduction — same reasoning as #153.

Merging. That's all four areas, so I'm closing #93 with this — details on that thread. Short version: your part is complete, and re-reading the acceptance list to write that up turned up a real gap in the Windows work that predates you.

@Paul-Kyle
Paul-Kyle merged commit 3695678 into phasespace-labs:main Aug 30, 2026
9 checks passed
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.

Native Windows: test suite fails on directory fsync and locale-default file encoding

3 participants