Found while adding a rule to agent/APPEND_SYSTEM.md: the suite is red in any C-locale shell, and the cause is a silent data loss in the keybinds generator.
Measured
Old (origin/main) script against the live ~/.config/niri/cfg/keybinds.kdl:
shell
sections
rows
exit
UTF-8
12
120
0
LC_ALL=C
0
120
0
A third of the page vanishes and the caller still gets a green status. Cron, systemd user units and agent shells all run LC_ALL=C, so every automated regeneration has been writing the section-less sheet; Frank's terminal is UTF-8, which is why it was never seen.
Cause
/^[[:space:]]*\/\/[[:space:]]*─+ (.+) ─+[[:space:]]*$/ puts a quantifier on a multibyte character. LANG=en_US.UTF-8 does not save it — LC_ALL overrides everything — and gawk then matches byte-wise, so ─+ means "the last byte of U+2500, repeated", a sequence that never occurs in the file.
Fix
Match and strip the dash as a literal (gsub(/─/, "", s)), byte-safe in every locale. A comment still has to be dash-decorated on both sides to open a section, so plain comments stay ignored. No locale is pinned: pinning en_US.UTF-8 would have been the other wrong answer — this box ships only C.utf8.
Verification
New black-box test drives the generator through env LC_ALL=C and asserts the headers are there — the box's own UTF-8 terminal could never have caught this.
LC_ALL=C bats tests/ = 110 ok, 0 failures; the file is also 8/8 under C.utf8.
omp-docs/tools/niri/keybindings.md is unaffected (12 headers, 120 rows — generated from a UTF-8 shell), and output is now identical in both locales, so no regeneration is needed.
cwd: /home/blank/.omp/wt/wt-20261019-125509-7c8a99d · session: 01a155bb-6474-7366-be9d-629f74af0e05 (built in the worktree ~/.omp/wt/wt-keybinds-locale)
Found while adding a rule to `agent/APPEND_SYSTEM.md`: the suite is red in any C-locale shell, and the cause is a silent data loss in the keybinds generator.
## Measured
Old (`origin/main`) script against the live `~/.config/niri/cfg/keybinds.kdl`:
| shell | sections | rows | exit |
|---|---|---|---|
| UTF-8 | 12 | 120 | 0 |
| `LC_ALL=C` | **0** | 120 | 0 |
A third of the page vanishes and the caller still gets a green status. Cron, systemd user units and agent shells all run `LC_ALL=C`, so every automated regeneration has been writing the section-less sheet; Frank's terminal is UTF-8, which is why it was never seen.
## Cause
`/^[[:space:]]*\/\/[[:space:]]*─+ (.+) ─+[[:space:]]*$/` puts a quantifier on a multibyte character. `LANG=en_US.UTF-8` does not save it — `LC_ALL` overrides everything — and gawk then matches byte-wise, so `─+` means "the last byte of U+2500, repeated", a sequence that never occurs in the file.
## Fix
Match and strip the dash as a literal (`gsub(/─/, "", s)`), byte-safe in every locale. A comment still has to be dash-decorated on both sides to open a section, so plain comments stay ignored. No locale is pinned: pinning `en_US.UTF-8` would have been the other wrong answer — this box ships only `C.utf8`.
## Verification
- New black-box test drives the generator through `env LC_ALL=C` and asserts the headers are there — the box's own UTF-8 terminal could never have caught this.
- `LC_ALL=C bats tests/` = **110 ok, 0 failures**; the file is also 8/8 under `C.utf8`.
- `omp-docs/tools/niri/keybindings.md` is unaffected (12 headers, 120 rows — generated from a UTF-8 shell), and output is now identical in both locales, so no regeneration is needed.
---
cwd: /home/blank/.omp/wt/wt-20261019-125509-7c8a99d · session: 01a155bb-6474-7366-be9d-629f74af0e05 (built in the worktree `~/.omp/wt/wt-keybinds-locale`)
The section rule was `/^[[:space:]]*\/\/[[:space:]]*─+ (.+) ─+…$/`, a quantifier on a
multibyte character. Under LC_ALL=C — which is what cron, systemd user units and agent
shells get, regardless of LANG — gawk matches byte-wise, so `─+` means "the last byte of
U+2500, repeated" and never matches. Measured on the live keybinds.kdl: the old script
emitted 0 section headers instead of 12, all 120 binding rows intact, exit status 0. A
silent one-third-of-the-page loss, invisible to any caller that only checks the status.
The dash is now matched and stripped as a literal (`gsub(/─/, "")`), which is byte-safe
in every locale, and a comment must be dash-decorated on both sides to open a section, so
plain comments are still ignored. A test pins the C-locale case explicitly, because the
box's own terminal has always been UTF-8 and could never have caught this.
The committed artifact omp-docs/tools/niri/keybindings.md is unaffected (12 headers,
120 rows — it was generated from a UTF-8 shell); output is now identical either way.
dank
merged commit 1cc4b76479 into main2026-10-20 22:21:29 -07:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found while adding a rule to
agent/APPEND_SYSTEM.md: the suite is red in any C-locale shell, and the cause is a silent data loss in the keybinds generator.Measured
Old (
origin/main) script against the live~/.config/niri/cfg/keybinds.kdl:LC_ALL=CA third of the page vanishes and the caller still gets a green status. Cron, systemd user units and agent shells all run
LC_ALL=C, so every automated regeneration has been writing the section-less sheet; Frank's terminal is UTF-8, which is why it was never seen.Cause
/^[[:space:]]*\/\/[[:space:]]*─+ (.+) ─+[[:space:]]*$/puts a quantifier on a multibyte character.LANG=en_US.UTF-8does not save it —LC_ALLoverrides everything — and gawk then matches byte-wise, so─+means "the last byte of U+2500, repeated", a sequence that never occurs in the file.Fix
Match and strip the dash as a literal (
gsub(/─/, "", s)), byte-safe in every locale. A comment still has to be dash-decorated on both sides to open a section, so plain comments stay ignored. No locale is pinned: pinningen_US.UTF-8would have been the other wrong answer — this box ships onlyC.utf8.Verification
env LC_ALL=Cand asserts the headers are there — the box's own UTF-8 terminal could never have caught this.LC_ALL=C bats tests/= 110 ok, 0 failures; the file is also 8/8 underC.utf8.omp-docs/tools/niri/keybindings.mdis unaffected (12 headers, 120 rows — generated from a UTF-8 shell), and output is now identical in both locales, so no regeneration is needed.cwd: /home/blank/.omp/wt/wt-20261019-125509-7c8a99d · session: 01a155bb-6474-7366-be9d-629f74af0e05 (built in the worktree
~/.omp/wt/wt-keybinds-locale)