Fix yarnrc compressionLevel comment refusal (#370) - #508
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A .yarnrc.yml line like `compressionLevel: 0 # keep yarn default` is the yarn default (cacheKey 10c0), but socket-patch read the comment as part of the value and refused the project in both vendored and hosted mode. The reader now parses the value as a YAML scalar: a quoted value ends at its closing quote and a plain value ends before a whitespace-separated `#`. Anything not positively `0` still refuses. Fixes #370 Assisted-by: Claude Code:claude-opus-5-5
|
[agent] I don't think this failure comes from this PR. The only code changed is The same leg passed on the heads of the other open agent PRs, all based on the same Generated by Claude Code |
|
[agent] A second check also failed on 933280e: The reasoning is the same as for the Bun leg above: this PR only changes the yarn berry I've used this check's one re-run ( Generated by Claude Code |
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 933280e. Configure here.
|
[agent] Ready for review at
Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #370
Summary
A
.yarnrc.ymlline such ascompressionLevel: 0 # keep yarn defaultis yarn's default (yarn reads it as0and writescacheKey: 10c0). socket-patch counted the trailing comment as part of the value, so it refused the project in both vendored mode (vendor_yarn_berry_cache_unsupported) and hosted mode (redirect_yarn_berry_cache_unsupported). Every npm purl in the project was left unpatched with exit 1.Root cause
yarnrc_compression_level(crates/socket-patch-core/src/vendor/yarn_berry_lock.rs) took everything aftercompressionLevel:as the value. The vendored gate (refuse_unsupported_compression) and the hosted gate (preflight_yarn_berry_hosted) both read the knob through it, so fixing the reader fixes both.Fix
The value is now read as a YAML scalar would be:
'0'/"0") ends at its closing quote. Anything after it, such as a comment, is ignored.#that follows whitespace (space or tab).#with no whitespace before it stays part of a plain value, as in YAML. So0#xis not the default and is still refused, so an ambiguous value still blocks.Tests (red → green)
yarnrc_compression_level_drops_a_trailing_commentyarnrc_compression_level_keeps_an_unseparated_hashcommented_default_compression_level_vendorsberry_hosted_preflight_mirrors_the_rewriter_gates(+2 asserts)yarn_berry_vendor_commented_default_compression_level--immutable --check-cache, VEX, revert) with the commented knobvendor_yarn_berry_cache_unsupported)The e2e capstone also asserts that the lock real yarn writes has
cacheKey: 10c0. That shows yarn itself reads the commented line as0.Local results
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test --workspace --all-features: all pass except threecovgap_commands_vendorstate-write-failure tests. They depend onchmod 0o555blocking writes, which root ignores in this container, and the file is unrelated to this change.e2e_vendor_yarn_berry_build+e2e_redirect_yarn_berry_buildon yarn 4.12.0: 14/14 + 14/14.cargo fmt: the new lines follow rustfmt. I didn't runcargo fmt --all, becausemainitself isn't fmt-clean (it would reformat about 120 unrelated files) and CI doesn't check formatting.npm/,pypi/,gem/): no change needed. The change is entirely inside the Rust core.Per-issue checklist
compressionLevel: 0 # commentin .yarnrc.yml as a non-default compression level #370: vendored and hosted no longer refusecompressionLevel: 0 # comment; non-default levels with comments still refuse. Covered by the reader, gate and e2e tests above.CI
All checks are green on 933280e. Two backtest legs that can't reach this code failed on the first attempt and passed on their one re-run each:
Poetry patch compatibility / native (ubuntu-latest, 1.3.2)Bun patch compatibility / native (ubuntu-latest, 1.1.39)Bugbot reviewed 933280e and found no issues.
🤖 Generated with Claude Code
Generated by Claude Code