Skip to content

pnpr: policy gaps on the pnpr path (strict mode inert, loose-mode auto-collect, error codes, capability negotiation) #25

Closed
pnpm/pnpm
#18236

Description

@zkochan

Follow-ups deliberately left out of pnpm/pnpm#13279, which forwarded the verification policy, catalogs, and resolution mode to the pnpr server. Each of these needs a design decision or a reproduction first, so they didn't belong in a forwarding fix.

Common root: on the pnpr path the server decides and the client only consumes a lockfile. There is no channel for "the server allowed this under the loose policy", because the violations terminal frame is a hard rejection — both clients turn it into an error (pnpr/client/src/resolveViaPnprServer.ts, pacquet-pnpr-client's build_verify_error).

1. minimumReleaseAgeStrict is inert through pnpr

minimumReleaseAgeStrict is not part of the resolve request at all — ResolveRequest (pnpr/crates/pnpr/src/resolver/protocol.rs) has minimumReleaseAge, minimumReleaseAgeExclude and minimumReleaseAgeIgnoreMissingTime, but no strict flag. The server falls back to its own config, which defaults to loose (Config::resolved_minimum_release_age_strict → unwrap_or(false)).

Client-side it is equally inert: strict mode acts on resolution violations, and on the pnpr path there are none to act on — the TypeScript handler's handleResolutionPolicyViolations runs during local resolution, which this path skips, and pacquet's handle_minimum_release_age_violations is only reached via install_with_fresh_lockfile, which install_via_pnpr does not go through.

So a user who sets minimumReleaseAgeStrict: true and configures a pnpr server gets neither the approval prompt nor the hard abort they asked for, in either stack, with no warning. Verified by reading; not reproduced.

The fix depends on a decision: forward the flag and let the server enforce it (the server cannot prompt — a non-TTY strict violation aborts, which may be the right answer for a server), or have the server report the picks and let the client run its existing UX. The second option cuts against "pnpr does the policy checks", so it needs your call.

2. Loose-mode auto-collect never fires, and the lockfile may not round-trip

Locally, a loose-mode immature pick is allowed and recorded: the install auto-appends it to minimumReleaseAgeExclude so the choice is explicit and the next install agrees with the last one.

Through pnpr nothing is recorded — the server's own gate returns early in loose mode, the pick lands in the returned lockfile, and no violation reaches the client, so no exclude entry is written.

The consequence I have not reproduced: on a re-run, verify_input_lockfile checks that same entry under minimumReleaseAge and, while it is still inside the maturity window, would reject the lockfile the previous install just produced — pnpr server rejected the lockfile under the verification policy. Install succeeds, immediate re-install fails. pnpm/pnpm#13279 does not change this: it forwards minimumReleaseAgeExclude, but the auto-collect that would populate that list never runs on this path.

A reproduction should come before any fix. If it holds, the shape consistent with server-side policy is for the resolve response to carry the picks the server allowed, which the client persists — the server cannot write the user's pnpm-workspace.yaml.

3. A frozen install through pnpr loses ERR_PNPM_OUTDATED_LOCKFILE

Now that frozenLockfile is forwarded (pnpm/pnpm#13279), an out-of-date lockfile correctly fails instead of being silently rewritten — but the failure surfaces as the server's error text through the NDJSON error frame, not pnpm's stable ERR_PNPM_OUTDATED_LOCKFILE. Error codes are part of the public contract, and CI setups match on them. Affects both stacks; pacquet has been forwarding frozen_lockfile all along.

Wants a mapping from the server's frozen-lockfile failure back to the client's own error code, which probably means a distinguishable code on the wire rather than string matching.

4. A client cannot tell whether the server enforces the policy it sent

Raised in review of pnpm/pnpm#13279 (security, P1) and confirmed.

ResolveRequest accepts and ignores unknown fields on purpose, so a pnpr predating a given policy silently drops it. With the client skipping its own verifyLockfileResolutions whenever a pnpr server is configured, a policy the server ignores is enforced by nobody — the install succeeds and the user believes their policy applied.

This is reachable today for trustPolicy: enforcement landed 2026-06-06 in pnpm/pnpm#12232, and @pnpm/pnpr has published builds from before it (0.0.0-0 on 2026-05-26 through 0.0.0-26060501 on 2026-06-05). PROTOCOL_VERSION is still 0 and was not bumped when enforcement landed, so the /-/pnpr handshake cannot distinguish the two and there is no signal a client could check.

pnpm/pnpm#13279 removed the TypeScript client's TRUST_POLICY_INCOMPATIBLE_WITH_PNPR guard, which had made this unreachable for that stack alone — pacquet has forwarded trust_policy without any guard since pnpm/pnpm#12232, so the guard preserved an inconsistency between the clients rather than a defense.

The fix is a capability signal. The shape I'd suggest: the done frame echoes the policies the server actually applied, so a silently dropped policy is detectable with no extra round trip, and a server that echoes nothing is treated as unable to honor the request. Refusing (or at minimum warning) then becomes accurate rather than blanket. Needs a decision on refuse-vs-warn, and lands in the server plus both clients.

Note, not a bug

ignoreManifestCheck is sent by pacquet and not by the TypeScript client, because the TypeScript CLI has no such setting. Nothing to do unless it grows one.


Written by an agent (Claude Code, claude-opus-5[1m]).

Activity

  1. github-actions commented on Jul 24, 2026

    @github-actions

    Oz triage is running now and will classify this issue and apply one pnpm state: label.

    Follow along in Oz: https://app.warp.dev/agent_run/019f964e-41e1-7d0b-a711-cbb9801498d4

  2. github-actions commented on Jul 24, 2026

    @github-actions

    Triage result

    • Issue: pnpm/tasks#25 — pnpr: minimumReleaseAge strict mode and loose-mode auto-collect are inert on the pnpr path
    • State: Ready to spec
    • Applied label: state: needs design
    • Product / parity: Both the TypeScript pnpm CLI (pnpm11/ tree) and the Rust pnpr server (pnpr/) are affected. The pacquet client (pnpm/) is also touched for bug 3 (it already forwards frozen_lockfile). Parity work is implied across all three stacks.
    • Rationale: All three bugs are confirmed in the codebase: (1) ResolveRequest has no minimum_release_age_strict field (pnpr/crates/pnpr/src/resolver/protocol.rs) and neither the TypeScript client (pnpm11/installing/deps-installer/src/install/index.ts:2688–2706) nor the pnpr client library (pnpr/client/src/resolveViaPnprServer.ts) send it; (2) minimumReleaseAgeExclude auto-collection is client-side only and never fires on the pnpr path, with no channel for the server to report its loose-mode picks back to the client; (3) the violations/error terminal NDJSON frame carries only a plain message string — there is no structured error code, so ERR_PNPM_OUTDATED_LOCKFILE is lost. Each of the three bugs requires a distinct design decision before coding can start: bug 1 needs a policy on whether the server aborts or the client drives the approval UX; bug 2 needs a reproduction and a protocol extension (server reporting allowed picks so the client can persist them to minimumReleaseAgeExclude); bug 3 needs a new structured wire code or a distinct frame type so the client can map back to its stable error code.
    • Next step: Design the protocol extensions needed — likely a structured error/code field on the terminal frame and a new allowedPicks array in the done frame — then spec how minimumReleaseAgeStrict is forwarded and enforced server-side vs. surfaced through client UX.

    Written by an agent (Oz, auto).

  3. changed the title [-]pnpr: minimumReleaseAge strict mode and loose-mode auto-collect are inert on the pnpr path[/-] [+]pnpr: policy gaps on the pnpr path (strict mode inert, loose-mode auto-collect, error codes, capability negotiation)[/+] on Jul 24, 2026
  4. transferred this issue frompnpm/pnpmon Sep 26, 2026
  5. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    Status check against main (2026-11-08).

    Items 3 and 4 are done in pnpm/pnpm#17112: the error frame carries a code (ERR_PNPM_OUTDATED_LOCKFILE) and the done frame returns AppliedPolicies.

    Left: items 1 and 2. ResolveRequest has no strict flag, and there is no loose-mode auto-collect.

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

  6. kairosci commented on Nov 19, 2026

    @kairosci

    This PR covers the remaining strict-mode and loose-mode auto-collect gaps. The server now fails strict resolutions when no mature version matches. In loose mode it returns its fallback picks so pnpm can persist them in minimumReleaseAgeExclude. It covers the pnpm v11 and v12 client paths. Error codes and capability negotiation were already handled by pnpm/pnpm#17112.

    PR: pnpm/pnpm#18236


    Written by an agent (Codex, GPT-6).

  7. added a commit that references this issue on Nov 21, 2026
    c96f1ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions