forked from bchanot/claude
Merge bugfix/comm-sort-locale into develop
This commit is contained in:
commit
be472dc9dd
5 files changed
+55
-3
No files matched your search
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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 </dev/null > /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
|
||||
@@ -59,9 +59,11 @@ _partial_stages() {
|
||||
read -r mode oid _ < <(git ls-files -s -- "$p")
|
||||
echo "memory-commit: partial stage dropped on: $p (blob $oid;" \
|
||||
"restore: git update-index --cacheinfo $mode,$oid,$p)"
|
||||
done < <(comm -12 \
|
||||
<(git -c core.quotepath=off diff --cached --name-only -- "$@" | sort) \
|
||||
<(git -c core.quotepath=off diff --name-only -- "$@" | sort))
|
||||
# C locale for both: a locale sort and a byte-order comm disagree (uutils)
|
||||
done < <(LC_ALL=C comm -12 \
|
||||
<(git -c core.quotepath=off diff --cached --name-only -- "$@" \
|
||||
| LC_ALL=C sort) \
|
||||
<(git -c core.quotepath=off diff --name-only -- "$@" | LC_ALL=C sort))
|
||||
}
|
||||
|
||||
# Surgical commit of the scoped paths only. Returns 0 (ok or no-op), 3 (unsafe).
|
||||
|
||||
@@ -190,6 +190,25 @@ if [ "$rc" -eq 6 ] && [ -z "$staged" ] && [ "$(printf '%s\n' "$err" | grep -cxF
|
||||
if [ "$(printf '%s\n' "$err" | grep -c 'dropped on: .*TODO.md')" -eq 0 ]; then ok "a fully staged file is not listed"; else ko "fully staged TODO.md listed as a dropped partial stage"; fi
|
||||
rm -rf "$d"
|
||||
|
||||
echo "== partial stages listed in any locale (sort/comm agree)"
|
||||
d="$(new_repo)"
|
||||
printf -- '---\nformat: 2\ntype: decisions_registry\nentry_prefix: BDR\n---\n\n## BDR-001 — kept (2026-10-27)\n- **Status**: accepted\n' \
|
||||
> "$d/.claude/memory/decisions.md"
|
||||
mkdir -p "$d/.claude/tasks/contracts"
|
||||
printf 'a\n' > "$d/.claude/tasks/TODO.md"
|
||||
printf 'a\n' > "$d/.claude/tasks/contracts/x.md"
|
||||
git -C "$d" add -A && git -C "$d" commit -qm v2
|
||||
sed 's/kept/edited/' "$d/.claude/memory/decisions.md" > "$d/x.tmp"
|
||||
cat "$d/x.tmp" > "$d/.claude/memory/decisions.md"
|
||||
git -C "$d" add .claude/memory/decisions.md
|
||||
for f in .claude/tasks/TODO.md .claude/tasks/contracts/x.md; do
|
||||
printf 'b\n' >> "$d/$f"; git -C "$d" add "$f"; printf 'c\n' >> "$d/$f"
|
||||
done
|
||||
err="$(cd "$d" && LC_ALL=en_US.UTF-8 bash "$HELPER" commit "chore(memory): locale" 2>&1 >/dev/null)"; rc=$?
|
||||
n="$(printf '%s\n' "$err" | grep -c 'partial stage dropped on: .claude/tasks/')"
|
||||
if [ "$rc" -eq 6 ] && [ "$n" -eq 2 ] && ! printf '%s\n' "$err" | grep -q 'sorted order'; then ok "both partial stages named, no sort-order warning (locale vs byte order)"; else ko "rc=$rc n=$n err=[$err]"; fi
|
||||
rm -rf "$d"
|
||||
|
||||
echo
|
||||
printf 'RESULT: %d passed, %d failed\n' "$PASS" "$FAIL"
|
||||
[ "$FAIL" -eq 0 ]
|
||||
Reference in new issue
Block a user