Skip to content

fix: preserve borrowing for Windows drive-relative paths#67

Merged
hyfdev merged 2 commits into
mainfrom
agent/public-normalize-model
Jul 15, 2026
Merged

fix: preserve borrowing for Windows drive-relative paths#67
hyfdev merged 2 commits into
mainfrom
agent/public-normalize-model

Conversation

@hyfdev

@hyfdev hyfdev commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an independent bounded oracle for public normalize and into_normalized semantics
  • cover 6,560 Unix and 14,040 Windows cases across roots, drive-relative paths, components, separator spellings, trailing separators, Unicode, and case preservation
  • verify exact results, Cow ownership, borrow source, and consuming results
  • preserve borrowing and owned-buffer reuse for normalized Windows drive-relative leading-parent paths such as C:..\..

Why

The existing classifier test compares the production classifier with the production normalizer. It protects output equality, but cannot independently validate public normalization semantics or detect an unnecessary allocation when both paths produce the same value.

The new model exposed a real classifier gap: the generic Windows scan treated the second \.. in C:..\.. as requiring normalization. Drive-relative leading parents cannot be collapsed, so the normalizer rebuilt an identical path and returned an owned result.

The classifier now recognizes canonical drive-relative leading-parent tails while still rejecting duplicate separators, current-directory components, trailing separators in strip mode, and parents that follow a normal component.

Impact

  • public output semantics are unchanged
  • canonical Windows drive-relative leading-parent paths now return Cow::Borrowed
  • into_normalized reuses the original owned buffer for those paths
  • paths that actually require normalization still return an owned result

Validation

  • default and cached_current_dir workspace tests
  • full Clippy with warnings denied
  • documentation and package verification
  • Windows MSVC library and integration-test metadata compilation
  • native Linux, Windows, macOS, and WebAssembly CI
  • Linux and Windows allocation snapshots
  • CodSpeed: 228 unchanged benchmarks
  • final adversarial review: pass

@codspeed-hq

codspeed-hq Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 228 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing agent/public-normalize-model (74949da) with main (2c2b185)

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@hyfdev hyfdev changed the title test: model public normalization semantics fix: preserve borrowing for Windows drive-relative paths Jul 15, 2026
@hyfdev
hyfdev marked this pull request as ready for review July 15, 2026 14:18
Copilot AI review requested due to automatic review settings July 15, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hyfdev
hyfdev merged commit 9ddede0 into main Jul 15, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
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.

2 participants