Skip to content

Fix yarnrc compressionLevel comment refusal (#370) - #508

Open
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
agent/fix-yarnrc-compression-comment
Open

Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
agent/fix-yarnrc-compression-comment

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #370

Summary

A .yarnrc.yml line such as compressionLevel: 0 # keep yarn default is yarn's default (yarn reads it as 0 and writes cacheKey: 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 after compressionLevel: 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:

  • A quoted value ('0' / "0") ends at its closing quote. Anything after it, such as a comment, is ignored.
  • A plain value ends before a # that follows whitespace (space or tab).
  • A # with no whitespace before it stays part of a plain value, as in YAML. So 0#x is not the default and is still refused, so an ambiguous value still blocks.

Tests (red → green)

Test Layer Without fix With fix
yarnrc_compression_level_drops_a_trailing_comment reader unit FAIL pass
yarnrc_compression_level_keeps_an_unseparated_hash fail-closed guard pass pass
commented_default_compression_level_vendors vendored gate FAIL pass
berry_hosted_preflight_mirrors_the_rewriter_gates (+2 asserts) hosted gate FAIL pass
yarn_berry_vendor_commented_default_compression_level real yarn 4.12.0 e2e: full vendored capstone (fresh checkout --immutable --check-cache, VEX, revert) with the commented knob FAIL (vendor_yarn_berry_cache_unsupported) pass

The e2e capstone also asserts that the lock real yarn writes has cacheKey: 10c0. That shows yarn itself reads the commented line as 0.

Local results

  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo test --workspace --all-features: all pass except three covgap_commands_vendor state-write-failure tests. They depend on chmod 0o555 blocking writes, which root ignores in this container, and the file is unrelated to this change.
  • e2e_vendor_yarn_berry_build + e2e_redirect_yarn_berry_build on yarn 4.12.0: 14/14 + 14/14.
  • cargo fmt: the new lines follow rustfmt. I didn't run cargo fmt --all, because main itself isn't fmt-clean (it would reformat about 120 unrelated files) and CI doesn't check formatting.
  • Wrappers (npm/, pypi/, gem/): no change needed. The change is entirely inside the Rust core.

Per-issue checklist

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

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
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] Bun patch compatibility / native (ubuntu-latest, 1.1.39) failed on 933280e: 43/44 cells passed. The one failure is workspace-get-search vendored, check vexLedgersDeleted (vex with the ledgers deleted, scripts/backtest-bun.py:1131).

I don't think this failure comes from this PR. The only code changed is yarnrc_compression_level, and its two callers are yarn-berry-only: refuse_unsupported_compression (vendored berry) and preflight_yarn_berry_hosted (hosted berry). The Bun backtest never reaches either of them.

The same leg passed on the heads of the other open agent PRs, all based on the same main. This run also logged a mock-API request transport failed retry in the sibling workspace hosted cell. No fix exists to port. I'll re-run the failed job once when the workflow run finishes; a second failure gets treated as real.


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] A second check also failed on 933280e: Poetry patch compatibility / native (ubuntu-latest, 1.3.2). Two cells failed, direct agent (appliedExactlyOne) and crlf hosted (vexLedgersDeleted, warmInstallReplacesUpstream). The other 3/5 cells passed.

The reasoning is the same as for the Bun leg above: this PR only changes the yarn berry .yarnrc.yml reader, which no Poetry code path calls. The same workflow passed on the other PR heads built on the same main (most recently #503's 0be19d0, at 22:17). Both suites failed within a minute of each other (22:38), on vex and apply checks against the mock patch API.

I've used this check's one re-run (rerun_failed_jobs on run 36936009039). The Bun 1.1.39 leg gets its re-run once its workflow run finishes. If either fails a second time, I'll treat it as real and investigate it from the captured logs.


Generated by Claude Code

@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 1, 2026 22:53
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 2, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] Ready for review at 933280e.

  • CI: 96/96 non-skipped checks green (plus 1 neutral: a cancelled duplicate Bugbot run). The earlier Bun 1.1.39 and Poetry 1.3.2 cell failures noted above passed on re-run.
  • Bugbot: reviewed 933280e (22:59Z) — no issues found.
  • Mergeable against main, no unresolved review threads.
  • Slack announcement pending: the burn-down agent has no Slack send tool this run.

Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yarn berry vendored and hosted modes refuse compressionLevel: 0 # comment in .yarnrc.yml as a non-default compression level

2 participants