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 pnpm lock/workspace readers missing a BOM (#903, #904, #905) by mikolalysenko · Pull Request #909 · SocketDev/socket-patch Conversation
|
| Issue | Test | Without fix |
|---|---|---|
| #903 | formats::pnpm::tests::bom_lock_reads_like_its_plain_twin (9.0, 6.0, 5.4, 5.2 and shrinkwrap twins: is_pnpm_lock, sniff_lock_grammar, lock_version_major, may_need_store_flag, check_v9_lock_version, entries) |
FAILED |
| #903 | vendor::pnpm_lock::tests::bom_lock_vendors_and_reverts_byte_exact |
FAILED: Refused vendor_lockfile_version_unsupported: … has no lockfileVersion in its head |
| #903, #904 | CLI in_process_redirect_pnpm::hosted_bom_lock_and_workspace_read_like_their_plain_twins (scan creates the trust scaffold, rollback restores the BOM lock byte-exact, a BOM trustLockfile: false/true is kept and not duplicated) |
n/a (added after the fix; it covers the same readers) |
| #904 | formats::pnpm::workspace::tests::top_level_key_skips_a_leading_bom |
FAILED |
| #904 | hosted::guidance::tests::workspace_trust_plan_reads_a_bom_first_key |
FAILED |
| #904 | vendor::pnpm_lock::tests::bom_workspace_override_inserted_beside_existing_not_duplicated |
FAILED |
| #905 | formats::text::tests::*, hosted::governing_root::tests::workspace_lockfile_dir_reads_the_top_level_key (extended) |
refactor coverage |
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --all-features: the only local failures are 4 permission-denial tests that can't fail as uid 0. They fail identically on origin/main in this sandbox and pass in CI.cargo test -p socket-patch-cli --all-features --lib and the in_process_redirect_pnpm, in_process_rollback_hosted, hosted_memory_{engine,parity,rollout}, e2e_safety_pnpm, e2e_vendor_pnpm_build and e2e_npm suites: all pass locally.cargo fmt --all -- --check already fails on main with this toolchain, and CI doesn't gate on it. I formatted only the changed lines and left unrelated files alone.formats::text.🤖 Generated with Claude Code
https://claude.ai/code/session_0167b49WbzczWBJxsnUhCNEy
Note
Medium Risk
Changes lock/workspace detection and trust-config editing paths used by hosted scan and vendored revert; behavior is narrowly scoped to BOM-prefixed files but affects install-critical YAML edits.
Overview
Fixes BOM-blind pnpm lock/workspace parsing so Windows “UTF-8 with signature” files behave like pnpm does (#903, #904).
Adds shared formats::text::{split_bom, strip_bom} and routes existing BOM helpers (serde, Gradle DSL, Yarn, Cargo manifest) through it. pnpm lock sniffing (lockfileVersion, shrinkwrap detection, is_pnpm_lock_text) and workspace top-level key parsing now strip a leading BOM before matching column-0 text, while splices keep the BOM byte-exact on write/revert. workspace_lockfile_dir reads lockfileDir via the same top_level_key grammar.
Hosted/vendored behavior: BOM locks get trustLockfile: true when appropriate, rollback works, explicit BOM trustLockfile: false is not duplicated, and overrides merge beside existing sections instead of appending duplicate keys.
New unit, vendor, and CLI integration tests cover BOM lock/workspace scenarios.
Reviewed by Cursor Bugbot for commit 1607f5d. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A pnpm-lock.yaml or pnpm-workspace.yaml saved with a UTF-8 BOM (as Windows editors do with "UTF-8 with signature") is read normally by pnpm, but socket-patch's pnpm readers matched column-0 text and missed the first line: - hosted scan skipped the trustLockfile auto-config, so frozen pnpm 11/12 installs failed; rollback, remove and list then refused the lock the scan had just pinned, and vendored mode refused it as having no lockfileVersion (#903) - a BOM first key in pnpm-workspace.yaml was missed, so hosted and vendored appended a duplicate trustLockfile / overrides key that pnpm refuses to parse (#904) Add formats::text with one split_bom/strip_bom pair, replace the four named copies with it, and make the pnpm lock sniffs and the workspace key reader skip one leading BOM. Splices keep the original line, so the BOM stays byte-exact. lockfileDir is now read through the same workspace key reader (#905). 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.
main has failed socket-patch-core's lib tests since Gradle support (#646) and the digest helpers (#865) both landed. The guard test production_digests_go_through_the_helpers flags three files #646 added that still hash inline: crawlers/gradle_cache.rs, patch/jvm_jar.rs and patch/sidecars/maven.rs. That breaks test, test-release and coverage on every open PR. Each inline sha1/sha256 call now goes through sha1_hex_of or sha256_hex_of, which compute the same lowercase hex. Behaviour is unchanged. Assisted-by: Claude Code:claude-opus-5-5 (cherry picked from commit 659ac2c)
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.
|
[agent] Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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.
Assisted-by: Claude Code:claude-opus-5-5
|
[burn-down agent] Ready for review at head
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
Bring the BOM-reader fix up to date with main (33 commits, including sbt/Mill/scala-cli support and the Bun lock text reader). - formats/mod.rs: keep both new modules, `sbt` from main and `text` from this branch. - vendor/bun_lock_text.rs (new on main) called the `utils::serde::strip_bom` copy this branch deletes; point it at the shared `formats::text::strip_bom` so the merge builds. Co-Authored-By: Claude <[email protected]>
|
bugbot run 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.
|
bugbot run 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 1607f5d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Conflict in formats/pnpm/mod.rs: took main's is_shrinkwrap_lock helper (#909); the branch side was only a rustfmt reflow. Main moved yarnrc_scalar to formats::yarn::berry_gates (#657), so the PnP linker readers in pkg_managers and the in-memory view now call it there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Conflict resolutions keep both sides' behavior: - scan/vendor_flow.rs: preview_vendor_json takes both the run's patch-server origins (the hosted pnpm takeover lock-text prediction, #853) and main's caller-resolved takeover refusals (the gem preflight). preflight_refused_purls takes GlobalArgs (main) and derives the origins itself, folding in both the pnpm and the gem takeover refusals. - scan/mod.rs, get.rs: callers resolve the gem takeover refusals and pass the origins too; get's lock_text_refusals_for keeps main's HostedPin list (the gem takeover needs the pins). - hosted/engine.rs: union of both guidance imports. - vendor/mod.rs: main's manifest_pins_yarn_classic helper, now reading the pin through utils::package_manager::pinned_version as this branch did. - CLI_CONTRACT.md: word-level merge; the pnpm would_refuse preview text and main's gem preflight paragraph both kept. Main (#909) removed utils::serde::strip_bom in favor of formats::text::strip_bom; this branch's callers (pnpm version pins, pnpm workspace globs, npm upstream restore, pnpm multi-document split) now use main's helper. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
pnpm-workspace.yaml with a UTF-8 BOM: hosted and vendored miss the first top-level key and append a duplicatetrustLockfile / overrides, so every pnpm install fails with "duplicate mapping key" after a successful scan
Hosted pnpm scan skips the trustLockfile: true auto-config when pnpm-lock.yaml starts with a UTF-8 BOM, so pnpm 11/12 frozen installs fail with ERR_PNPM_TARBALL_URL_MISMATCH after a successful scan
There was an error while loading. Please reload this page.