Rename requirement IDs from CACH- to Caching-PLT/Lib/OTS pattern and fix race condition in EnsureCachedAsync#14
Conversation
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Renames requirements IDs in requirements.yaml to a clearer Caching-<section>-<name> scheme and updates the linked test documentation comment to reference the new library requirement ID.
Changes:
- Updated
requirements.yamlrequirement IDs from the oldCACH-*scheme toCaching-Lib/PLT/OTS-*. - Updated the
NuGetCacheTestsXML remark to reference the renamedCaching-Lib-EnsureCachedrequirement.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/DemaConsulting.NuGet.Caching.Tests/NuGetCacheTests.cs | Updates the test’s requirement-reference comment to the new ID. |
| requirements.yaml | Renames all requirement IDs to the new Caching-* naming pattern while preserving the existing test evidence linkages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@copilot Can you think of a reason for this failure: |
…d of Directory.Exists Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
... Yes, exactly — it's a race condition. When all four target-framework test processes run simultaneously, one process creates the package directory inside The fix in commit |
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Pull Request
Description
Requirement IDs used the abbreviation
CACH-(not a meaningful product name) andPlatform(too verbose) as segment names. Renames all IDs to theCaching-<section>-<name>pattern with abbreviated section tokens.Mapping applied:
CACH-Lib-EnsureCachedCaching-Lib-EnsureCachedCACH-Platform-WindowsCaching-PLT-WindowsCACH-Platform-LinuxCaching-PLT-LinuxCACH-Platform-MacOSCaching-PLT-MacOSCACH-Platform-Net8Caching-PLT-Net8CACH-Platform-Net9Caching-PLT-Net9CACH-Platform-Net10Caching-PLT-Net10CACH-Platform-NetStd20Caching-PLT-NetStd20CACH-OTS-*(×6)Caching-OTS-*Also corrects a stale
CACH-REQ-007reference inNuGetCacheTests.cstoCaching-Lib-EnsureCached.Also fixes a race condition in
EnsureCachedAsyncwhere concurrent test-framework processes (e.g.net481,net8.0,net9.0,net10.0running in parallel) could all callEnsureCachedAsyncfor the same package simultaneously. The oldDirectory.Exists(packagePath)early-return guard could fire while another process was mid-extraction — returning a partially-populated directory before.nuspecor other files had been written. The fix changes the guard toFile.Exists(PathHelpers.SafePathCombine(packagePath, ".nupkg.metadata")): NuGet writes.nupkg.metadataas its last extraction step, so its presence is a definitive "fully installed" signal. If the directory exists but the metadata file is absent, execution falls through toGlobalPackagesFolderUtility.AddPackageAsync, which handles concurrent installs safely via cross-process file locking.Type of Change
Related Issues
Pre-Submission Checklist
Build and Test
dotnet build --configuration Releasedotnet test --configuration ReleaseCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint .Testing
Documentation
Additional Notes
The requirement ID rename is a pure string change — all test linkages are preserved; only the ID strings themselves changed. The race condition fix touches only the early-return guard in
NuGetCache.EnsureCachedAsync, usingPathHelpers.SafePathCombine(consistent with the rest of the file) to construct the.nupkg.metadatapath; no tests, interfaces, or public API signatures are altered.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.