Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

ignoredOptionalDependencies config + lockfile field + outdated-setting check (#434 slice 7) #503

Description

@zkochan

Last slice of the #434 umbrella (Proper optionalDependencies support). Slices 1–6 (#439, #456, #467, #474, #485, #495) cover the install-time filter, the current-lockfile prune, and the wire-shape plumbing. This slice adds the user-facing ignoredOptionalDependencies setting — a list of dep-name patterns the user wants entirely excluded from resolution and install.

Upstream surface (pnpm/pnpm@94240bc046):

Scope

  • pacquet-config: add ignored_optional_dependencies: Option<Vec<String>> to Config; deserialize from pnpm-workspace.yaml.
  • pacquet-lockfile: add ignored_optional_dependencies: Option<Vec<String>> to Lockfile as a top-level field (matching upstream's wire shape — NOT inside LockfileSettings).
  • pacquet-package-manifest: add a mutator method on PackageManifest that takes patterns and drops matching keys from optionalDependencies and dependencies. Mirrors the hook above.
  • Apply at install time: in Install::run, clone the manifest, apply the filter, pass the filtered manifest to satisfies_package_manifest. Necessary because the lockfile was already resolved with the hook applied, but the on-disk package.json still has the entry — without the filter, the freshness check would flag them as drift.
  • Outdated-setting check: extend satisfies_package_manifest (or add a sibling check) to compare the lockfile's ignoredOptionalDependencies (sorted) against config.ignored_optional_dependencies (sorted). Mismatch surfaces as a new StalenessReason::IgnoredOptionalDependenciesChanged variant → OutdatedLockfile error.
  • Slice 6 current-lockfile filter: preserve the ignored_optional_dependencies field when filtering the wanted lockfile down to the current lockfile (so subsequent installs see the same recorded set).

Tests

  • Yaml-parse round-trip for the new Config field.
  • Lockfile serde round-trip for the new top-level field.
  • PackageManifest::remove_optional_dependencies_matching deletes matching keys from both maps; non-matching keys survive.
  • satisfies_package_manifest: drift between recorded set and config surfaces as IgnoredOptionalDependenciesChanged; matching sets (regardless of order) pass; both-empty passes.
  • Slice-6 filter preserves the field through the current-lockfile write.

Out of scope

  • The resolver-side hook itself for transitive packages — pacquet has no resolver. The mutator method is still useful for the importer manifest (used by the freshness check) and for parity with the resolver-port shape.
  • Catalogs / patchedDependencies outdated-setting checks — different settings, separate slices.
  • Pattern matching beyond the existing pacquet_config::matcher (workspace-level helper used by hoistPattern etc.).

Upstream pin

pnpm/pnpm@94240bc046. Umbrella slice 1 in #439, slice 2 in #456, slice 3 in #467, slice 4 in #474, slice 5 in #485, slice 6 in #495; this is umbrella slice 7 — last of the optional-dependencies umbrella.


Written by an agent (Claude Code, claude-opus-4-7).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions