Run every step under -EUTF-8, so the image's locale cannot clear the labels

What does this MR do and why?

Each project's Duo session image decides the locale. An image that sets none, such as debian:bookworm-slim, has Ruby read files as US-ASCII. The MR Risk Labeler's decide_labels reads answer.txt with a bare File.read, so an answer holding a non-ASCII character, as in docs: low — only a README typo, routes to clear. The run takes the labels off instead of applying them.

bin/compile now passes -EUTF-8 to every ruby step it emits, in every flow it compiles: nine in flows/mr-risk.yml and five in flows/flow.yml. Each step reads files as UTF-8 whatever the image sets, so a project's setup script no longer has to export LANG=C.UTF-8 for the flow. flows/deps.yml, which bin/compile no longer renders and the sync deletes at the next tag, stays as it is.

-EUTF-8 sets the external encoding alone, which is what a UTF-8 locale already gives, so the steps behave in every image as they do in one with a UTF-8 locale. -EUTF-8:UTF-8 would set an internal encoding as well, and then every write transcodes and a write of binary bytes raises. The integration suites pass under either flag; -EUTF-8 is the one that changes nothing for an image that already has a UTF-8 locale.

Also in this MR:

  • docs/specs/mr-risk.md gains the platform constraint: the image decides the locale and may set none. The upstream check's code keeps its ASCII-only rule, now because every release runs the copy at HEAD, and one without the flag still reads it under the image's locale.
  • README.md says the image needs no locale.
  • The comments in the shared decide_labels and build_note that said a bare read in the runner is US-ASCII are gone, since under the flag it is not. The explicit encoding: "UTF-8" reads stay. bin/compile strips comments, so this changes nothing in flows/.

How to check

make check, run with LANG=C.UTF-8 LC_ALL=C.UTF-8.

  • The new example in spec/mr-risk/integration runs the compiled decide_labels under LC_ALL=C, with LANG, LC_CTYPE and RUBYOPT cleared. Against main's flows/mr-risk.yml it fails, writing clear. Against this branch it writes apply and keeps the reason, em dash included.
  • spec/support/flow.rb now matches the packed command with the flag in it, so spec/flow's pass over every embedded script fails if a step loses it.
  • Outside the suite, every step the two integration suites run was forced under LC_ALL=C. All 22 mr-risk and 16 flow examples pass on this branch.
On main With this MR
flows/mr-risk.yml 38668 bytes, 2292 under the cap 38740 bytes, 2220 under the cap
flows/flow.yml 38430 bytes, 2530 under the cap 38470 bytes, 2490 under the cap

That is eight bytes, -EUTF-8, per step. The packed scripts are byte for byte the same.

Relation to !101 (closed)

!101 (closed) reads the inputs of classify_change, choose_thread and extract_iid as UTF-8, one read at a time. Its three new spec/flow examples fail against main's flows and pass against this branch's with none of its src/ changes, so once this merges its per-read encodings are redundant. Its two spec/deps examples no longer apply, since !119 (merged) removed the deps flow.

Notes

  • Not changed: UPSTREAM_STAND_IN in evals/lib/eval_flow.rb runs ruby -rfileutils -e and strips tier_model.txt from a bare read. bin/compile does not emit it. It replaces a flow's fetch_upstream in an eval run, and no flow an eval suite runs has one yet.
  • The pre-commit prettier hook passes on the two flows, and the other hooks pass.

🤖 Generated with Claude Code

Edited by Connor Sanders

Merge request reports

Loading
Loading