fix(npm-resolver): minimumReleaseAge handling for cached abbreviated metadata (release/10)#11630
Merged
zkochan merged 1 commit intoMay 14, 2026
Conversation
…metadata Backport of #11622 to release/10. The npm registry returns abbreviated package metadata (without per-version `time`) by default, which made the maturity check throw ERR_PNPM_MISSING_TIME whenever cached abbreviated metadata was reused under `publishedBy`/`minimumReleaseAge`. pnpm now upgrades cached abbreviated metadata to the full document via a follow-up fetch, persists the upgrade to the on-disk cache so subsequent installs skip the extra fetch, and lets ERR_PNPM_MISSING_TIME from the cache fast path fall through to the network fetch even under strict mode. Adapted to release/10's simpler pickPackage shape (no 304/etag plumbing, no `pickMatchingVersionFast`/`pickMatchingVersionFinal` split, no `ignoreMissingTimeField`), so the unconditional helper triggers the upgrade whenever the cached meta lacks `time`.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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
Backport of #11622 to
release/10.The npm registry returns abbreviated package metadata (without per-version
time) by default. Whenever pnpm reused cached abbreviated metadata underminimumReleaseAge/publishedBy,pickPackageFromMetawould throwERR_PNPM_MISSING_TIMEbecause the maturity check needstimeto run.This PR makes pnpm upgrade cached abbreviated metadata to the full document via a follow-up fetch whenever
publishedByis active and the cached meta lackstime:preferOffline/pickLowestVersionpaths)The upgraded full metadata is persisted to the on-disk cache so subsequent installs skip the extra fetch. The version-spec cache fast path also now lets
ERR_PNPM_MISSING_TIMEfall through to the network fetch even understrictPublishedByCheck, since the fetch can supply realtimedata.Differences from main
The original commit (e526f89 on
main) sits on top of refactors that don't exist onrelease/10:FetchMetadataResult/304 plumbing —ctx.fetchreturnsPackageMetadirectly, so the 304-specific branch is omitted.pickMatchingVersionFast/pickMatchingVersionFinalsplit — release/10 uses a single_pickPackageFromMeta.prepareJsonForDisk/.jsonlcache format — release/10 writes plain JSON.modified-based gating — release/10'sPackageMetalacks themodifiedfield, so the helper triggers the upgrade whenever cached meta lackstime(correctness over saving a network call).Test plan
pnpm --filter @pnpm/npm-resolver run compile(lint + tsc) cleanpnpm --filter @pnpm/npm-resolver test— all 135 tests pass, including 3 new ones inpublishedBy.test.ts:publishedByis setpublishedByis setstrictPublishedByCheck=truedoes not rethrowERR_PNPM_MISSING_TIMEfrom the version-spec cache pathWritten by an agent (Claude Code, claude-opus-4-7).