test(install): port four allowBuilds review tests from pnpm lifecycleScripts.ts#441
test(install): port four allowBuilds review tests from pnpm lifecycleScripts.ts#441
Conversation
…Scripts.ts Ports four pnpm/test/install/lifecycleScripts.ts cases covering aube's allowBuilds review machinery: - L226: strictDepBuilds throws on unreviewed registry build scripts - L260: review placeholder is auto-populated in package.json#aube.allowBuilds - L268: placeholder merges with existing approvals in pnpm-workspace.yaml - L303: strictDepBuilds still fails for packages with cached side-effects (regression for pnpm/pnpm#11035) Bumps the lifecycleScripts.ts port count from 8/21 to 12/21. The PNPM_TEST_IMPORT.md row now classifies the remaining 9 cases into fixture-blocked, divergence, and equivalent-coverage buckets so future ports don't re-discover the same blockers. Two divergences worth noting in ports: aube writes the literal boolean \`false\` for review placeholders (vs pnpm's \`"set this to true or false"\` string), and aube's strict-dep-builds error reads "dependencies with build scripts must be reviewed before install" (vs pnpm's "Ignored build scripts:").
Greptile SummaryThis PR introduces Confidence Score: 5/5Safe to merge — no P0/P1 issues found; the prior conflict-ordering bug has been addressed and is pinned by a new test. All changes are well-covered by unit and bats tests (25/25 green per the PR). The No files require special attention. Important Files Changed
Reviews (5): Last reviewed commit: "fix(cli): apply --allow-build in the wor..." | Re-trigger Greptile |
Benchmark changesVersions:
Public ratios: warm installs vs Bun 4x -> 9x; warm installs vs pnpm 5x -> 11x.
d13f310 vs 400c56a | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
Two pnpm-parity wins:
1. allowBuilds review entries now write the canonical string
"set this to true or false" (matching pnpm verbatim), not the
bool `false` aube was emitting. Read-side recognizes the string
in `aube-scripts::policy` and treats it as Unspecified (skip
silently); strictDepBuilds still surfaces it via
`unreviewed_dep_builds`. New `AllowBuildsWriteMode { Approve,
ReviewPlaceholder }` enum on `add_to_allow_builds` makes the
intent explicit at every call site.
2. `aube add --allow-build=<pkg>` (repeatable) pre-approves a dep's
lifecycle scripts as part of the add. Writes
`allowBuilds: { <pkg>: true }` before the install runs. Refuses
to silently flip a pre-existing `false` (mirrors pnpm's conflict
error verbatim).
Bats coverage: ports lifecycleScripts.ts L149 (selective build),
L164 (bare flag rejected), L347 (false-conflict error). Bumps the
lifecycleScripts.ts row in PNPM_TEST_IMPORT.md from 12/21 → 15/21
and drops the now-obsolete divergence notes (placeholder format,
--allow-build CLI flag).
Also addresses greptile's quote-fragility concern on the merge-test
assertion by switching from `assert_output --partial '<single-quoted>'`
to a quote-agnostic `grep -E "<key>['\"]?: <value>"` pattern.
…-wins precedence
Three bugbot fixes on top of the placeholder/--allow-build work:
- HIGH: AllowBuildRaw::from_json was JSON-encoding string values via
Value::to_string, baking the outer quotes into the payload. Once
the canonical "set this to true or false" placeholder was written
to package.json, every subsequent install would read it back as
the JSON-quoted form ("\"set this to true or false\""), miss the
read-side equality check in aube-scripts::policy, and emit a
spurious UnsupportedValue warning on every install. Same shape on
the YAML side via WorkspaceConfig::allow_builds_raw — both paths
now extract Value::String contents directly. Two regression unit
tests pin the round-trip.
- LOW: apply_allow_build_flags merged manifest + workspace allowBuilds
using or_insert (manifest wins), inverted vs build_policy_from_sources
in install/lifecycle.rs (workspace wins). A pkg pinned to false in
pnpm-workspace.yaml could be silently overridden by a true in
package.json, defeating the conflict check the flag exists to enforce.
Switched to insert so the install pipeline and the conflict check see
the same effective value.
- MEDIUM: doc-comment fix — apply_allow_build_flags landed mid-way
through lockfile_path_for_project's doc comment in the previous
commit, splitting both into garbled fragments. Function moved
above lockfile_path_for_project with its own intact doc.
Bugbot follow-up: --allow-build can write to a workspace yaml via add_to_allow_builds, but --no-save's restore path snapshots only package.json + the lockfile. Combining the two would leak an orphaned approval into the workspace yaml. Same reasoning as the existing --save-catalog / --no-save conflict (aube/src/commands/add.rs:39 prior art); enforce it the same way via clap's `conflicts_with`. Adds a bats regression test asserting clap rejects the combo before any write.
Greptile follow-up: the conflict check in apply_allow_build_flags fired AFTER update_manifest_for_add wrote the new deps to package.json. A failing check would return early, leaving the user with new deps in the manifest and no install — an inconsistent half-mutated state requiring manual cleanup. Move the call earlier so the check runs against the pre-add state. The install pipeline re-reads both files from disk, so writing allowBuilds before the deps doesn't change the install behavior. Strengthens the L347 bats port to assert the manifest is unchanged on conflict — locks in the no-half-mutation contract.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a135cfd. Configure here.
Bugbot follow-up: the workspace-filter add path (`aube add --filter=<sel> <pkg>` via `run_filtered`) silently dropped `args.allow_build` — no conflict check ran and no approval was written, so a user passing `--allow-build` under `--filter` would believe the build was pre-approved when it was not. Wire `apply_allow_build_flags` into `run_filtered`, targeting the workspace root (`&root`) since `allowBuilds` is a workspace-level setting. Runs before any per-package manifest mutation so a conflict can't half-mutate child manifests, mirroring the contract already enforced in the non-filtered path. Adds a bats regression test exercising both legs (conflict + happy path) under `--filter`.

Summary
Four ports from
pnpm/test/install/lifecycleScripts.tsinto test/lifecycle_scripts.bats, bumping the row in PNPM_TEST_IMPORT.md from 8/21 → 12/21:aube addunderstrictDepBuilds=trueagainst an unreviewed registry build script fails. Asserts the dep + lockfile + review placeholder are still written so the user can flip and re-run.allowBuildsreview placeholder lands inpackage.json#aube.allowBuildswhen no workspace yaml is present.allowBuildsentries inpnpm-workspace.yamlwithout clobbering them.strictDepBuilds=truestill fails when side-effects are already cached in the store (regression for pnpm/pnpm#11035).Aube divergences (translated, not silently elided)
false; pnpm writes the string"set this to true or false". Same review-required semantic — aube's value is more directly readable by automation.dependencies with build scripts must be reviewed before install; pnpm readsIgnored build scripts:.--config.strict-dep-builds=trueCLI flag; the test reads it via.npmrc(appended to preserve theregistry=line that_common_setupwrites whenAUBE_TEST_REGISTRYis set).Remaining tests classified
Updates the doc row to split the 9 untouched cases into actionable buckets so future port PRs don't re-discover the same blockers:
dangerouslyAllowAllBuilds(336).--allow-build=<pkg>CLI flag (149, 164, 347),verify-deps-before-runrecursion (179, 200), selectiveaube rebuild <pkg>(282).lifecycle_scripts.bats:187covers the same contract).Test plan
mise run test:bats test/lifecycle_scripts.bats— 25/25 green (21 prior + 4 new)cargo fmt --checkNote
Medium Risk
Touches lifecycle-script gating by changing how unreviewed
allowBuildsentries are written and by adding a flag that can enable dependency scripts duringaube add, so mistakes could inadvertently run builds or persist approvals in the wrong config file.Overview
Adds
aube add --allow-build=<pkg>to pre-approve specific dependency lifecycle scripts by writingallowBuilds.<pkg>=trueto the workspace YAML (orpackage.json#aube.allowBuilds) before install, with a hard error if the package is explicitly denied and a clap-level conflict with--no-save.Changes strict-dep-builds seeding from
allowBuilds: falseto pnpm’s canonical review placeholder string ("set this to true or false"), updates parsing/serialization to preserve string values verbatim across JSON/YAML, and teaches build-policy parsing to treat the placeholder as “unreviewed” without emitting warnings.Updates
approve-builds, install paths, CLI docs/spec (aube.usage.kdl,docs/cli/add.md,commands.json), and expands Bats coverage around placeholder seeding/merging, strictDepBuilds behavior, and--allow-buildconflicts (including--filterroot writes).Reviewed by Cursor Bugbot for commit d13f310. Bugbot is set up for automated code reviews on this repo. Configure here.