Skip to content

State the Subprocess Encoding Rule in CODESTYLE.md, So the Fleet Carries It Rather Than This Repository Alone #1578

Description

@ptr727

Problem

#1574 fixed #1538 by pinning encoding="utf-8" on every text-mode subprocess call in this repository, and added scripts/tests/test_tooling_encoding.py to assert that nothing reintroduces it. That test guards this repository and nothing else, so every other repository in the fleet can write the same defect freely.

The rule is not stated anywhere a carrier reads. CODESTYLE.md has a Python section and says nothing about it, and no linter in the toolchain covers it: ruff has no rule reaching a subprocess call at all, and its rule for the same omission on open and read_text, PLW1514, is neither selected here nor out of preview.

Why it matters

The defect is invisible on the host it is written on. Python decodes a text=True pipe with the locale encoding when the call names none, which on Linux is UTF-8, so the omission looks correct everywhere CI runs and fails only on a Windows host. That is why #1538 went unnoticed until a maintainer ran a gate locally from Windows, and why nothing would catch the next one.

Suggested fix

State it in CODESTYLE.md's Python section, as the rule plus the reason rather than as a description of this repository's test, since a carrier gets the rule and not the mechanism. Two halves are load bearing and they fail differently: naming the encoding is what makes the read platform independent, and what a byte outside that encoding is worth is a per-call decision the call answers with its own errors, which a strict default answers by raising.

AGENTS.md "Where the Rules Live" routes code style to CODESTYLE.md and packages its language sections as the python-codestyle Skill, so the Skill regenerates from the same text and no second copy is written.

Follow-up to #1538, filed rather than grown into #1574, since new prose in a carried document is reviewed as carried content and belongs on its own branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions