From 59a83752c716d33f744e69fbfbe68d715df15642 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sun, 8 Nov 2026 19:51:01 +0100 Subject: [PATCH] =?UTF-8?q?chore(memory):=20LRN-269=20=E2=80=94=20hotfix?= =?UTF-8?q?=20comm=20sort=20locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/memory/journal.md | 1 + .claude/memory/learnings.md | 6 +++++ .../2026-11-08-comm-sort-locale-1947.md | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .claude/tasks/contracts/2026-11-08-comm-sort-locale-1947.md diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 359d4f7..0d5824c 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -705,3 +705,4 @@ rules: ## 2026-11-08 - 2026-11-08: 4d memory feedback built on feature/memory-feedback (8 tasks SDD; plan r1 FATAL(7) → r2 → confirm FATAL(4) → r3; final review I1 locals + I2 per-trigger n; gate 2 hardening x2: checkDir fail-closed, items.json validated, safe repo path). make test green, GATE 0 MET, security PASS 0 findings; live record zenquality cands 11 ms 1408. BDR-140, LRN-267/268. Merged on user signal before GATE 1; live run + verifier after. +- 2026-11-08: /hotfix comm warning: uutils sort locale vs comm byte order in memory-commit _partial_stages; LC_ALL=C both, test red-before (sorted order) then 21/21; security PASS; 54bdfeb. LRN-269. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 047ac51..f66ff27 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1990,3 +1990,9 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s - **Pattern**: fixture built from assumption passes its own test → BLOCKERs hide until a challenger reads real data or existing tests. 4d: `-context` toolUseID (real transcripts) and IR11 strict toEqual (existing kit test) both caught only by challenge passes, not by plan TDD. Second: plan "Global Constraints" must copy the user's global limits verbatim; 4d plan dropped "5 locals" → executors complied with the plan, final review flagged I1, extra fix round. - **Context**: feature/memory-feedback 2026-11-06..08: r1 FATAL(7), r2 confirm FATAL(4), final review I1/I2, gate 2 three MEDIUM + one MEDIUM on re-scan. - **Future use**: plan challenge brief asks correctness lens to verify fixture shapes against real data and to grep existing tests asserting changed records; writing-plans Global Constraints = paste CLAUDE.md limits line verbatim. + +## LRN-269 — uutils sort collates by locale, comm expects byte order: pin LC_ALL=C on both (2026-11-08) + +- **Pattern**: uutils coreutils 0.10.0 (Ubuntu 26.04 default `sort`/`comm`): `sort` collates by locale (en_US.UTF-8: `.claude/tasks/contracts/x` before `.claude/tasks/TODO.md`), `comm` expects byte order → `comm: file N is not in sorted order`, rc 1, common lines can be missed. Fix: `LC_ALL=C` on every link (`LC_ALL=C sort` + `LC_ALL=C comm`/`join`). Test discriminates only with `LC_ALL=en_US.UTF-8`; `LC_ALL=''` makes uutils fall back to byte order (bug hidden). +- **Context**: `lib/memory-commit.sh` `_partial_stages`, warning seen on a memory commit; fix 54bdfeb, test in lib/tests/run-deterministic.sh. +- **Future use**: any `sort | comm|join|uniq` pipeline in shell libs: pin C locale on both sides; grep `comm -`/`join -` in review. diff --git a/.claude/tasks/contracts/2026-11-08-comm-sort-locale-1947.md b/.claude/tasks/contracts/2026-11-08-comm-sort-locale-1947.md new file mode 100644 index 0000000..a9a94fa --- /dev/null +++ b/.claude/tasks/contracts/2026-11-08-comm-sort-locale-1947.md @@ -0,0 +1,24 @@ +# CONTRACT — comm-sort-locale +- date: 2026-11-08 | flow: hotfix | branch: bugfix/comm-sort-locale (off develop) +- status: active + +## REQUEST (verbatim — IMMUTABLE) +oui regarde le warning comm + +(context: memory-commit.sh printed "comm: file 2 is not in sorted order" / "comm: input is not in sorted order" on a commit; reproduced: uutils coreutils 0.10.0 sort collates by locale, uutils comm expects byte order.) + +## CLARIFICATIONS + +## ACCEPTANCE CRITERIA +1. _partial_stages sorts and compares in the C locale; no "sorted order" warning; both partial stages listed. + CHECK: cd /home/bchanot/Documents/claude && grep -q 'LC_ALL=C comm' lib/memory-commit.sh && systemd-run --user --scope -q -p TasksMax=256 make test suite=lib/tests/run-deterministic.sh /home/bchanot/.cache/claude-tmp/claude-1000/-home-bchanot-Documents-claude/049658c4-3f30-4849-8ba6-906177262d8a/scratchpad/comm.out 2>&1 && echo C1_GREEN + EXPECT: C1_GREEN + EVIDENCE: MET exit=0 marker-found :: C1_GREEN +2. shellcheck clean. + CHECK: cd /home/bchanot/Documents/claude && shellcheck lib/memory-commit.sh lib/tests/run-deterministic.sh && echo C2_LINT + EXPECT: C2_LINT + EVIDENCE: MET exit=0 marker-found :: C2_LINT + +## FILE SCOPE +- lib/memory-commit.sh +- lib/tests/run-deterministic.sh