Compare commits

...
Author SHA1 Message Date
izdat-sl4w 8049c36f51 audit: pin LF newlines in the generated status writes
Path.write_text opens with newline=None, so on Windows a regeneration
would translate the tracked LF files to CRLF and show a spurious diff.
Both write sites now pass newline="\n", which leaves the bytes
identical on macOS and Linux.

Signed-off-by: izdat-sl4w <76667566+izdat-sl4w@users.noreply.github.com>
2026-11-24 20:14:45 +01:00
izdat-sl4w c91036f879 Merge main into fix/audit-utf8-locale
Signed-off-by: izdat-sl4w <76667566+izdat-sl4w@users.noreply.github.com>
2026-11-24 20:14:30 +01:00
izdat-sl4w d01627b3de audit: read and write tracked files as UTF-8
The generated-status check and the claims audit called
Path.read_text()/write_text() without encoding=, so they used the process
locale encoding. Under an ASCII locale the status check raises
UnicodeDecodeError on docs/claims.toml, and under cp1252 it reports a
spurious xenora-progress.svg difference, so a current tree fails the
documented checkout command. Both scripts now pass encoding="utf-8", as
the rest of scripts/ does, and CI runs the two checks again under a
non-UTF-8 locale so the requirement stays enforced.

Closes #334

Signed-off-by: izdat-sl4w <76667566+izdat-sl4w@users.noreply.github.com>
2026-11-24 18:09:21 +01:00
4 changed files with 13 additions and 10 deletions

No files matched your search

+3 -1
View File
@@ -41,6 +41,8 @@ jobs:
python3 crates/isa/generate_semantics.py --check
python3 scripts/audit/semantic_coverage.py --check
python3 scripts/audit/status.py --check
# The generated status check must not depend on the host locale encoding.
LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0 python3 scripts/audit/status.py --check
for fixture in x2 x3 x4; do
python3 "experiments/x1/fixtures/$fixture.py" --check || exit 1
done
@@ -65,7 +67,7 @@ jobs:
cargo test --locked --workspace
cargo test --locked --manifest-path experiments/x1/Cargo.toml
scripts/audit/dependencies.sh
scripts/audit/claims.sh
LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0 scripts/audit/claims.sh
- name: Inspect native CLI
run: |
cargo build --locked -p xenora
+1
View File
@@ -196,6 +196,7 @@ remains unsupported.
- Fixed 32-bit guest stores and loads in the native DBT (MOV 89/8B and C7 /0), which accessed eight bytes: stores overwrote the next four guest bytes and accesses at the end of a mapping faulted. RIP-relative operands of byte moves and extensions, which were read as RBP-relative, and LEA with a segment prefix, which added the segment base, are fixed too.
- Fixed an x86 prefix-length test that read an untracked fuzz artifact and so failed on every fresh checkout; its input is now inline.
- Fixed agent-queue `apply_actions` crashing on comment-only decisions (claim refusals) by skipping no-op `gh issue edit` calls; accept `summary --now` after the subcommand; grant the audit job `pull-requests: read` so live audits can list open PRs (issue #180).
- Fixed `scripts/audit/status.py` and the Python embedded in `scripts/audit/claims.sh` reading and writing tracked files in the process locale encoding instead of UTF-8: under an ASCII or cp1252 locale the status check crashed on `docs/claims.toml` or reported a spurious `xenora-progress.svg` difference. Both scripts now pass `encoding="utf-8"`, as the rest of `scripts/` does, the two write sites also pin `newline="\n"` so a Windows host cannot turn tracked LF files into CRLF when it regenerates them, and CI runs the two checks again under a non-UTF-8 locale so the requirement stays enforced.
- Generated CRT adapters now report unsupported calls when the required guest ABI or runtime behavior is missing.
+3 -3
View File
@@ -10,7 +10,7 @@ import sys
import tomllib
registry = Path("docs/claims.toml")
claims = tomllib.loads(registry.read_text())["claim"]
claims = tomllib.loads(registry.read_text(encoding="utf-8"))["claim"]
classes = {}
errors = []
claim_id = re.compile(r"\bCLAIM-[A-Z0-9]+(?:-[A-Z0-9]+)*\b")
@@ -37,10 +37,10 @@ files = [Path("README.md"), Path("AGENTS.md"), *Path("docs").rglob("*"),
for source in files:
if source == registry or source.suffix not in {".md", ".toml", ".rs"}:
continue
for reference in set(claim_id.findall(source.read_text())) - classes.keys():
for reference in set(claim_id.findall(source.read_text(encoding="utf-8"))) - classes.keys():
errors.append(f"{source}: unregistered {reference}")
status = tomllib.loads(Path("docs/status.toml").read_text())
status = tomllib.loads(Path("docs/status.toml").read_text(encoding="utf-8"))
for feature in status["feature"]:
verification = feature.get("hardware_verification", "")
if verification.casefold() != "verified":
+6 -6
View File
@@ -18,7 +18,7 @@ def table(headers, rows):
def replace_block(path, name, body, check):
original = path.read_text()
original = path.read_text(encoding="utf-8")
start = f"<!-- status:{name}:start -->\n"
stop = f"\n<!-- status:{name}:end -->"
head, _, tail = original.partition(start)
@@ -30,7 +30,7 @@ def replace_block(path, name, body, check):
if check:
print(f"{path}: status table differs from docs/status.toml", file=sys.stderr)
return False
path.write_text(updated)
path.write_text(updated, encoding="utf-8", newline="\n")
return True
@@ -90,12 +90,12 @@ def render_progress(status):
def check_asset(path, svg, check):
if path.exists() and path.read_text() == svg:
if path.exists() and path.read_text(encoding="utf-8") == svg:
return True
if check:
print(f"{path}: progress graphic differs from docs/status.toml", file=sys.stderr)
return False
path.write_text(svg)
path.write_text(svg, encoding="utf-8", newline="\n")
return True
@@ -105,8 +105,8 @@ def main():
check = parser.parse_args().check
root = Path(__file__).resolve().parents[2]
docs = root / "docs"
status = tomllib.loads((docs / "status.toml").read_text())
claims = tomllib.loads((docs / "claims.toml").read_text())
status = tomllib.loads((docs / "status.toml").read_text(encoding="utf-8"))
claims = tomllib.loads((docs / "claims.toml").read_text(encoding="utf-8"))
classes = {claim["id"]: claim["class"] for claim in claims["claim"]}
features = table(