test: cover cached cwd contracts#56
Merged
Merged
Conversation
Merging this PR will improve performance by 12.87%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | string |
255.8 ns | 226.7 ns | +12.87% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing agent/cached-cwd-contract-matrix (24515c6) with main (05c456d)
Footnotes
-
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
marked this pull request as ready for review
July 14, 2026 12:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cowownership.relative(...).into_owned().into_slash()follows the same cached-cwd policy whilerelative_withremains controlled only by its explicit cwd.sugar_pathpackage alone so workspace feature unification cannot silently enablecached_current_dir.Why
The existing cache test covered
absolutize, but did not enforce the ambientrelativebranches or their final slash-conversion composition. The unavailable-cwd test proved errors while cwd stayed missing, but did not prove that the cache retries after a failure. These tests make the documented process-lifetime feature behavior explicit without changing the implementation.Impact
This changes tests and one CI command only. It does not change production code, dependencies, benchmarks, or allocation snapshots. The same CI correction is owned by Draft PR #52; carrying it here lets this PR produce valid standalone default/all-feature evidence, and it will disappear from this diff after #52 merges and this branch rebases.
Validation
cargo +1.97.0 fmt --all --checkgit diff --checkcargo +1.97.0 test --test cached_current_dircargo +1.97.0 test --test cached_current_dir --all-featurescargo +1.97.0 test --test cached_current_dir_failurecargo +1.97.0 test --test cached_current_dir_failure --all-featurescargo +1.97.0 test -p sugar_path --test cached_current_dir_relativecargo +1.97.0 test -p sugar_path --all-features --test cached_current_dir_relativecargo +1.97.0 test -p sugar_pathcargo +1.97.0 test --workspace --all-featurescargo +1.97.0 clippy --workspace --all-targets --all-features -- -D warningsRUSTDOCFLAGS='-D warnings' cargo +1.97.0 doc --workspace --all-features --no-depsx86_64-pc-windows-msvc, with and withoutcached_current_dir, in a dependency-only harnessAdversarial review
cached_current_dirduring the nominal default-feature job. The default job now selects onlysugar_path./instead of the native separator. The expectation now usesPathBuf::join, and the rerun passed on Windows.Hosted CI passed all 9 checks. The logs confirm separate
cargo test --locked -p sugar_pathand workspace all-feature runs, with the cache lifecycle tests executing in both configurations on native Windows, Linux, and macOS. The unavailable-cwd recovery test also executes and passes on Linux and macOS.