fix(env-installer): mark optional config subdep snapshots with optional: true#11770
Conversation
…al: true Match how optional packages are recorded elsewhere in pnpm-lock.yaml so non-host platform variants pulled in via a config dep's optionalDependencies aren't treated as required.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.test.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-05-14T09:04:00.133ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThe PR updates env-lockfile snapshot recording for optional subdependencies of config dependencies. Previously, these snapshots were empty objects; they now include ChangesOptional subdependency snapshot flagging
Possibly related PRs
Suggested labels
Poem
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adjusts env lockfile serialization for optional subdependencies of config dependencies so they are marked consistently as optional (aligning with pnpm-lock.yaml semantics).
Changes:
- Write
{ optional: true }into env lockfile snapshots for optional subdeps recorded byresolveOptionalSubdeps. - Update
resolveConfigDepstest expectations and inline commentary to match the new snapshot shape. - Add a changeset to release the behavior change as a patch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| installing/env-installer/test/resolveConfigDeps.test.ts | Updates assertions/comments to expect { optional: true } snapshots for optional subdeps. |
| installing/env-installer/src/resolveOptionalSubdeps.ts | Changes optional subdep snapshot serialization from {} to { optional: true }. |
| .changeset/config-deps-optional-subdep-snapshot-flag.md | Declares patch releases and documents the lockfile serialization adjustment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ...pickPlatformFields(resolution.manifest), | ||
| } | ||
| if (opts.envLockfile.snapshots[subdepKey] == null) { | ||
| opts.envLockfile.snapshots[subdepKey] = {} | ||
| opts.envLockfile.snapshots[subdepKey] = { optional: true } | ||
| } |
Summary
resolveOptionalSubdepsrecords a subdep snapshot in the env lockfile, it now writes{ optional: true }instead of{}, matching how all other optional packages are recorded inpnpm-lock.yaml.@pacquet/*platform packages pulled in via@pnpm/pacquet'soptionalDependencieswere recorded as plain empty snapshots, inconsistent with how@reflink/*,@esbuild/*, and friends are marked elsewhere in the lockfile.Notes
installConfigDeps) doesn't consume this flag.pnpm update <config-dep>or remove + re-add) for the flag to land.Test plan
resolveConfigDeps.test.tsto assert{ optional: true }on the subdep snapshot.pnpm-lock.yamlso the@pacquet/*snapshots pick upoptional: true.Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
Release Notes
Bug Fixes