Skip to content

Improve parser error context for manifests, lockfiles, and config#242

Open
cijiugechu wants to merge 5 commits intoyarnpkg:mainfrom
cijiugechu:error-ctx
Open

Improve parser error context for manifests, lockfiles, and config#242
cijiugechu wants to merge 5 commits intoyarnpkg:mainfrom
cijiugechu:error-ctx

Conversation

@cijiugechu
Copy link
Contributor

Part of #239 .

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Confidence Score: 5/5

  • This PR is safe to merge with no blocking issues
  • The changes are well-structured with comprehensive test coverage validating the deduplication logic and error formatting. The previous counting issue has been properly fixed using BTreeSet for unique locator tracking. All modifications follow consistent patterns across fetchers and maintain backward compatibility.
  • No files require special attention

Important Files Changed

Filename Overview
packages/zpm/src/error.rs Added RemoteManifestParseError variant and helper function to render user-friendly error messages with comprehensive tests
packages/zpm/src/report.rs Aggregates remote manifest parse errors by unique locators with proper deduplication, fixing the previous counting issue
packages/zpm/src/resolvers/npm.rs Converts generic parser errors to RemoteManifestParseError with locator context in npm resolution paths
packages/zpm/src/lockfile.rs Added path parameter to from_legacy_berry_lockfile and fixed alias locator keying issue
packages/zpm-config/src/lib.rs Added dedicated error variants for user and project config parse errors with path context

Last reviewed commit: 2a3d8cf

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Additional Comments (1)

packages/zpm/src/lockfile.rs
Wrong locator inserted

In the aliased_idents branch, this inserts entry.resolution.clone() as the key and uses aliased_locator only inside the Resolution (lockfile.entries.insert(entry.resolution.clone(), ...)). This will overwrite/collide with the non-aliased entry for the same entry.resolution, and it also means the aliased locator itself never becomes an entry key. The key here should be the aliased locator (or some other unique locator for the alias), otherwise aliased resolutions can be lost or corrupted when multiple aliases exist for the same underlying package.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/zpm/src/lockfile.rs
Line: 297:302

Comment:
**Wrong locator inserted**

In the `aliased_idents` branch, this inserts `entry.resolution.clone()` as the key and uses `aliased_locator` only inside the `Resolution` (`lockfile.entries.insert(entry.resolution.clone(), ...)`). This will overwrite/collide with the non-aliased entry for the same `entry.resolution`, and it also means the aliased locator itself never becomes an entry key. The key here should be the aliased locator (or some other unique locator for the alias), otherwise aliased resolutions can be lost or corrupted when multiple aliases exist for the same underlying package.

How can I resolve this? If you propose a fix, please make it concise.

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

⏱️ Benchmark Results

Metric Base Head Difference
Mean 2.610s 2.609s -0.06% ✅
Median 2.621s 2.593s -1.05% ✅
Min 2.513s 2.439s
Max 2.721s 2.825s
Std Dev 0.054s 0.093s
📊 Raw benchmark data

Base times: 2.646s, 2.655s, 2.721s, 2.626s, 2.513s, 2.642s, 2.640s, 2.528s, 2.587s, 2.613s, 2.588s, 2.620s, 2.649s, 2.569s, 2.681s, 2.593s, 2.563s, 2.635s, 2.660s, 2.621s, 2.581s, 2.686s, 2.534s, 2.651s, 2.542s, 2.542s, 2.620s, 2.515s, 2.631s, 2.657s

Head times: 2.700s, 2.825s, 2.817s, 2.748s, 2.660s, 2.679s, 2.590s, 2.691s, 2.618s, 2.605s, 2.565s, 2.627s, 2.572s, 2.594s, 2.454s, 2.628s, 2.585s, 2.484s, 2.550s, 2.544s, 2.439s, 2.571s, 2.553s, 2.571s, 2.645s, 2.521s, 2.509s, 2.592s, 2.720s, 2.598s


Benchmark: gatsby install-full-cold

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

13 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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