From 40541b7854a09f1579d404d2b0cf529782c88a03 Mon Sep 17 00:00:00 2001 From: babyblueviper1 Date: Tue, 13 Oct 2026 05:42:04 +0000 Subject: [PATCH 1/2] conformance: read and write the manifest-reference fixtures as UTF-8 (#487 review) The loader used a bare read_text(), so on Windows the default cp1252 decoding broke test_fixtures_are_reproducible (the fixtures carry a section sign). The generator wrote with the default encoding too. Both are UTF-8 now; the six fixtures regenerate byte-identically. Co-Authored-By: Claude Opus 5.5 Signed-off-by: babyblueviper1 --- conformance/tests/test_manifest_ref_draft_vectors.py | 4 +++- conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conformance/tests/test_manifest_ref_draft_vectors.py b/conformance/tests/test_manifest_ref_draft_vectors.py index 66e45967..3705c63f 100644 --- a/conformance/tests/test_manifest_ref_draft_vectors.py +++ b/conformance/tests/test_manifest_ref_draft_vectors.py @@ -19,7 +19,9 @@ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey VECTOR_DIR = Path(__file__).parent / "vectors" / "manifest-ref-v0.3-draft" -VECTORS = [json.loads(p.read_text()) for p in sorted(VECTOR_DIR.glob("[0-9][0-9]-*.json"))] +VECTORS = [ + json.loads(p.read_text(encoding="utf-8")) for p in sorted(VECTOR_DIR.glob("[0-9][0-9]-*.json")) +] MUTANTS = ( "trusts_asserted_result", "unresolved_is_pass", diff --git a/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py b/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py index 165f4067..ddbf61e7 100644 --- a/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py +++ b/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py @@ -144,4 +144,6 @@ def vectors() -> list[dict]: if __name__ == "__main__": for v in vectors(): - (HERE / f"{v['name']}.json").write_text(json.dumps(v, indent=2, ensure_ascii=False) + "\n") + (HERE / f"{v['name']}.json").write_text( + json.dumps(v, indent=2, ensure_ascii=False) + "\n", encoding="utf-8" + ) From 93f1eb741a0c1ff6256277fd819f3be3e0204ede Mon Sep 17 00:00:00 2001 From: babyblueviper1 Date: Tue, 13 Oct 2026 14:13:42 +0000 Subject: [PATCH 2/2] conformance: pin newline="" so the manifest-ref generator writes byte-identically Rajnish Tiwari's review on #489 pointed out that write_text(encoding="utf-8") alone still lets Path.write_text translate "\n" to os.linesep (CRLF on Windows), so the six fixtures do not actually regenerate byte-identically cross-platform as the PR claimed, even though test_fixtures_are_reproducible wouldn't catch it (it compares parsed objects, not bytes). newline="" disables that translation; regenerating now produces no diff. Co-Authored-By: Claude Sonnet 5 Signed-off-by: babyblueviper1 --- conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py b/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py index ddbf61e7..0818c346 100644 --- a/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py +++ b/conformance/tests/vectors/manifest-ref-v0.3-draft/generate.py @@ -145,5 +145,5 @@ def vectors() -> list[dict]: if __name__ == "__main__": for v in vectors(): (HERE / f"{v['name']}.json").write_text( - json.dumps(v, indent=2, ensure_ascii=False) + "\n", encoding="utf-8" + json.dumps(v, indent=2, ensure_ascii=False) + "\n", encoding="utf-8", newline="" )