← Back to Pull requests

fix(workspace-manifest-writer): match the file's quote style for every added scalar #18364

Open
unknown opened this pull request with 526 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 22, 2026 20:46 UTC
Author

Summary

The workspace manifest writer quotes a scalar that needs quoting with single quotes. pnpm/pnpm#15533 made minimumReleaseAgeExclude and trustPolicyExclude entries follow a double-quoted pnpm-workspace.yaml, but every other write path still adds single-quoted scalars. This PR applies the file's quote style to every write.

Related to pnpm/pnpm#15079.

Problem

These write paths still add single-quoted scalars to a double-quoted file:

  • pnpm config set

  • approving builds (allowBuilds)

  • catalog updates, overrides, configDependencies and patchedDependencies

  • values serialized by yamlpatch
  • Projects whose formatter enforces double quotes (Prettier, Biome, Oxfmt) get a formatting failure or diff after each of these commands.

    To reproduce, start from this pnpm-workspace.yaml next to a minimal package.json:

    packages:
      - "."
    minimumReleaseAge: 1440
    

    Then run:

    pnpm config set --location project minimumReleaseAgeExclude '["@<scope>/<pkg>@1.0.0"]' --json
    

    The file keeps - "." but gains - '@<scope>/<pkg>@1.0.0'.

    Change

  • The quote style is judged once, on the original text, when the manifest is parsed. It is applied in ManifestDocument::into_text, which every write goes through.

  • When double quotes dominate, every single-quoted scalar that the original did not already contain is rewritten with double quotes.

  • Single-quoted scalars already in the file keep their quotes, matched by their source text. A value that would need escapes inside double quotes also keeps single quotes.

  • Single-quoted, unquoted, evenly split and new files are written exactly as before, matching the fallback pnpm/pnpm#15533 chose.

  • Because the pass covers every writer, it replaces the quote style pnpm/pnpm#15533 threaded through the exclude-list renderers. That PR's tests pass unchanged.
  • Alternatives considered

  • Always write double quotes: changes the output for single-quoted and unquoted files.

  • A new setting: adds config surface when the file already shows its style.

  • Threading a style through every renderer: touches about ten files and still misses values that yamlpatch and pnpm-config serialize themselves.
  • Tests

  • tests/quote_style.rs covers pnpm config set, allowBuilds and catalogs in double-quoted, single-quoted, unquoted and new manifests, plus an existing single-quoted key surviving in a double-quoted file.

  • tests/render.rs unit-tests the pass, including the escape case.

  • cargo nextest run -p pnpm-workspace-manifest-writer passes (305 tests), as do the pnpm-package-manager minimum_release_age:: tests.
  • Checklist

  • I checked the referenced issue and verified that none of the PRs already linked to it solves it.

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes are implemented in every affected version.

  • Added a changeset (pnpm changeset) if this PR changes any published package. Keep it short and written for pnpm users — it becomes a release note.

  • Added or updated tests.
  • ---
    Written by an agent (Claude Code, claude-opus-5-5).

    <!-- codesmith:footer -->
    ---
    <a href="https://dashboardbackend.blacksmith.sh/track/run-proof?expires=1797972397&installation_model_id=426870&pr_number=18364&ref=codesmith_pr_footer&repository=pnpm%2Fpnpm&return_to=https%3A%2F%2Fgithub.com%2Fpnpm%2Fpnpm%2Fpull%2F18364&variant=prove_it_works&signature=a52b0b0f5ccdef3f6d76dbaf8dde16cceeb2e008f4367f35522ce963e52bee52"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-prove-it-works-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-prove-it-works-v2-light.svg"><img alt="Prove it works" src="https://pr-comments-assets.blacksmith.sh/codesmith/proof-prove-it-works-v2-dark-3x.png" width="129" height="28"></picture></a>
    <sup><a href="https://app.blacksmith.sh/pnpm/codesmith/pnpm/pr/18364?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    Diff: 526 lines (+394 / -132) across 6 files Reviewer: greptile-apps[bot] Review duration: 4m
    All Vouch review confidence checks passed
    Residual risk 0.36 = Change Risk (0.48) × (1 − Review Confidence (0.25)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 526 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 30% · Reviewer familiarity: 35%
    24%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.375
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #18364"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 24.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.8% (MEDIUM) · Higher = larger blast radius
    47.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 24.9% · Lower = rushed or shallow review
    24.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 35.9% · Moderate risk
    35.9%
    Repository