Skip to content

patch fetcher: strip metadata suffix from patch file paths#254

Open
hamidrezahanafi wants to merge 1 commit intoyarnpkg:mainfrom
hamidrezahanafi:hamid/pr3-patch-path-metadata
Open

patch fetcher: strip metadata suffix from patch file paths#254
hamidrezahanafi wants to merge 1 commit intoyarnpkg:mainfrom
hamidrezahanafi:hamid/pr3-patch-path-metadata

Conversation

@hamidrezahanafi
Copy link

Summary

  • support patch references whose path segment includes metadata suffixes like ::version=...&hash=...
  • read patch files from the filesystem using only the path part before ::
  • add acceptance coverage in protocols/patch.test.ts for metadata-suffixed patch paths

Test plan

  • cargo test -p zpm patch -- --nocapture
  • Acceptance test added in tests/acceptance-tests/pkg-tests-specs/sources/protocols/patch.test.ts

Made with Cursor

Patch references can include metadata after `::`, but only the path before that suffix exists on disk. Strip metadata before reading patch files so nested patch references install reliably.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 14, 2026

Greptile Overview

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is clean, focused, and well-tested. The patch_file_path helper correctly handles the edge case where :: is absent (via unwrap_or), and the logic only affects filesystem access while preserving the full metadata in the stored reference. The acceptance test validates the expected behavior.
  • No files require special attention

Important Files Changed

Filename Overview
packages/zpm/src/fetchers/patch.rs Added patch_file_path helper to strip metadata suffixes from patch paths before filesystem access
tests/acceptance-tests/pkg-tests-specs/sources/protocols/patch.test.ts Added test to verify patch paths with metadata suffixes (e.g. ::version=1.0.0&hash=deadbeef) work correctly

Last reviewed commit: c96556d

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