Skip to content

fix(tests): match the non-ASCII line by exact bytes in look-ledger hook-repair H7 - #491

Merged
MendixMau merged 2 commits into
masterfrom
fix/look-ledger-hook-repair-c-locale
Oct 20, 2026
Merged

MendixMau merged 2 commits into
masterfrom
fix/look-ledger-hook-repair-c-locale

Conversation

@MendixMau

@MendixMau MendixMau commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Direct lane

What changed and why (one paragraph): tests/wave2/test-look-ledger-hook-repair.sh H7 checks that install-claude-permissions.sh --hooks-only keeps a non-ASCII line intact. It did that with grep -q '^ "note": "f.r"'. Under LC_ALL=C the ü is two bytes and . matches one, so H7 failed even though the file was untouched. That made the fixture fail in any C-locale shell, including the agent environment that reviewed #487. The check now matches the exact bytes of the whole line, grep -qxF "$(printf ' "note": "f\303\274r",')", so it no longer depends on the locale. Review round: CRs are stripped first, grep -qxF ... <<<"$(tr -d '\r' < settings.json)", because the settings writer (open(..., "w") without newline="") emits CRLF on native Windows Python and -x would then miss the line. It uses a here-string rather than tr | grep -q because the fixture runs under pipefail, the race test-pipefail-grep-q.sh guards against. Test-only change.

Impact

Row Answer
Process none: no gate, human step or stage artifact; one fixture assertion
Dependencies tests/wave2/test-look-ledger-hook-repair.sh only. No shared script and no new tool (grep -xF, printf octal escapes: POSIX, BSD and GNU). No order dependency on other PRs apart from the shared ## Unreleased CHANGELOG spot.
Context cost none: no routed or always-loaded file touched
Behaviour n/a: scripts only (a test fixture)
Runtime n/a: same single grep

Field evidence: this was found while running the scoped fixtures for #487 in a C-locale agent shell, where the fixture fails on an untouched master. Results for bash tests/wave2/test-look-ledger-hook-repair.sh:

Locale master this branch
LC_ALL=C FAIL H7: --hooks-only reformatted or added keys, PASS=12 FAIL=1 PASS=13 FAIL=0
LC_ALL=POSIX not run PASS=13 FAIL=0
LC_ALL=C.UTF-8 PASS=13 FAIL=0 PASS=13 FAIL=0
default not run PASS=13 FAIL=0

CRLF proof on a CRLF copy of the settings file (printf '{\r\n "note": "f\303\274r",\r\n...'):

Matcher CRLF copy
master (grep '^ "note": "f.r"') under LC_ALL=C FAIL
b9f6adb (grep -qxF, no CR strip) FAIL
this head (CRs stripped, here-string), under LC_ALL=C and pipefail pass
this head, on the LF copy pass

After the change, the fixture gives PASS=13 FAIL=0 under LC_ALL=C and under C.UTF-8.

  • No client data anywhere in the diff: whole-word grep of the added lines for the denylist terms and home paths gives 0; LEAKGUARD_ALLOW_NO_DENYLIST=1 bin/check-no-client-data.sh is clean
  • Size cap: 1 fixture plus CHANGELOG, 3 lines
  • Test tier reached: T1, the fixture itself under C, POSIX, C.UTF-8 and the default locale (see table). bin/check-scripts.sh, bin/check-portability.sh, bin/render-routing.sh --check and bin/check-pr-discipline.sh origin/master are clean
  • For a new/changed instrument: n/a (fixture assertion only); the match is byte-exact, so it does not depend on locale or platform
  • CHANGELOG.md line appended, credited to MendixMau
  • No new bug entries

https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw


Generated by Claude Code

…ok-repair H7

Under LC_ALL=C the u-umlaut is two bytes and grep "f.r" matched one, so H7
failed with the settings file intact. Match the whole line by exact bytes
(grep -qxF with an octal-escaped printf). 13/13 under C, POSIX and C.UTF-8;
master is 12/13 under C.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
The settings writer emits CRLF on native Windows Python; grep -x then
misses the line on its trailing CR. Strip CRs first, through a
here-string because the fixture runs under pipefail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
@MendixMau
MendixMau merged commit ed83946 into master Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants