test: port the four unblocked pnpm hooks.ts cases#455
Conversation
Ports the four pnpm/test/install/hooks.ts cases tracked as "Phase 0 unblocked" in test/PNPM_TEST_IMPORT.md: - sync readPackage hook (hooks.ts:18) — sync sibling of the existing async port, verbatim against the mirrored @pnpm.e2e/pkg-with-1-dep fixture. - workspace-root pnpmfile applies during install + sub-project add (hooks.ts:217) — root .pnpmfile.cjs fires both during a workspace `aube install` from the root and a subsequent `aube add` from a member, since both walk up to the workspace-root cwd. Asserts the hook-injected transitive lands in the shared aube-lock.yaml. - global + local readPackage ctx.log composition (hooks.ts:404) — asserts two pnpm:hook ndjson records (same prefix, distinct from) appear in global-then-local order under --reporter=ndjson. - shared workspace lockfile rewrites importer deps (hooks.ts:661) — ported as skip with a divergence note pointing to the same root cause as the existing 551 skip: aube only fires readPackage on resolved registry packages, never on importer manifests. While updating PNPM_TEST_IMPORT.md to reflect the new state, noticed hooks.ts:580 (readPackage during `aube remove` in a workspace) was unaccounted for in the original ledger and added it to the "Not yet ported" line so the 22-test total balances. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryPorts four Confidence Score: 5/5Safe to merge — test-only changes with no production logic affected. All four new tests are careful ports with well-scoped fixtures, thorough inline comments explaining any aube/pnpm divergence, and no changes to production code. The awk-based snapshot extraction in the workspace test is resilient to future YAML field insertions. The skipped divergence is clearly documented with the root cause and an explicit gate before un-skipping. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
… lockfile-resilient - The compose-log test used `mapfile -t`, which is bash 4+. macOS CI runners still ship bash 3.2, so the test failed on `bats (macos-latest, …, 1, 2)` with `mapfile: command not found`. Replace with `sed -n 'Np'` line extraction — portable to bash 3.2. - The workspace-root pnpmfile assertions used `grep -A2` to scope the match window inside each lockfile snapshot block. -A2 is too narrow if a snapshot block ever gains a `resolution:` (or similar) field before `dependencies:`, in which case the dep key would silently fall outside the window. Switch to a nested-awk extraction that walks from the snapshot key forward to the next sibling at 2-space indent, matching the actual block boundary regardless of internal field order or count. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Benchmark changesPublic ratios: warm installs vs Bun 5x -> 6x; warm installs vs pnpm 6x -> 8x.
5f09b0c vs e9ad213 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
…ll-b88826 # Conflicts: # test/PNPM_TEST_IMPORT.md
Summary
Ports the four
pnpm/test/install/hooks.tscases that PNPM_TEST_IMPORT.md marked "Phase 0 unblocked" — the Tier 1 fixtures (@pnpm.e2e/*) andadd_dist_taghelper that previously gated them have already landed, so this is just the test-port follow-up.:18sync readPackage hookpnpmfile: sync readPackage hook pins a transitive dep:217workspace-root pnpmfilepnpmfile: workspace-root pnpmfile applies during install and sub-project add:404global + local ctx.log compositionpnpmfile: global + local readPackage ctx.log emits one pnpm:hook record per pnpmfile:661shared workspace lockfilepnpmfile: readPackage with shared workspace lockfile rewrites importer deps(skipped)Notes
:18is the sync sibling of the existing async port — same fixture, same expectation, just exercises the non-asynchook code path.:217exercises pnpmfile discovery from two angles: a workspace-rootaube installand a subsequentaube addfrom a member. Both walk up to the workspace-root cwd, so the same root pnpmfile fires in both — the test asserts hook-injected transitives land in the sharedaube-lock.yamlsnapshots for bothis-positive@1.0.0andis-negative@1.0.0. Theaube addruns inside abash -c 'cd project-1 && …'subshell to keeprunsemantics intact while sidestepping shellcheck SC2103 on a barecd ...:404reuses the global-then-local compose pattern that landed earlier in this file but verifies the ndjson reporter side: twopnpm:hook readPackagerecords, sameprefix, distinctfrom, in global-then-local order.:661is ported asskipbecause it relies onreadPackagefiring on importer manifests (root or workspace project) — same root cause as the existing:551skip in this file. aube only firesreadPackageon resolved registry packages. Filed alongside the other documented divergence; the skip note points at the same Discussion gate.hooks.ts:580(readPackageduringaube removein a workspace) was unaccounted for in the previous PNPM_TEST_IMPORT.md ledger. Added it to the "Not yet ported" line so the 22-test total balances (17 ported + 3 skipped + 1 not yet ported + 1 covered elsewhere = 22).Test plan
cargo fmt --checkcleancargo buildcleantest/bats/bin/bats test/pnpm_install_hooks.bats— 20/20 pass (17 active + 3 documented divergence skips)shfmt+shellcheckclean🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are limited to test suite additions and a documentation ledger update, with no production logic modifications.
Overview
Adds four new pnpmfile parity tests in
test/pnpm_install_hooks.batscovering the syncreadPackagepath, workspace-root pnpmfile discovery during bothaube installand memberaube add, and ndjson logging for global+local pnpmfile composition.Updates
test/PNPM_TEST_IMPORT.mdto reflect the increasedhooks.tsporting coverage and to track one remaining unported workspace-remove hook case; the shared-workspace-lockfile importer-rewrite test is included but explicitlyskipped as an aube divergence.Reviewed by Cursor Bugbot for commit 5f09b0c. Bugbot is set up for automated code reviews on this repo. Configure here.