Skip to content

fix: time-based resolution loses publishedAt on fast path#11618

Merged
zkochan merged 1 commit into
pnpm:mainfrom
pgoldberg:fix-time-based-bug
May 14, 2026
Merged

fix: time-based resolution loses publishedAt on fast path#11618
zkochan merged 1 commit into
pnpm:mainfrom
pgoldberg:fix-time-based-bug

Conversation

@pgoldberg

@pgoldberg pgoldberg commented May 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #11616

Summary by CodeRabbit

  • Bug Fixes
    • Fixed installs failing when using time-based dependency resolution with minimumReleaseAge when lockfile time entries were incomplete or missing. The resolver now properly preserves publish timestamp metadata from the lockfile and gracefully falls back to fetching registry metadata when required data is unavailable.

Review Change Stack

@pgoldberg pgoldberg requested a review from zkochan as a code owner May 13, 2026 15:00
@welcome

welcome Bot commented May 13, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2588806e-00f8-4bd3-bda5-4c979c2d2850

📥 Commits

Reviewing files that changed from the base of the PR and between 94240bc and 8ca45a1.

📒 Files selected for processing (7)
  • .changeset/preserve-published-at-in-fast-path.md
  • installing/deps-installer/test/install/minimumReleaseAge.ts
  • installing/deps-resolver/src/resolveDependencies.ts
  • installing/package-requester/src/packageRequester.ts
  • resolving/npm-resolver/src/index.ts
  • resolving/resolver-base/src/index.ts
  • store/controller-types/src/index.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,tsx,jsx}: Use trailing commas in code following Standard Style with modifications
Prefer functions over classes
Declare functions after they are used, relying on hoisting
Functions should have no more than two or three arguments; use a single options object for functions needing more parameters
Organize imports in order: standard libraries, external dependencies (sorted alphabetically), then relative imports

Files:

  • resolving/resolver-base/src/index.ts
  • store/controller-types/src/index.ts
  • installing/package-requester/src/packageRequester.ts
  • installing/deps-installer/test/install/minimumReleaseAge.ts
  • installing/deps-resolver/src/resolveDependencies.ts
  • resolving/npm-resolver/src/index.ts
🔇 Additional comments (7)
store/controller-types/src/index.ts (1)

104-104: LGTM!

resolving/resolver-base/src/index.ts (1)

216-216: LGTM!

.changeset/preserve-published-at-in-fast-path.md (1)

1-10: LGTM!

installing/deps-resolver/src/resolveDependencies.ts (1)

1335-1335: LGTM!

installing/package-requester/src/packageRequester.ts (1)

184-184: LGTM!

installing/deps-installer/test/install/minimumReleaseAge.ts (1)

3-3: LGTM!

Also applies to: 92-114

resolving/npm-resolver/src/index.ts (1)

322-323: LGTM!

Also applies to: 357-365, 385-385


📝 Walkthrough

Walkthrough

This PR extends the resolution pipeline to propagate publishedAt metadata from the lockfile's time block, enabling time-based minimumReleaseAge resolution to succeed when time entries exist, and fall back to registry metadata when they do not.

Changes

Publish time propagation for time-based resolution

Layer / File(s) Summary
Type contracts for publishedAt field
store/controller-types/src/index.ts, resolving/resolver-base/src/index.ts
Export types RequestPackageOptions and ResolveOptions.currentPkg extend to include optional publishedAt?: string field.
Resolution pipeline publishedAt propagation
installing/deps-resolver/src/resolveDependencies.ts, installing/package-requester/src/packageRequester.ts, resolving/npm-resolver/src/index.ts
Deps-resolver reads publishedAt from lockfile time block and passes to store controller; package-requester carries it through resolve; npm-resolver fast path checks whether publishedAt is known before optimization and returns it in results.
Test and changelog for lockfile time repopulation
.changeset/preserve-published-at-in-fast-path.md, installing/deps-installer/test/install/minimumReleaseAge.ts
Changelog documents that time-based minimumReleaseAge no longer fails when lockfile time entries are missing; regression test verifies time block is restored on re-install.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Suggested reviewers

  • zkochan

Poem

🐰 Time flows through the lockfile's gentle stream,
No more lost entries in the resolver's dream!
PublishedAt now glides from store to fast-path bright,
And when the times run missing, the registry's insight
Makes whole what was broken—a hop toward the light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary fix: restoring publishedAt preservation in the npm-resolver fast path for time-based resolution, which directly addresses the linked issue.
Linked Issues check ✅ Passed The PR successfully addresses the root causes identified in #11616: it ensures publishedAt is sourced from the lockfile's time block and implements fallback logic when entries are missing.
Out of Scope Changes check ✅ Passed All changes are focused on the fix: propagating publishedAt through the resolution chain, updating type definitions, and adding a regression test. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@mandarini

Copy link
Copy Markdown
Contributor

Cross-linking #11622 which fixes a related minimumReleaseAge + cached-abbreviated-metadata class of bug in pickPackage. Different code path from this one (cached fast paths in pickPackage vs the resolveNpm peek-from-store fast path here), no file overlap, both fixes are valuable independently.

@zkochan zkochan enabled auto-merge (squash) May 14, 2026 08:55
@zkochan zkochan merged commit c2c2890 into pnpm:main May 14, 2026
10 checks passed
@welcome

welcome Bot commented May 14, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

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.

Missing lockfile time entry causes incorrect minimumReleaseAge failure when using time-based resolution

3 participants