You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Measurement tools read source losslessly: route tests/tools' errors="ignore"/"replace" through read_source, extend the lint gate #3869
Part of epic #3811. This is the follow-up to #3813, which covered only gitgalaxy/ (PR #3866).
Problem
The engine now decodes every file without losing a byte. The tools that measure the engine still don't. On main, about 69 source reads across about 23 files under tests/ still use errors="ignore" or errors="replace":
File
Sites
What it is
tests/tools/cobol_answer_key.py
29
the hand-verified COBOL answer-key reader (Source)
tests/tools/cross_verify_sections.py
12
blind cross-verification packets
tests/tools/refraction_differential.py
6
the refraction differential
tests/tools/import_graph_accuracy.py
5
the import-graph accuracy audit
the rest (rule_probe, wrapper_probe, ast_accuracy_audit, recall_audit, detection_accuracy_audit, callgraph_*, census_probe, ...)
1–2 each
probes and audits
Why it matters for the milestone: a false pass. Suppose a cp1252, Shift-JIS or UTF-16 estate has a national character in a name. If both the engine and the tool that checks it drop that character, they agree. The ground-truth ledger, the answer keys and the accuracy audits then report "correct" on exactly the files this milestone is about. We can't claim the engine works for every culture while the ruler is itself byte-lossy.
Fix
Route each source read through gitgalaxy.core.source_text:
whole files: read_source(path).text;
with ... as f: bodies: open_source;
byte chunks: decode_bytes.
Reads of our own artifacts (JSON, baselines, generated files) aren't source. They stay strict UTF-8, with no errors=.
Extend tests/test_source_reads.py so rule 1 (no lossy errors= handler) also covers tests/, with a reasoned allowlist entry for anything that genuinely needs it.
Verification
Every touched tool's own tests pass.
ground_truth_ledger.py check stays clean. Any answer-key field that moves has to be explained: it would mean the key had been silently dropping bytes.
The refraction differential and the rosetta audit don't move. The Unicode Gauntlet --ci passes.
Activity
#3869: the measurement tools read source losslessly; the lint gate co…