GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — Fix yarnrc ${VAR} and YAML setting reads (#1100) by mikolalysenko · Pull Request #1433 · SocketDev/socket-patch Conversation
|
| #1100 row | Test | Red on main |
|---|---|---|
nodeLinker: "${L:-pnp}" / "${L}" with L=pnp / "${L:-node-modules}" with L=pnp, agent apply |
e2e_safety_yarn_pnp::pnp_loader_under_interpolated_pnp_linker_refuses, pkg_managers::yarnrc_linker_is_read_as_yarn_resolves_it, pkg_managers::yarnrc_linker_references_read_the_environment |
exit 0 instead of yarn_pnp_unsupported |
lock-only vendor PnP gate |
in_process_vendor::berry_lock_only_pnp_project_refused_up_front ("interpolated pnp" leg) |
gate passed |
quoted key / next-line value / flow map / yarn_node_linker (fail-closed rows) |
e2e_safety_yarn_pnp::stale_pnp_loader_under_yaml_spelled_linker_applies, rc::yaml_shapes_read_like_yarn, pkg_managers::yarn_env_keys_match_any_case |
refused as PnP |
| refusal never prints an expanded variable (review) | npm_flavor::tests::unexpandable_linker_refusal_never_prints_an_expanded_variable |
printed secret${ |
compressionLevel: "${CL:-0}" (comment) |
berry_gates::an_interpolated_compression_level_is_read_as_yarn_resolves_it |
refused |
Commands run locally:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-cli --all-features --test e2e_safety_yarn_pnp: 43 passedcargo test --workspace --all-features: every suite passes except 14 tests across 5 targets (covgap_commands_vendor, e2e_bun_lockb, in_process_redirect, repair, core lib), which fail identically on origin/main in this sandbox: write-failure and permission tests that do not hold when running as root (verified by running each on main)/code-review high ran on the diff. These findings were fixed: host-env leakage in the memory view and the compression gate, env-key order, yarn_rc_filename case, a root list read as settings, an empty expansion inheriting a parent's linker, the misleading refusal text, and a dead wrapper. Not fixed:
npmRegistryServer / npmScopes with its own line-based YAML path reader; only the expansion is shared now. Moving the nested npmScopes lookup onto a YAML tree is a separate change to the restore path, so it's left as a follow-up.${…} text rather than a typed state. That keeps the Option<String> linker API every caller uses, and a literal ${ in a linker isn't a value yarn accepts either way, so both read as PnP (fail closed).🤖 Generated with Claude Code
Note
Medium Risk
Changes Plug'n'Play detection and Berry gate logic for all .yarnrc.yml reads; behavior is intentionally stricter (fail-closed) but could shift outcomes for repos using env interpolation or non-flat YAML.
Overview
Fixes #1100 by replacing the column-0 .yarnrc.yml line scan with a shared formats::yarn::rc reader that parses YAML (quoted keys, block/flow maps, last key wins) and expands ${NAME} / ${NAME-fallback} / ${NAME:-fallback} like Yarn Berry.
PnP and vendor safety: nodeLinker resolution (disk, hosted memory view, env overrides) now uses expanded values. Interpolated linkers that resolve to pnp correctly trigger yarn_pnp_unsupported instead of false package_not_installed; stale loaders under real node-modules configs are ignored. Unexpandable references fail closed as PnP; error text uses the raw rc value so secrets from env are not leaked.
Other call sites: compressionLevel gates and pnpmStoreFolder checks use the same reader (hosted scans use an empty env / YarnEnv::repository_only()). yarn_* env keys are matched case-insensitively with Yarn’s first/last-win rules. Registry URL expansion reuses expand_env with the existing “never expand a set var into a URL” rule.
Regression coverage spans e2e apply, in-process vendor, and unit tests for interpolation, YAML shapes, and refusal messaging.
Reviewed by Cursor Bugbot for commit e90a047. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
Add one reader for top-level .yarnrc.yml settings that parses the
file as YAML (quoted keys, next-line values, flow maps, last key
wins) and expands ${NAME}, ${NAME-fallback} and ${NAME:-fallback}
references exactly as yarn's replaceEnvVariables does. A file that
is not one YAML document falls back to the old column-0 line scan.
Assisted-by: Claude Code:claude-opus-5-5
A project whose .yarnrc.yml says nodeLinker: "${L:-pnp}" is a live
Plug'n'Play project to yarn, but socket-patch read the literal text,
so agent apply exited 0 "not installed" instead of refusing PnP, and
lock-only vendor passed its PnP gate. compressionLevel: "${CL:-0}"
was likewise refused as a non-default level.
nodeLinker (disk and in-memory views), compressionLevel and the yarn
pnpm-store check now read the value yarn uses. A reference yarn cannot
expand counts as PnP while a loader exists, and refusals still name
the value as written. yarn_node_linker is read in any case, as yarn
does. The registry reader shares the same expansion code.
Fixes #1100
Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups for the yarnrc reader:
- Hosted in-memory scans and the compressionLevel gate no longer
expand ${VAR} from the scanning host's environment, so the same
repository gets the same answer on every machine.
- yarn_node_linker and yarn_rc_filename are matched in any case,
in the order yarn uses.
- A linker that expands to nothing no longer inherits a parent rc's
value, and a .yarnrc.yml whose root is a list sets nothing.
- The vendor PnP refusal names an unexpandable linker instead of
claiming nodeLinker: pnp.
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
A checked-in .yarnrc.yml like nodeLinker: "${NPM_TOKEN}${" expanded
the token, kept the trailing "${", and was then refused as PnP with
the expanded value (the token) in the vendor refusal text. A linker
that still holds a literal "${" after expansion now falls back to
the text as written, so refusals only ever name unexpanded values.
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 e90a047. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Final reviewer: approved on head e90a047, Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Yarn berry PnP refusal misses a live Plug'n'Play project whose.yarnrc.yml sets nodeLinker through ${VAR} interpolation: agent apply exits 0 "not installed" and lock-only vendor passes the PnP gate (regression from #978)
There was an error while loading. Please reload this page.