Skip to content

test: port three test-only pnpm tests + retriage two#481

Merged
jdx merged 4 commits intomainfrom
test/port-five-test-only-pnpm-tests
May 3, 2026
Merged

test: port three test-only pnpm tests + retriage two#481
jdx merged 4 commits intomainfrom
test/port-five-test-only-pnpm-tests

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented May 2, 2026

Summary

Ports three of the five test-only pnpm tests called out in the triage brief, retriages the other two with empirical evidence:

pnpm test item landed file
misc.ts:567 (git URL with hash containing slash) 1 yes test/pnpm_install_misc_slow.bats (network-gated, new file)
hooks.ts:68 (readPackage returning undefined fails) 2 no — divergence already-skipped at pnpm_install_hooks.bats:310; triage retriaged to won't-support
hooks.ts:580 (readPackage during remove in workspace) 3 yes test/pnpm_install_hooks.bats
lifecycleScripts.ts:108 (rollback-on-build-failure) 4 yes test/lifecycle_scripts.bats + new @pnpm.e2e/aube-test-failing-install fixture
lifecycleScripts.ts:179, 200 (verify-deps + preinstall sub-aube) 5 no — real bug retriaged to support; needs aube fix before port

Items not ported (retriaged with evidence)

Item 2 (hooks.ts:68): triage said aube errors with readPackage response missing pkg. Empirically, the IPC shim at crates/aube/src/pnpmfile.rs:629 falls back to the original pkg via if (out && typeof out === 'object') result = out; and writes back { id, pkg: <original> }. The Rust side at pnpmfile.rs:809 sees pkg present and continues with the original manifest — install succeeds rather than fails. The existing skipped test at pnpm_install_hooks.bats:310 (added in a previous PR) already documents this divergence correctly. Triage doc updated to move this to Tier 3 (won't-support / divergence).

Item 5 (lifecycleScripts.ts:179, 200): triage said aube has the parent-set recursion guard, but the only "parent-set" mechanism at run.rs:536 preserves INIT_CWD, not lifecycle context. Empirically:

  • verifyDepsBeforeRun=error + preinstall: aube run sayHello → inner aube run exits with dependencies need install before run: install state not found (state isn't written until linking finishes).
  • verifyDepsBeforeRun=install → inner aube run triggers ensure_installedinstall::run, which deadlocks on the project lock the outer install holds (Waiting for another aube process to finish in this project..., observed via 60s timeout).

Per the brief: "If porting surfaces a real recursion bug, STOP — don't fight the bug." Aube fix needed: skip ensure_installed when npm_lifecycle_event is set in the env (matches npm/pnpm's "no verify-deps inside lifecycle scripts" contract). Tracked in the retriaged entry in the triage doc.

New offline fixture

test/registry/storage/@pnpm.e2e/aube-test-failing-install/ (1.0.0, install: exit 1) — minimal hand-built tarball + packument JSON, mirrors the structure of the existing @pnpm.e2e/install-script-example fixture. Used by the rollback test only.

References

Test plan

  • cargo build --workspace
  • cargo clippy --all-targets -- -D warnings (zero warnings)
  • cargo fmt --check (clean — no Rust source changes)
  • mise run test:bats test/pnpm_install_hooks.bats — 21 passing (3 documented skips), including the new readPackage-during-remove test
  • mise run test:bats test/lifecycle_scripts.bats — 34 passing, including the new rollback test
  • AUBE_NETWORK_TESTS=1 ./test/bats/bin/bats test/pnpm_install_misc_slow.bats — passes (network required)

Note

Low Risk
Test-only changes add new bats coverage (including a network-gated case) plus an offline fixture; no production Rust code paths are modified, so risk is limited to CI/test stability and reliance on external GitHub availability for the slow test.

Overview
Adds three new pnpm parity ports to the bats suite: a network-gated misc.ts:567 install-from-git regression test (new pnpm_install_misc_slow.bats), a workspace aube remove path hook regression test in pnpm_install_hooks.bats, and a lifecycle rollback/retry contract test in lifecycle_scripts.bats backed by a new always-failing offline fixture @pnpm.e2e/aube-test-failing-install.

Updates PNPM_TEST_IMPORT.md to mark the newly-ported items as done and to retriage two previously “test-only” gaps: readPackage returning undefined is now documented as an intentional aube divergence, and the verify-deps-before-run + lifecycle-subcommand case is reclassified as a real aube bug requiring a fix before porting.

Reviewed by Cursor Bugbot for commit 6072789. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 2, 2026

Greptile Summary

Ports three pnpm-parity tests — a workspace readPackage-during-remove regression, a lifecycle-rollback contract test (with a new offline fixture), and a network-gated git-URL-slash-fragment test — and retriages two others with empirical evidence (one divergence, one real aube bug).

The test implementations are well-structured and consistent with the codebase's existing patterns.

Confidence Score: 5/5

Safe to merge — changes are confined to test additions, a new offline fixture, and triage-doc updates with no production code touched.

No P0 or P1 issues found. All new tests follow established bats/assertion patterns in the repo; the new registry fixture is structurally consistent with existing ones; the triage-doc reclassifications are supported by cited empirical evidence.

No files require special attention.

Important Files Changed

Filename Overview
test/PNPM_TEST_IMPORT.md Triage doc updated: three items marked ported, one reclassified as won't-support/divergence (hooks.ts:68) with empirical evidence, and one reclassified as a real aube bug (lifecycleScripts.ts:179). All changes are well-justified with source-code citations.
test/lifecycle_scripts.bats Adds rollback-contract test: installs an always-failing dep with --dangerously-allow-all-builds, asserts .aube-state absent after failure, verifies the second install still fails, then drops the dep and asserts a clean install succeeds. Pattern is consistent with existing tests in the file.
test/pnpm_install_hooks.bats Adds workspace aube remove test: installs a workspace with a readPackage hook injecting a peerDep into is-odd, removes is-even from the sub-project, and asserts the hook-injected peerDep survives in the lockfile through the chained install. The awk-based lockfile section extraction is correct.
test/pnpm_install_misc_slow.bats New network-gated file following the same convention as pnpm_update_slow.bats. Installs a git dep with a slash-bearing branch fragment and asserts the pinned SHA appears in the lockfile. The hardcoded SHA on an external repo was already flagged in a prior review.
test/registry/storage/@pnpm.e2e/aube-test-failing-install/package.json Offline registry packument for the always-failing install fixture. Structure mirrors other fixtures in the tree; integrity hash length is correct for sha512-SRI format and the test plan confirms it passes.
test/registry/storage/@pnpm.e2e/aube-test-failing-install/aube-test-failing-install-1.0.0.tgz Binary tarball for the minimal always-failing install fixture (1.0.0, install: exit 1). Referenced by the packument alongside a matching shasum.

Reviews (3): Last reviewed commit: "docs(test): update triage doc for ported..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Benchmark changes

Public ratios: warm installs vs Bun 7x -> 5x; warm installs vs pnpm 11x -> 13x.

Benchmark aube bun pnpm
Fresh install (warm cache) 332ms -> 203ms (-39%) 2242ms -> 990ms (-56%) 3500ms -> 2571ms (-27%)
CI install (warm cache, GVS disabled) 930ms -> 560ms (-40%) 1447ms -> 1060ms (-27%) 2475ms -> 2416ms (-2%)
CI install (cold cache, GVS disabled) 4364ms -> 4426ms (+1%) 4083ms -> 4539ms (+11%) 5380ms -> 4893ms (-9%)

6072789 vs 56a5651 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

@jdx jdx force-pushed the test/port-five-test-only-pnpm-tests branch from af9e885 to 75aaf92 Compare May 2, 2026 22:04
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 75aaf92. Configure here.

Comment thread test/lifecycle_scripts.bats Outdated
jdx and others added 4 commits May 2, 2026 17:14
…s.ts:108)

Adds the @pnpm.e2e/aube-test-failing-install fixture (1.0.0, install: exit
1) under test/registry/storage/, mirroring pnpm's package-that-cannot-be-
installed shape. Asserts state-not-written-on-failure semantics — first
install fails, second install still fails, removing the broken dep
restores success — without the literal pnpm dir-removal assertion that
doesn't translate to aube's CAS architecture.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Workspace install with a readPackage hook injecting a peerDep into
is-odd, then aube remove is-even from the sub-project. The survivor's
snapshot must retain the injected peerDep — proves the chained install
triggered by remove wires the readPackage host the same way aube install
does.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Network-gated port asserting aube installs cleanly when a git URL's
fragment contains a forward slash (e.g. branch/with-slash). Uses pnpm's
own upstream fixture (github.com/pnpm-e2e/simple-pkg.git#branch/with-
slash) and pins the resolved committish in the lockfile assertion.

Confirms the parser at aube-lockfile/src/lib.rs:645 routes slash-bearing
fragments via the "" fallback branch, and the resolver at
aube-resolver/src/local_source.rs:242 walks the resulting committish
through git ls-remote.

Gated behind AUBE_NETWORK_TESTS=1 (same convention as
test/pnpm_update_slow.bats).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Mark hooks.ts:580 (readPackage during remove), misc.ts:567 (git
  fragment with slash), and lifecycleScripts.ts:108 (rollback) as
  ported.
- Retriage hooks.ts:68 (readPackage returning undefined) from test-only
  to won't-support: empirical check shows aube's IPC shim falls back to
  the original pkg, not the documented pkg-missing error path. Move to
  Tier 3 (existing skip in pnpm_install_hooks.bats already documents
  it).
- Retriage lifecycleScripts.ts:179/200 (verify-deps + preinstall sub-
  aube calls) from test-only to support (real bug). With
  verifyDepsBeforeRun=error the inner aube run from a preinstall
  script fails on install-state-not-found; with mode=install the inner
  call deadlocks on the project lock. Aube fix: skip ensure_installed
  when npm_lifecycle_event is set.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx force-pushed the test/port-five-test-only-pnpm-tests branch from 75aaf92 to 6072789 Compare May 2, 2026 22:14
@jdx
Copy link
Copy Markdown
Contributor Author

jdx commented May 2, 2026

Addressed Cursor Bugbot's high-severity finding: the rollback test was using cat >.npmrc <<EOF which clobbered the registry=<verdaccio> line _common_setup writes, so the fixture 404'd at npmjs.org instead of being found at the local Verdaccio. assert_failure was passing for the wrong reason.

Re-running the test with the fix surfaced a second issue: the .npmrc setting dangerouslyAllowAllBuilds=true doesn't exist (the only opt-in is the CLI flag --dangerously-allow-all-buildscrates/aube-settings/settings.toml has no entry, only the CLI arg in crates/aube/src/commands/install/mod.rs:372). Switched the test to use the CLI flag, matching the precedent in test/allow_builds.bats:87 and test/rebuild.bats:267.

Test now fails for the correct reason (install-script exit 1) and the rollback contract assertions hold.

Squashed into the original rollback commit via --fixup + git rebase --autosquash so history stays clean.

Written with Claude.

@jdx jdx merged commit d960e6d into main May 3, 2026
18 checks passed
@jdx jdx deleted the test/port-five-test-only-pnpm-tests branch May 3, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant