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.

Propagate pnpm-workspace.yaml load errors instead of silently swallowing them #402

@KSXGitHub

Description

@KSXGitHub

Background

pnpm v11 reads almost all configs from pnpm-workspace.yaml and reserves .npmrc for auth and network keys. The split lives in
isNpmrcReadableKey and the YAML loader is
workspace-manifest-reader.

Pacquet already reads pnpm-workspace.yaml:

  • crates/npmrc/src/workspace_yaml.rs defines WorkspaceSettings mirroring the pnpm‑11 camelCase key set (storeDir, nodeLinker, hoist family, lockfile, fetchRetries*, verifyStoreIntegrity, …).
  • Npmrc::current walks up from cwd to find the nearest pnpm-workspace.yaml and layers its overrides on top of the .npmrc-derived registry.
  • crates/npmrc/src/npmrc_auth.rs keeps only registry from .npmrc; project-structural keys there are silently ignored.
  • Existing tests already exercise this: pnpm_workspace_yaml_registry_overrides_npmrc_registry, pnpm_workspace_yaml_found_by_walking_up, non_auth_keys_in_npmrc_are_ignored, fetch_retry_keys_in_npmrc_are_ignored, plus the suite in workspace_yaml/tests.rs.

The remaining divergence from pnpm is on the error path. Upstream's readManifestRaw returns undefined only for ENOENT and propagates every other failure (read failure, invalid yaml). Pacquet swallowed all of them via if let Ok(Some(...)), so a typo in pnpm-workspace.yaml silently fell through to defaults — leaving the user uncertain which install settings were actually in effect.

Tasks

  • Make Npmrc::current return Result<Self, LoadWorkspaceYamlError>. find_and_load keeps Ok(None) for the missing-file case (is_file() gate), while read and parse failures bubble up.
  • Wrap the new error with miette::Diagnostic so the CLI prints a clean message including the offending path. Box the variant payloads to keep the Result small (clippy result_large_err).
  • Update CLI call sites and StoreCommand::run to thread the new fallible signature.
  • Add a regression test (invalid_workspace_yaml_propagates_error) asserting invalid yaml surfaces as ParseYaml { .. } instead of being silently dropped.

Requirements

Mirror pnpm v11.

Carefully read and comply with AGENTS.md, CONTRIBUTING.md, and CODE_STYLE_GUIDE.md before writing code. Also, after writing code, carefully double check whether the written code complies with these files.

Carefully read the DI issue and abide by it IF applicable.


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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