Repository navigation
fix(tests): match the non-ASCII line by exact bytes in look-ledger hook-repair H7 - #491
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Direct lane
What changed and why (one paragraph):
tests/wave2/test-look-ledger-hook-repair.shH7 checks thatinstall-claude-permissions.sh --hooks-onlykeeps a non-ASCII line intact. It did that withgrep -q '^ "note": "f.r"'. UnderLC_ALL=Ctheü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")withoutnewline="") emits CRLF on native Windows Python and-xwould then miss the line. It uses a here-string rather thantr | grep -qbecause the fixture runs underpipefail, the racetest-pipefail-grep-q.shguards against. Test-only change.Impact
tests/wave2/test-look-ledger-hook-repair.shonly. No shared script and no new tool (grep -xF,printfoctal escapes: POSIX, BSD and GNU). No order dependency on other PRs apart from the shared## UnreleasedCHANGELOG spot.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:LC_ALL=CFAIL H7: --hooks-only reformatted or added keys,PASS=12 FAIL=1PASS=13 FAIL=0LC_ALL=POSIXPASS=13 FAIL=0LC_ALL=C.UTF-8PASS=13 FAIL=0PASS=13 FAIL=0PASS=13 FAIL=0CRLF proof on a CRLF copy of the settings file (
printf '{\r\n "note": "f\303\274r",\r\n...'):grep '^ "note": "f.r"') underLC_ALL=Cgrep -qxF, no CR strip)LC_ALL=CandpipefailAfter the change, the fixture gives
PASS=13 FAIL=0underLC_ALL=Cand underC.UTF-8.LEAKGUARD_ALLOW_NO_DENYLIST=1 bin/check-no-client-data.shis cleanbin/check-scripts.sh,bin/check-portability.sh,bin/render-routing.sh --checkandbin/check-pr-discipline.sh origin/masterare cleanCHANGELOG.mdline appended, credited to MendixMauhttps://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Generated by Claude Code