Skip to content

fix: write YAML config files in block style - #86

Merged
zkochan merged 1 commit into
mainfrom
fix/block-style-yaml
Nov 14, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix/block-style-yaml

Conversation

@zkochan

@zkochan zkochan commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Problem

Since #85, the generated config files have been written as JSON. JSON is valid YAML, but it leaves pnpm-workspace.yaml as a multi-line flow collection. pnpm 12 edits that file in place (--allow-build records allowBuilds there) and refuses to edit a flow collection, so the populate-registry-cache job fails while bootstrapping the installer:

× Cannot edit "allowBuilds" in ".../setup/pnpm-workspace.yaml": it uses an inline YAML
  value that cannot be edited in place (a multi-line flow collection, an alias, or a
  scalar). Reformat it to block style and try again.

Fix

yamlText now serializes with js-yaml's dump. Like JSON.stringify, it still quotes and escapes every value, which #85 was after, but it emits block style. noRefs: true keeps shared objects from being written as aliases, which pnpm cannot edit either. js-yaml was already installed through write-yaml-file; it is now a direct dependency.

Testing

  • bootstrapInstaller() now succeeds locally, and pnpm adds allowBuilds to the generated file.
  • pnpm test: 13 of 13 pass.
  • pnpm lint: clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Benchmark fixture values are now formatted as YAML block-style text, with quoting and escaping handled in the output. This makes generated fixtures easier to read and supports YAML formatting constraints.

#85 switched the generated config files to JSON, which is valid YAML but
leaves pnpm-workspace.yaml as a multi-line flow collection. pnpm 12 edits
that file in place (`--allow-build` records `allowBuilds` there) and
refuses to edit a flow collection, so bootstrapping the installer failed
with ERR_PNPM_WORKSPACE_MANIFEST_WRITER_UNSUPPORTED_INLINE_BLOCK.

yamlText now serializes with js-yaml's dump, which still quotes and
escapes every value but emits block style. `noRefs` keeps shared objects
from becoming aliases, which pnpm cannot edit either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

yamlText now serializes values as YAML with references disabled. The package adds js-yaml as a runtime dependency, and the helper documentation describes YAML quoting and pnpm’s editing requirements.

Changes: YAML serialization

Layer / File(s) Summary
YAML dependency and serialization
package.json, benchmarkFixture.js
The package adds js-yaml. benchmarkFixture.js imports it and uses YAML.dump with noRefs: true in yamlText. The helper documentation describes YAML quoting and pnpm’s in-place editing requirements.

Estimated code review effort: 2 (Simple) | ~8 minutes

Merge Risk: Minimal · up to f4fb7

This change makes generated YAML config files use block style so pnpm can edit them in place. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: write YAML config files in block style" matches the main change. The PR switches yamlText from JSON-like flow output to js-yaml block-style output with noRefs, which fixes pnpm failing…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: write YAML config files in block style" matches the main change. The PR switches yamlText from JSON-like flow output to js-yaml block-style output with noRefs, which fixes pnpm failing to edit flow-style collections in pnpm-workspace.yaml. The title is short, specific, and follows a conventional commit format.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

A rabbit stirred the YAML neat,
With block-style lines in rows complete.
No shared references cross the page,
The fixture helper takes the stage.
Then off I hop through fields of green,
With tidy YAML left behind, serene.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 185ee377-2c27-4005-89d8-b9ef48f7d38f
Commits

Reviewing files that changed from the base of the PR and between 6d825c7 and f4fb77a.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 2

  • benchmarkFixture.js
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Recent review details

Context from checks skipped due to timeout: 1

  • GitHub Check: CodeRabbit
Additional comments: 2

package.json: 1

23-23: LGTM!

benchmarkFixture.js: 1

8-8: LGTM!

Also applies to: 251-259, 262-262

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Write generated YAML in block style for pnpm 12

🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Generate block-style YAML so pnpm 12 can edit workspace manifests during installer bootstrap.
• Disable YAML aliases and declare the serializer as a direct dependency.
Diagram

graph TD
  A["Config producers"] --> B(["yamlText dump"]) --> C["Block YAML files"] --> D["pnpm 12 edits"]
Loading
High-Level Assessment

Keep serialization in the existing shared yamlText function: it fixes installer bootstrap and other YAML producers together. Using the existing write-yaml-file dependency instead would not fit callers that need serialized text rather than a file-writing API.

Files changed (3) +15 / -4

Bug fix (1) +11 / -4
benchmarkFixture.jsSerialize generated configs as block-style YAML +11/-4

Serialize generated configs as block-style YAML

• Replaces JSON.stringify with js-yaml dump in the shared yamlText function. Disables aliases so pnpm can edit generated workspace manifests in place.

benchmarkFixture.js

Other (2) +4 / -0
package.jsonDeclare js-yaml as a direct dependency +1/-0

Declare js-yaml as a direct dependency

• Adds the serializer used by benchmarkFixture.js to the project's runtime dependencies.

package.json

pnpm-lock.yamlRecord the direct js-yaml dependency +3/-0

Record the direct js-yaml dependency

• Adds js-yaml to the root importer's dependencies, using its existing locked version.

pnpm-lock.yaml

@zkochan
zkochan merged commit ca449bd into main Nov 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant