Repository navigation
Conversation
…llation Red on purpose, like the #689 diagnostics: the table is the output. #695 established one divergence -- [A-Z] does not match I under glibc tr_TR. Every other bracket range in scripts/ is spelled differently ([a-zA-Z], [A-Za-z0-9._-], the negated case form, the substitution form), and whether those also drop i/I decides how many sites need LC_ALL=C. macOS cannot answer it: all six shapes behave identically there across C, en_US.UTF-8 and tr_TR.UTF-8, because darwin libc does not collate ranges the way glibc does. Throwaway branch. Delete once the matrix is read. Co-Authored-By: Max <noreply>
Contributor
Author
|
Matrix read and recorded: only |
fdaviddpt
added a commit
that referenced
this pull request
Sep 15, 2026
…lation Red on purpose. The fix is not in this commit. Two halves. The scanner (tests/test_locale_ranges_695.py) reads source on every platform and reports every ASCII letter range in a shipped shell script that is not matched under LC_ALL=C. It is red on 14 sites today. Three places in this tree already carried the fix before #695 -- config(), _remember_cfg_flatten_cache_valid_value, lib-slug.sh's LC_ALL=C sed -- each found separately, one bug report at a time; this is the general form, so the next one is a finding at authoring time instead. The behavioural half (tests/test_id_guards_locale_695.py) covers the two sites #698's measured matrix showed actually break, both reached through `[[ =~ ]]`: _remember_cfg_flatten_cache_valid_line -- a config key carrying an `I` makes its cache line read as malformed, so the config-data cache is refused and every hook re-reads and re-flattens the config, forever, silently. A performance floor nothing reports. _remember_normalize_win_path -- drive `I:` stops being recognised, and its `tr '[:lower:]' '[:upper:]'` maps a lower-case `i:` drive to a dotted `İ` under Turkish rules: two bytes where one ASCII letter has to go. What #698 measured, on ubuntu-latest / bash 5.2 / localedef-built tr_TR.UTF-8, and why the scope is what it is: [[ =~ ]] over [A-Z], [a-z], [a-zA-Z], [A-Za-z0-9_] loses I and i [[ =~ ]] over [A-Za-z] GAINS é case patterns, and ${v//[!...]/} do not move Both failure directions are real, and only the regex path collates; bash's own glob matcher compares bytes. The `case` guards are therefore listed in the scanner's allowlist with that measurement as their stated reason rather than excluded from the scan -- one libc and one bash is not a licence to stop looking, and POSIX does permit a case range to collate. The locale probe both modules share accepts a locale only after watching this machine's bash fail under it, and builds one with localedef when the runner ships none. Part of #695 Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Sep 15, 2026
…at hold them Green half of the previous commit's red. Thirteen `local LC_ALL=C` insertions, each scoped to one function and restoring the caller's locale on return. Two of them are live bugs that #698's measured matrix identified, both reached through `[[ =~ ]]`: _remember_cfg_flatten_cache_valid_line (scripts/log.sh) validated each config-data cache line against ^_RCFG_[A-Za-z0-9_]+=. A config key carrying an I made the line read as malformed under Turkish collation, so the cache was refused and every hook fell back to re-reading and re-flattening the config on every invocation, permanently, with nothing said. Confirmed red on the ubuntu legs of the previous commit: VALID became REJECTED. _remember_normalize_win_path (scripts/resolve-paths.sh, mirrored in scripts/lib-env-cache.sh) stopped recognising the drive I:, and its `tr '[:lower:]' '[:upper:]'` mapped a lower-case i: drive to a dotted İ under Turkish case rules -- two bytes where one ASCII letter has to go. Forcing C fixes the range and the case mapping together. The other eleven are `case` and substitution sites, which the matrix cleared: only the regex path collates. One line makes them immune anyway and leaves the scanner no exception to carry. Also here, because the previous commit's CI said so rather than because I reasoned it: The drive-letter legs failed with exit 127, not with a wrong answer -- `_remember_normalize_win_path` is `unset -f`'d at resolve-paths.sh:340 once resolution is done, so sourcing the script does not leave it callable. Extracted by regex instead, the same route tests/test_save_session_marker_unreadable_625.py already takes for ts_marker_read and for the same recorded reason. Paired with two new C-locale legs that run on every platform, so a harness that stops working fails loudly everywhere instead of skipping in silence -- which is exactly how it hid the first time. scripts/lib-memory-dir.sh is byte-pinned against origin/main (tests/test_case_divergence_298.py), so both insertions into it are declared in _SANCTIONED_DIVERGENCE with their reason, the way #429 and #662 already are. Part of #695 Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Sep 15, 2026
… a scanner (#699) * test(#695): pin that a bracket range must not follow the locale's collation Red on purpose. The fix is not in this commit. Two halves. The scanner (tests/test_locale_ranges_695.py) reads source on every platform and reports every ASCII letter range in a shipped shell script that is not matched under LC_ALL=C. It is red on 14 sites today. Three places in this tree already carried the fix before #695 -- config(), _remember_cfg_flatten_cache_valid_value, lib-slug.sh's LC_ALL=C sed -- each found separately, one bug report at a time; this is the general form, so the next one is a finding at authoring time instead. The behavioural half (tests/test_id_guards_locale_695.py) covers the two sites #698's measured matrix showed actually break, both reached through `[[ =~ ]]`: _remember_cfg_flatten_cache_valid_line -- a config key carrying an `I` makes its cache line read as malformed, so the config-data cache is refused and every hook re-reads and re-flattens the config, forever, silently. A performance floor nothing reports. _remember_normalize_win_path -- drive `I:` stops being recognised, and its `tr '[:lower:]' '[:upper:]'` maps a lower-case `i:` drive to a dotted `İ` under Turkish rules: two bytes where one ASCII letter has to go. What #698 measured, on ubuntu-latest / bash 5.2 / localedef-built tr_TR.UTF-8, and why the scope is what it is: [[ =~ ]] over [A-Z], [a-z], [a-zA-Z], [A-Za-z0-9_] loses I and i [[ =~ ]] over [A-Za-z] GAINS é case patterns, and ${v//[!...]/} do not move Both failure directions are real, and only the regex path collates; bash's own glob matcher compares bytes. The `case` guards are therefore listed in the scanner's allowlist with that measurement as their stated reason rather than excluded from the scan -- one libc and one bash is not a licence to stop looking, and POSIX does permit a case range to collate. The locale probe both modules share accepts a locale only after watching this machine's bash fail under it, and builds one with localedef when the runner ships none. Part of #695 Co-Authored-By: Max <noreply> * fix(#695): force byte-wise bracket ranges, scoped to the functions that hold them Green half of the previous commit's red. Thirteen `local LC_ALL=C` insertions, each scoped to one function and restoring the caller's locale on return. Two of them are live bugs that #698's measured matrix identified, both reached through `[[ =~ ]]`: _remember_cfg_flatten_cache_valid_line (scripts/log.sh) validated each config-data cache line against ^_RCFG_[A-Za-z0-9_]+=. A config key carrying an I made the line read as malformed under Turkish collation, so the cache was refused and every hook fell back to re-reading and re-flattening the config on every invocation, permanently, with nothing said. Confirmed red on the ubuntu legs of the previous commit: VALID became REJECTED. _remember_normalize_win_path (scripts/resolve-paths.sh, mirrored in scripts/lib-env-cache.sh) stopped recognising the drive I:, and its `tr '[:lower:]' '[:upper:]'` mapped a lower-case i: drive to a dotted İ under Turkish case rules -- two bytes where one ASCII letter has to go. Forcing C fixes the range and the case mapping together. The other eleven are `case` and substitution sites, which the matrix cleared: only the regex path collates. One line makes them immune anyway and leaves the scanner no exception to carry. Also here, because the previous commit's CI said so rather than because I reasoned it: The drive-letter legs failed with exit 127, not with a wrong answer -- `_remember_normalize_win_path` is `unset -f`'d at resolve-paths.sh:340 once resolution is done, so sourcing the script does not leave it callable. Extracted by regex instead, the same route tests/test_save_session_marker_unreadable_625.py already takes for ts_marker_read and for the same recorded reason. Paired with two new C-locale legs that run on every platform, so a harness that stops working fails loudly everywhere instead of skipping in silence -- which is exactly how it hid the first time. scripts/lib-memory-dir.sh is byte-pinned against origin/main (tests/test_case_divergence_298.py), so both insertions into it are declared in _SANCTIONED_DIVERGENCE with their reason, the way #429 and #662 already are. Part of #695 Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Sep 24, 2026
The top-level LC_ALL save/restore around the allowlist `case` was not a guard test_locale_ranges_695 recognises, and restored an unset LC_ALL as set-but-empty. `case` patterns are measured not to collate (#698), so use the same plain `case` as session-start-hook.sh:294 and list the site in the same ALLOWLIST under _CASE. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Sep 24, 2026
…ed session's handoff (#739) * fix(#738): thread the session id through write-handoff.sh instead of a project-wide last-writer-wins pointer `handoff_mode: "per_session"` published the resolved handoff target to one shared file, `tmp/handoff-path`, overwritten on every SessionStart. The last session to start owned that pointer, so an earlier session's later /remember could silently write into a more-recently-started session's remember.<id>.md. write-handoff.sh never received a session id, so it had no way to tell. session-start-hook.sh now also publishes a copy keyed by that session's own id, tmp/handoff-path.<session_id>; write-handoff.sh identifies its own session via CLAUDE_CODE_SESSION_ID (a live env var Claude Code sets for the Bash tool, never a value the model supplies) and prefers that copy over the shared pointer whenever it exists, falling back exactly as before when no session id reaches it. The new per-session hint files are pruned the same way #373 already prunes remember.delivered.<session_id> records. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test(#738): make the new module importable on Python 3.9 `str | None` in a signature is evaluated at definition time on 3.9 and failed collection on every CI leg. Postpone annotation evaluation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(#738): sanitize the session id the way #270's sibling does The top-level LC_ALL save/restore around the allowlist `case` was not a guard test_locale_ranges_695 recognises, and restored an unset LC_ALL as set-but-empty. `case` patterns are measured not to collate (#698), so use the same plain `case` as session-start-hook.sh:294 and list the site in the same ALLOWLIST under _CASE. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Throwaway diagnostic. Do not merge. Red on purpose -- the table is the
output, same shape as the #689 diagnostics.
#695 established one divergence:
[A-Z]does not matchIunder glibctr_TR. Every other bracket range inscripts/is spelled differently --[a-zA-Z],[A-Za-z0-9._-], the negatedcaseform, the${v//[!a-zA-Z0-9]/-}substitution form -- and whether those also dropi/Idecides how many sites actually need
LC_ALL=C.macOS cannot answer it: all six shapes behave identically there across
C,en_US.UTF-8andtr_TR.UTF-8, because darwin's libc does not collate rangesthe way glibc does. So this gets the matrix off a Linux runner once, and the
branch is deleted.
Part of #695
[AI-generated]