Skip to content

test: cover slash conversion policies#53

Merged
hyfdev merged 2 commits into
mainfrom
agent/slash-policy-matrix
Jul 14, 2026
Merged

test: cover slash conversion policies#53
hyfdev merged 2 commits into
mainfrom
agent/slash-policy-matrix

Conversation

@hyfdev

@hyfdev hyfdev commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • exercise strict, fallible, and lossy slash conversion across str, String, Path, borrowed PathBuf, and consuming PathBuf receivers
  • pin exact non-normalizing spelling and Cow ownership on Unix and Windows, including UNC spelling, mixed separators, repeated and trailing separators, and multibyte UTF-8
  • cover invalid native encoding with strict panic, exact fallible recovery of the original bytes or wide units, and both separator-replacing and no-replacement lossy branches

This PR changes tests only. It does not change production code, dependencies, benchmarks, or benchmark inputs.

Validation

  • SUGAR_PATH_EXPECT_CACHED_CURRENT_DIR=0 cargo +1.97.0 test --locked -p sugar_path
  • SUGAR_PATH_EXPECT_CACHED_CURRENT_DIR=1 cargo +1.97.0 test --locked --workspace --all-features
  • cargo +1.97.0 fmt --all -- --check
  • cargo +1.97.0 clippy --locked --workspace --all-targets --all-features -- -D warnings
  • targeted slash-policy integration tests
  • changed integration tests checked for x86_64-pc-windows-msvc through a dependency-only harness, avoiding the repository dev-only mimalloc build that requires a local Windows SDK
  • final adversarial review: PASS after adding explicit Windows invalid-Unicode lossy coverage with no native separator

Final coverage audit

  • The audit found that invalid Unix and Windows try_into_slash cases asserted pointer and capacity identity even though storage reuse is an optimization rather than part of the returned value contract.
  • Those assertions are removed. Exact native bytes or wide units remain required, while the valid-UTF-8 clean owned cases continue to protect the accepted storage-reuse path.

At the rebased head e4372a2, all eight repository Actions jobs pass. Native Windows confirms that the invalid-wide recovery test and valid receiver-policy matrix execute under both default and all features; Linux and macOS likewise execute their Unix policy cases.

External CodSpeed alone reports as_path/rolldown_corpus/string 226.7→255.8 ns (-11.4%) while explicitly warning that the runtime environments differ. This is the exact non-attributable result already observed on merged test-only PR #52; this PR's diff contains only tests and changes no production code, dependency, benchmark, or benchmark input.

@codspeed-hq

codspeed-hq Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 11.4%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 227 untouched benchmarks
⏩ 38 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation string 226.7 ns 255.8 ns -11.4%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing agent/slash-policy-matrix (e4372a2) with main (36ea1df)

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 force-pushed the agent/slash-policy-matrix branch from 815fc30 to e4372a2 Compare July 14, 2026 13:55
@hyfdev hyfdev marked this pull request as ready for review July 14, 2026 14:19
Copilot AI review requested due to automatic review settings July 14, 2026 14:19

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 6985923 into main Jul 14, 2026
8 of 9 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 14, 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