fix(lockfile): preserve package and bun lock compatibility#339
Conversation
Greptile SummaryThis PR addresses three independent compatibility gaps: it centralizes the order-preserving manifest writer so The refactoring in Confidence Score: 5/5Safe to merge — no logic errors or security concerns found; changes are narrow, well-scoped, and backed by new unit and bats tests. All three independent fixes are self-contained and covered by targeted regression tests. The refactoring consolidates existing logic without behavioral changes to the No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix(lockfile): preserve manifest and bun..." | Re-trigger Greptile |
a0b5851 to
a0d7f1e
Compare
a0d7f1e to
edcf663
Compare
edcf663 to
edcf920
Compare
Summary
package.jsonkey order when commands rewrite dependency sections.file:prefix.Details
aube addalready preserved manifest order by editing the parsed rawpackage.jsonobject and syncing only dependency sections. This PR moves that targeted raw-JSON dependency-section writer into the shared command helpers soadd,remove, andupdate --latestuse the same order-preserving path.removestill prunes pnpm/aube sidecar metadata, but now applies those removals directly to the parsed raw JSON object instead of replacing unrelated fields from the typedPackageJson.extramap. That keeps existing key positions and avoids churn in unrelated or nested manifest data.The Bun regression matrix also exposed two plain-install failures not covered by the currently open lockfile PRs:
local-helper@tarballs/local-helper-1.0.0.tgzwhile the workspace dependency remainsfile:tarballs/local-helper-1.0.0.tgz. Aube now recognizes that prefixless.tgzident asLocalSource::Tarballinstead of treating it as a registry version.I checked the other open lockfile PRs before adding these: #337 covers pnpm scalar platform fields, and #338 covers package-lock git resolved URLs plus pnpm/Bun scalar platform metadata. Those fixes are intentionally not duplicated here.
Validation
cargo fmt --checkcargo buildcargo test -p aube write_manifest_dep_sectionscargo test -p aube-lockfile test_parse_prefixless_local_tarballcargo test -p aube-lockfile test_parse_github_depcargo test -p aube-store git_commit_matches_abbreviated_shamise run test:bats test/remove.batsmise run test:bats test/update.batsjohnpyp/2026-04-23-aube-bun-lock-regression-matrixagainsttarget/debug/aube;github-shorthandandlocal-tarballnow pass plain install asplain-aube-unchangedNote
Medium Risk
Medium risk because it changes how
package.jsonis rewritten across multiple commands and relaxes git checkout verification to accept abbreviated SHAs, which could affect correctness of dependency updates and git-sourced installs.Overview
Improves compatibility and reduces churn when working with Bun and when editing
package.json.Commands that mutate dependencies (
add,remove,update --latest) now update only the dependency sections in the existing parsedpackage.jsonobject (via shared helpers) so top-level key order is preserved and empty dep sections are removed without reserializing unrelated fields;removealso prunes pnpm/aube sidecar metadata directly in raw JSON to avoid reordering.Bun lockfile parsing now treats prefixless local tarball idents (e.g.
pkg@tarballs/foo.tgzwithoutfile:) asLocalSource::Tarball, and git dependency checkouts now accept abbreviated hex SHAs by verifying the full HEAD starts with the requested short SHA. Added targeted unit tests and a bats test to lock in these behaviors.Reviewed by Cursor Bugbot for commit edcf920. Bugbot is set up for automated code reviews on this repo. Configure here.