Skip to content

fix(mcp-validation): fold string sort checks UPPERCASE to match NTFS $UpCase#493

Merged
githubrobbi merged 1 commit into
mainfrom
fix/t59-sort-uppercase-collation
Jun 29, 2026
Merged

fix(mcp-validation): fold string sort checks UPPERCASE to match NTFS $UpCase#493
githubrobbi merged 1 commit into
mainfrom
fix/t59-sort-uppercase-collation

Conversation

@githubrobbi

Copy link
Copy Markdown
Collaborator

Why

T59 (*.txt --sort path) failed on a live C: drive: UFFS returned …\$RJCH036\cli flow.txt before …\$RJCH036\_run\baseline.txt, and the harness flagged it "not asc". UFFS is correct; the validator was wrong.

UFFS sorts string columns (name/path/ext) with the NTFS $UpCase table . the filesystem-native collation Explorer and the NTFS index B-tree use . which folds to uppercase. The harness folded .to_lowercase(). The ASCII gap 0x5B..=0x60 ([ \ ] ^ _ \``) sits **between Z(0x5A) anda(0x61)**, so_` orders after letters under uppercase but before them under lowercase, flipping the expected order for any path/name with such a char next to a letter.

What

  • String sort check: .to_lowercase().to_uppercase() (covers both the asc and desc branches . they share the folded vals).
  • Name-tiebreaker check (within equal path_only): same lowercase → uppercase . it had the identical latent bug.
  • Comments on both sites explain the $UpCase / 0x5B..=0x60 rationale so it is not "corrected" back to lowercase later.

UFFS itself is unchanged . this only fixes the conformance harness so its ascending/descending assertions model UFFS's real (NTFS-native) collation. rust-script compile-check passes.

🤖 Generated with Claude Code

…$UpCase

T59 (`*.txt --sort path`) failed on a real C: drive: UFFS returned
`…\$RJCH036\cli flow.txt` before `…\$RJCH036\_run\baseline.txt`, and the
harness flagged it "not asc". UFFS is correct — the validator was wrong.

UFFS sorts string columns (name/path/ext) with the NTFS `$UpCase` table, the
filesystem-native collation Explorer and the NTFS index B-tree use, which folds
to UPPERCASE. The harness folded `.to_lowercase()`. The ASCII gap 0x5B..=0x60
(`[ \ ] ^ _ \``) sits BETWEEN `Z` (0x5A) and `a` (0x61), so `_` orders AFTER
letters under uppercase but BEFORE them under lowercase — flipping the expected
order for any path/name with such a char adjacent to a letter.

- Sort-check string fold: `.to_lowercase()` -> `.to_uppercase()` (covers both
  asc and desc branches; they share the folded `vals`).
- Name-tiebreaker check (within equal path_only): same lowercase -> uppercase.
- Comments on both sites explain the `$UpCase` / 0x5B..=0x60 rationale so it is
  not "corrected" back to lowercase.

UFFS itself is unchanged; this only fixes the conformance harness so its
ascending/descending assertions model UFFS's real (NTFS-native) collation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@githubrobbi githubrobbi enabled auto-merge June 29, 2026 16:21
@githubrobbi githubrobbi added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit fe54855 Jun 29, 2026
21 checks passed
@githubrobbi githubrobbi deleted the fix/t59-sort-uppercase-collation branch June 29, 2026 16:35
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.

1 participant