feat(cli): rewrite manifest specifier on update without --latest#479
feat(cli): rewrite manifest specifier on update without --latest#479
Conversation
Greptile SummaryThis PR adds Confidence Score: 5/5Safe to merge; only finding is a P2 UX nit about a spurious --no-save message. All P1-level concerns from previous review rounds appear addressed in the current code. The one new finding (false-positive crates/aube/src/commands/update.rs — the Important Files Changed
Reviews (3): Last reviewed commit: "fix(cli): preserve dist-tag specs in cos..." | Re-trigger Greptile |
Benchmark changesPublic ratios: warm installs vs Bun 7x -> 6x; warm installs vs pnpm 11x -> 9x.
8c235ba vs 56a5651 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
`range_prefix` returns `"^"` as a default for unrecognized shapes, so the cosmetic-rewrite filter was letting dist-tag manifest entries (`"foo": "latest"`, `"next"`, `"beta"`) flow through to `rewrite_specifier`, which then turned them into `"^<resolved>"` pins. Check the literal leading char (`^` or `~`) instead — only caret/tilde specs are eligible for the floor-bump. Also surface the `--no-save` suppression message symmetrically: the print already fired under `--latest`; emit it under cosmetic-rewrite too so users who flip on `updateRewritesSpecifier` and pass `--no-save` see the same feedback. Adds a regression bats test asserting `"latest"` survives `aube update`. Addresses Greptile P1 + P2 on PR #479. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed both Greptile findings: P1 (dist-tags slip through caret/tilde filter): P2 (silent suppression under Validation: cargo build/clippy/fmt clean, Written with Claude. |
Add `updateRewritesSpecifier` setting (default true). With it on, `aube update <pkg>` (no `--latest`) rewrites caret/tilde manifest ranges to track the new in-range max — matches pnpm parity. Other shapes (`>=`, `1.x`, exact, dist-tags, git, workspace:) stay frozen. Set `update-rewrites-specifier=false` to keep aube's prior frozen-manifest behavior. Ports pnpm/test/update.ts:51, 95. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`range_prefix` returns `"^"` as a default for unrecognized shapes, so the cosmetic-rewrite filter was letting dist-tag manifest entries (`"foo": "latest"`, `"next"`, `"beta"`) flow through to `rewrite_specifier`, which then turned them into `"^<resolved>"` pins. Check the literal leading char (`^` or `~`) instead — only caret/tilde specs are eligible for the floor-bump. Also surface the `--no-save` suppression message symmetrically: the print already fired under `--latest`; emit it under cosmetic-rewrite too so users who flip on `updateRewritesSpecifier` and pass `--no-save` see the same feedback. Adds a regression bats test asserting `"latest"` survives `aube update`. Addresses Greptile P1 + P2 on PR #479. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
b9e98b6 to
8c235ba
Compare
|
Status check after rebase:
`cargo build` / `cargo clippy` / `cargo fmt --check` clean, branch up to date with main. Written with Claude. |
Summary
updateRewritesSpecifiersetting (defaulttrue) — restores pnpm parity for the most commonaube update <pkg>use case.aube update <pkg>(no--latest) rewrites caret/tilde manifest ranges (^X.Y.Z/~X.Y.Z) to track the new in-range max. Other shapes (>=,1.x, exact pins, dist-tags, git,workspace:) stay frozen.update-rewrites-specifier=falsein.npmrc(or env equivalent) to keep aube's prior frozen-manifest behavior.The semantic divergence this closes:
^1.2.0in manifest +1.2.0lockfile +1.2.5in-range max →aube update foobumps lockfile to1.2.5, leaves manifest at^1.2.0.^1.2.5to track the resolved version. Matches pnpm.Test plan
cargo build --workspacecargo test --workspace(all crates green)cargo clippy --all-targets -- -D warningscargo fmt --checkmise run test:bats test/pnpm_update.bats(25/25 passing, including 3 new tests)🤖 Generated with Claude Code
Note
Medium Risk
Changes
aube updateto potentially rewritepackage.jsonranges (in addition to the lockfile) based on a new default-on setting, which can affect repo diffs and upgrade semantics for users relying on frozen manifests.Overview
aube update <pkg>(without--latest) can now optionally rewritepackage.jsoncaret/tilde ranges to the newly resolved in-range version, aligning behavior with pnpm; non-caret/tilde specs (dist-tags, exact pins, raw ranges, git,workspace:) remain unchanged.Adds a new
updateRewritesSpecifiersetting (defaulttrue, configurable via env/.npmrc) to control this cosmetic manifest rewrite, updates settings docs accordingly, and adds Bats coverage for the rewrite path, opt-out behavior, and dist-tag preservation (including recursiveupdate -r).Reviewed by Cursor Bugbot for commit 8c235ba. Bugbot is set up for automated code reviews on this repo. Configure here.