test(i18n): guard issue-277 artifact determinism
All checks were successful
CI / test-and-quality (push) Successful in 2m33s
CI / test-and-quality (pull_request) Successful in 2m32s

This commit is contained in:
2026-03-13 10:08:32 +00:00
parent 5a580964c4
commit b968ea4430
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Guard issue #277 parity artifact against non-deterministic regeneration."""
from __future__ import annotations
import hashlib
import subprocess
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
ARTIFACT_PATH = REPO_ROOT / "docs" / "ISSUE-277-SHARED-I18N-PARITY-ARTIFACT.md"
REPORT_SCRIPT = REPO_ROOT / "scripts" / "report_i18n_parity.py"
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def main() -> int:
before = sha256(ARTIFACT_PATH)
for run in range(1, 3):
subprocess.run([sys.executable, str(REPORT_SCRIPT)], cwd=REPO_ROOT, check=True)
after = sha256(ARTIFACT_PATH)
if after != before:
raise SystemExit(
f"issue #277 parity artifact is not deterministic after run {run}: {before} != {after}"
)
print(f"issue #277 parity artifact deterministic: {before}")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View File

@@ -179,6 +179,7 @@ def render_report(catalog: dict) -> str:
lines.append("```bash")
lines.append("python3 scripts/check_i18n_drift.py")
lines.append("python3 scripts/report_i18n_parity.py")
lines.append("python3 scripts/check_i18n_parity_artifact.py")
lines.append("```")
lines.append("")
return "\n".join(lines)