Unify canonical conformance JSONL bytes

Merged
TA
3mo ago
+56-32

Summary

  • encode normalized conformance events through one canonical UTF-8 JSONL line function
  • make trace hashing, CLI reduced traces, and campaign artifact traces consume those exact bytes
  • write event artifacts in binary mode so newline and Unicode bytes are part of the explicit contract
  • add a non-ASCII regression that proves published trace SHA-256 equals the artifact bytes

Verification

  • full pytest suite passed
  • Black, Flake8, mypy, Bandit, compileall, and diff checks passed
  • fresh 1,000-trace issue-88 campaign is byte-for-byte identical to the pre-change artifact tree
  • 15,739-event Flash handoff still produces the canonical four-event fixture byte-for-byte
  • both distributions build; Twine, sdist/wheel agreement, ownership, migration, resolver, and clean-install checks pass
  • conformance-only wheel qualification passes without NumPy or psutil

Summary by cubic

Unified conformance event JSONL encoding and hashing so trace SHA-256 matches the exact artifact bytes, including non-ASCII characters. All event writers now share one canonical UTF-8 encoder and write in binary mode.

  • Bug Fixes
    • Added canonical_event_jsonl_line() to produce compact, sorted-key UTF-8 JSONL lines with a trailing newline and no ASCII escaping.
    • Updated trace hashing, CLI reduced traces, and campaign artifacts to use the same bytes; files are written in binary mode.
    • Added a regression test to verify the on-disk bytes equal the reported trace hash and that non-ASCII remain UTF-8 (not \uXXXX escaped).