Skip to content

audit_predicate_domains crashes on a non-UTF-8 locale (report/baseline I/O) #317

Description

@realmarcin

Found in the self-review of PR #314 and fixed in that same PR (commit pins
encoding="utf-8"); filed as the record per the review-finding policy.

scripts/audit_predicate_domains.py writes a non-ASCII (U+2291, "⊑ microbe")
into the detail column of 366 report rows. The report write, baseline write,
and baseline read all used the platform default (locale) encoding. On a
non-UTF-8 locale that raises UnicodeEncodeError writing the report and
UnicodeDecodeError reading the baseline — a hard crash. It only passed CI
because the GitHub runner's locale is UTF-8.

Fix: encoding="utf-8" on all three opens. Verified byte-neutral — the
committed report and baseline are byte-identical after regeneration.

Related (NOT fixed here, pre-existing repo-wide): the corpus read
yaml.safe_load(path.read_text()) at line ~143 also relies on the default
encoding, matching the sibling audits (audit_causal_graphs.py etc.). If a
trait YAML ever carries non-ASCII (e.g. an accented species name) it has the
same latent failure across every audit. Worth a separate, repo-wide sweep rather
than a one-file change here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions