fix(cli): skip verify-deps inside lifecycle scripts#538
Conversation
Empirically, with `verifyDepsBeforeRun=error` and `preinstall: aube run sayHello`, the inner `aube run` fired the verify-deps check (state isn't written yet, root preinstall runs before linking) and exited with `dependencies need install before run: install state not found`, failing the parent install. With `verifyDepsBeforeRun=install`, the inner `aube run` triggered `ensure_installed` -> `install::run`, which deadlocked on the project lock the outer install holds. `ensure_installed` now returns early when `npm_lifecycle_event` is set in the env, matching npm/pnpm's "no verify-deps inside lifecycle scripts" contract. Ports the two pnpm regression guards (lifecycleScripts.ts:179, 200) covering pnpm/pnpm#8954 and pnpm/pnpm#10060, plus the previously- landed selective rebuild test (lifecycleScripts.ts:282) asserting that `aube rebuild <pkg>` preserves `unreviewed_builds` for the un-approved sibling. Also tidies a stale "fix needed" entry in PNPM_TEST_IMPORT.md for update.ts:51, 95 (the feature landed and both tests are ported). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryFixes a deadlock/hard-fail that occurred when
Confidence Score: 5/5Safe to merge — the change is a targeted early-return behind a well-defined environment variable, and the behaviour matches the published npm/pnpm contract. The core change is small and surgical: a single No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "test(scripts): use timeout fallback for ..." | Re-trigger Greptile |
Network-gated port of pnpm/test/install/lifecycleScripts.ts:336
('git dependencies with preparation scripts should be installed
when dangerouslyAllowAllBuilds is true'). Pins pnpm's own fixture
`pnpm/test-git-fetch.git@8b333f12` (aube already exercises pnpm
fixtures in pnpm_install_misc_slow.bats), gates behind
AUBE_NETWORK_TESTS=1, and overrides the bats registry to npmjs.org
for the duration of the test so the git-dep prepare bootstrap can
fetch typescript@4.2.4 (the fixture's devDep, not in offline
Verdaccio).
Closes the last unported test in pnpm/test/install/lifecycleScripts.ts
(21/21 now covered across lifecycle_scripts.bats, rebuild.bats, and
lifecycle_scripts_slow.bats).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`timeout(1)` is GNU coreutils — Linux ships it as `timeout`, macOS only ships it as `gtimeout` after `brew install coreutils`, and not at all on a stock install. The verifyDepsBeforeRun=install deadlock guard now picks `timeout` / `gtimeout` / direct invocation in that order. The bats wall-clock cap in CI catches a deadlock regression on stock-macOS dev machines that hit neither tool. Addresses Greptile review on PR #538. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
verify-deps-before-rundeadlock/hard-fail in nestedaube runfrom inside lifecycle scripts. WithverifyDepsBeforeRun=error, the inner call hard-failed on missing install state (parent preinstall runs before state is written); withverifyDepsBeforeRun=install, it deadlocked on the project lock the outer install holds.ensure_installednow returns early whennpm_lifecycle_eventis set in the env, matching npm/pnpm's "no verify-deps inside lifecycle scripts" contract.verify-deps-before-run=installpnpm/pnpm#8954,--config.verify-deps-before-run=error), :200 (infinite loop with a postinstall task andverifyDepsBeforeRun: installpnpm/pnpm#10060,verifyDepsBeforeRun: installvia workspace yaml, with a 60s timeout guard in case the deadlock returns), :282 (selectiveaube rebuild <pkg>preservesunreviewed_buildsfor un-approved siblings, asserted via the warm-path repeat-install warning), and :336 (git-dep prepare underdangerouslyAllowAllBuilds, network-gated slow port pinned topnpm/test-git-fetch.git@8b333f12, registry overridden to npmjs.org for the typescript devDep fetch).pnpm/test/install/lifecycleScripts.tsnow ticked 21/21 intest/PNPM_TEST_IMPORT.md. Cleaned up a stale "fix needed before port" entry for update.ts:51, 95 (the feature landed and both tests are ported).Test plan
cargo clippy --all-targets -- -D warningscargo fmt --checkbats test/lifecycle_scripts.bats test/rebuild.bats(56 tests, all green)AUBE_NETWORK_TESTS=1 bats test/lifecycle_scripts_slow.bats(1 test, green)🤖 Generated with Claude Code
Note
Medium Risk
Changes
ensure_installedbehavior for anyaube run/exec/related command executed withnpm_lifecycle_eventset, which could mask real staleness if that env var is present unexpectedly. Added tests reduce regression risk, but this touches core install-validation flow.Overview
Prevents nested
aubeinvocations from re-entering dependency verification during lifecycle scripts by makingensure_installedreturn early whennpm_lifecycle_eventis present, matching npm/pnpm behavior and avoiding both lock deadlocks and missing.aube-statehard-failures.Ports the corresponding pnpm lifecycle-script tests: two new cases in
test/lifecycle_scripts.batscoveringverifyDepsBeforeRun=errorandverifyDepsBeforeRun=install(with a 60s timeout guard), a new network-gatedtest/lifecycle_scripts_slow.batsfor git deps withprepareunderdangerouslyAllowAllBuilds, and atest/rebuild.batsassertion that selectiveaube rebuild <pkg>preserves the unreviewed-builds warning for other packages. Updatestest/PNPM_TEST_IMPORT.mdto marklifecycleScripts.tsas fully ported.Reviewed by Cursor Bugbot for commit 4ae2c8e. Bugbot is set up for automated code reviews on this repo. Configure here.