Skip to content

docs(test): add pnpm test import TODO#416

Merged
jdx merged 3 commits intomainfrom
claude/elated-tharp-beb760
Apr 30, 2026
Merged

docs(test): add pnpm test import TODO#416
jdx merged 3 commits intomainfrom
claude/elated-tharp-beb760

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented Apr 30, 2026

Summary

  • Adds test/PNPM_TEST_IMPORT.md tracking the phased import of pnpm's CLI-driven test suite into aube's bats coverage.
  • Three phases: (0) mirror ~25 @pnpm.e2e/* fixtures + add add_dist_tag helper, (1) port the four highest-signal install files (~88 tests), (2-3) update.ts + workspace tests.
  • Explicit skip list for pnpm-internal API tests and pnpm-specific features aube doesn't replicate.

The doc is structured so multiple agents can claim individual checkboxes (one fixture package, one test file) and work in parallel without conflicts.

Test plan

  • No code changes — docs-only.

🤖 Generated with Claude Code


Note

Low Risk
Low risk because changes only add documentation and a new Bats test, with no production code or dependency changes. Main impact is potential CI/test behavior changes if the new test is included in the test suite.

Overview
Adds test/PNPM_TEST_IMPORT.md describing a phased plan and conventions for porting pnpm’s CLI-driven tests into aube’s Bats suite (including fixture package mirroring and a future add_dist_tag helper).

Introduces test/pnpm_install_misc.bats as a worked example port: a single test that exercises aube add -E -D and asserts the resulting package.json devDependency is saved exactly (no ^/~).

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

Tracks the phased import of pnpm's CLI-driven test suite into aube's
bats coverage. Phase 0 is fixture mirroring + an add_dist_tag helper;
phase 1 ports the four highest-signal install files (~88 tests). Lets
parallel agents pick items off the list without stepping on each other.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 813f9e2. Configure here.

Comment thread test/PNPM_TEST_IMPORT.md Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

Docs-only PR adding test/PNPM_TEST_IMPORT.md, a phased checklist for importing pnpm's test suite into aube's bats coverage, plus test/pnpm_install_misc.bats as a single worked-example port of the install --save-exact test. No production code is touched. The test file's assertions are logically sound — refute_output --partial '"dependencies"' correctly excludes the literal key "dependencies" without false-matching against the "devDependencies" key that contains it as a substring.

Confidence Score: 5/5

Safe to merge — docs-only addition with no production code changes.

No P0 or P1 findings; changes are limited to a planning markdown and a single bats test file, both of which are well-structured and logically correct.

No files require special attention.

Important Files Changed

Filename Overview
test/PNPM_TEST_IMPORT.md New planning doc tracking phased pnpm test-suite import; well-structured with clear skip rationale, phase breakdown, and translation conventions.
test/pnpm_install_misc.bats Worked-example bats test for aube add -E -D; assertions correctly distinguish "dependencies" from "devDependencies" and the test structure follows documented conventions.

Reviews (2): Last reviewed commit: "docs(test): use pnpm/pnpm slug instead o..." | Re-trigger Greptile

Comment thread test/PNPM_TEST_IMPORT.md Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Benchmark changes

Versions:

  • pnpm: 11.0.1 -> 11.0.2

Public ratios: warm installs vs Bun 3x -> 4x; warm installs vs pnpm 9x -> 8x.

Benchmark aube bun pnpm
Fresh install (warm cache) 237ms -> 347ms (+46%) 728ms -> 1426ms (+96%) 2104ms -> 2756ms (+31%)
CI install (warm cache, GVS disabled) 564ms -> 1070ms (+90%) 742ms -> 1476ms (+99%) 2094ms -> 2748ms (+31%)
CI install (cold cache, GVS disabled) 2282ms -> 5055ms (+122%) 1895ms -> 4223ms (+123%) 5439ms -> 5380ms (-1%)

4d996a5 vs 135fe79 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

jdx and others added 2 commits April 30, 2026 15:53
Establishes the file naming, citation, and package-substitution
conventions for the pnpm test import (tracked in
test/PNPM_TEST_IMPORT.md). One ported test as a worked example so
parallel agents have a concrete pattern to follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bots flagged the link text `/private/tmp/pnpm` as a leaked local
filesystem path. Replace with the GitHub slug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx enabled auto-merge (squash) April 30, 2026 20:56
@jdx jdx merged commit 113eb8b into main Apr 30, 2026
18 checks passed
@jdx jdx deleted the claude/elated-tharp-beb760 branch April 30, 2026 20:59
jdx added a commit that referenced this pull request Apr 30, 2026
## Summary

Ports 5 active hook tests + 2 skipped divergences from
[`pnpm/test/install/hooks.ts`](https://github.com/pnpm/pnpm/blob/main/pnpm/test/install/hooks.ts)
into the new
[test/pnpm_install_hooks.bats](https://github.com/endevco/aube/blob/claude/pnpm-import-hooks/test/pnpm_install_hooks.bats),
following the pattern established by
[#416](#416) (tracked in
`test/PNPM_TEST_IMPORT.md`).

**Active tests (all passing):**
- async `readPackage` mutates a transitive's deps — pnpm hooks.ts:43
- async `afterAllResolved` runs and is awaited — hooks.ts:498
- syntax error in `.pnpmfile.cjs` fails the install — hooks.ts:292
- `require()` of a missing module fails the install — hooks.ts:303
- `readPackage` setting optional/peer/dev fields on a transitive —
hooks.ts:528

**Skipped — surfaced aube divergences (worth filing as Discussions
before un-skipping):**
- `readPackage` returning `undefined` should fail the install
(hooks.ts:68); aube continues with the original manifest
- `readPackage` mutating the root project's `.dependencies` should
install those deps (hooks.ts:551); aube does not run the hook on the
root manifest

The remaining 15 tests in hooks.ts depend on `@pnpm.e2e/*` fixtures
(Phase 0) or `addDistTag` helper (Phase 2) and are tracked in the TODO
doc.

## Test plan

- [x] `mise run test:bats test/pnpm_install_hooks.bats` — 5 ok, 2 skip,
0 fail.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to test suite additions and a tracking
doc update, with no production code impact. Main risk is potential test
flakiness due to lockfile/path assertions and pnpmfile error-message
matching.
> 
> **Overview**
> Ports a first batch of `pnpm/test/install/hooks.ts` coverage into
aube’s bats suite by adding `test/pnpm_install_hooks.bats`.
> 
> The new tests exercise `.pnpmfile.cjs` hook behavior (async
`readPackage` mutation of transitives, async `afterAllResolved` being
awaited) and failure paths when the pnpmfile has a syntax error or
`require()`s a missing module; two additional cases are added but marked
`skip` to document current aube divergences.
> 
> Updates `test/PNPM_TEST_IMPORT.md` to track the hooks port progress,
list completed/skipped cases, and note divergences/fixture-dependent
tests still pending.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
10406fa. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jdx added a commit that referenced this pull request Apr 30, 2026
## Summary

Ports 5 active hook tests + 2 skipped divergences from
[`pnpm/test/install/hooks.ts`](https://github.com/pnpm/pnpm/blob/main/pnpm/test/install/hooks.ts)
into the new
[test/pnpm_install_hooks.bats](https://github.com/endevco/aube/blob/claude/pnpm-import-hooks/test/pnpm_install_hooks.bats),
following the pattern established by
[#416](#416) (tracked in
`test/PNPM_TEST_IMPORT.md`).

**Active tests (all passing):**
- async `readPackage` mutates a transitive's deps — pnpm hooks.ts:43
- async `afterAllResolved` runs and is awaited — hooks.ts:498
- syntax error in `.pnpmfile.cjs` fails the install — hooks.ts:292
- `require()` of a missing module fails the install — hooks.ts:303
- `readPackage` setting optional/peer/dev fields on a transitive —
hooks.ts:528

**Skipped — surfaced aube divergences (worth filing as Discussions
before un-skipping):**
- `readPackage` returning `undefined` should fail the install
(hooks.ts:68); aube continues with the original manifest
- `readPackage` mutating the root project's `.dependencies` should
install those deps (hooks.ts:551); aube does not run the hook on the
root manifest

The remaining 15 tests in hooks.ts depend on `@pnpm.e2e/*` fixtures
(Phase 0) or `addDistTag` helper (Phase 2) and are tracked in the TODO
doc.

## Test plan

- [x] `mise run test:bats test/pnpm_install_hooks.bats` — 5 ok, 2 skip,
0 fail.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to test suite additions and a tracking
doc update, with no production code impact. Main risk is potential test
flakiness due to lockfile/path assertions and pnpmfile error-message
matching.
> 
> **Overview**
> Ports a first batch of `pnpm/test/install/hooks.ts` coverage into
aube’s bats suite by adding `test/pnpm_install_hooks.bats`.
> 
> The new tests exercise `.pnpmfile.cjs` hook behavior (async
`readPackage` mutation of transitives, async `afterAllResolved` being
awaited) and failure paths when the pnpmfile has a syntax error or
`require()`s a missing module; two additional cases are added but marked
`skip` to document current aube divergences.
> 
> Updates `test/PNPM_TEST_IMPORT.md` to track the hooks port progress,
list completed/skipped cases, and note divergences/fixture-dependent
tests still pending.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
10406fa. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jdx added a commit that referenced this pull request Apr 30, 2026
## Summary

Ports the relevant tests from
[pnpm/test/install/lifecycleScripts.ts](https://github.com/pnpm/pnpm/blob/main/pnpm/test/install/lifecycleScripts.ts)
into
[test/lifecycle_scripts.bats](https://github.com/endevco/aube/blob/claude/lifecycle-scripts-port/test/lifecycle_scripts.bats),
per the plan in
[test/PNPM_TEST_IMPORT.md](https://github.com/endevco/aube/blob/claude/elated-tharp-beb760/test/PNPM_TEST_IMPORT.md)
(#416), and closes the parity gaps surfaced by the port.

## Test ports

**3 green ports** — orthogonal stdout-visibility checks that complement
aube's existing filesystem-marker tests by proving the script's echoed
output reaches the user through aube's progress UI:
- preinstall echo (pnpm L43)
- postinstall echo (pnpm L56)
- prepare echo on argumentless install (pnpm L95)

**3 ports that previously documented parity gaps**, now green:
- `npm_config_user_agent` exported to lifecycle scripts (pnpm L29)
- root `postinstall` is NOT triggered when adding a named dep (pnpm L69)
- root `prepare` is NOT triggered when adding a named dep (pnpm L82)

**2 extra coverage tests for `aube remove` / `aube update`** — the same
pnpm contract extended to all chained-call commands (added in response
to PR review).

## Gap fixes

### 1. `npm_config_user_agent` exported

`crates/aube-scripts/src/lib.rs` — adds `aube_user_agent()` returning
`"aube/<version> <os> <arch>"` (mirrors pnpm's format) and sets it via
`apply_script_settings_env`, which covers root + dep, jailed +
non-jailed paths. Dep build scripts that sniff this env var to detect
the running PM (husky, unrs-resolver, node-pre-gyp) now recognize aube
instead of falling back to npm-mode.

### 2. Root hooks gated to argumentless `aube install` only

pnpm's contract: root lifecycle hooks fire only on the literal `pnpm
install` invocation (no package args). Every other entry point — `add`,
`remove`, `update`, `dedupe`, `dlx`, patch tooling, the
`ensure_installed` auto-install before `run`/`test`, nested git-prepare
installs — must skip them.

- `crates/aube/src/commands/install/mod.rs` — adds
`InstallOptions.skip_root_lifecycle: bool` and gates both
`run_root_lifecycle` blocks on it. The chained-call constructor
`with_mode()` defaults to `true` so every chained site (every command
except argumentless `install`) inherits the correct behavior
automatically. Argumentless `aube install` (via
`InstallArgs::into_options`) and `ci.rs` / `deploy.rs` (literal struct)
keep `false`.

## Test plan

- [x] `mise run test:bats test/lifecycle_scripts.bats` — 21 ok, no skips
- [x] `cargo test -p aube-scripts` — 29 ok
- [x] Combined run across install, add, remove, update,
lifecycle_scripts, dedupe, patch, ci suites — 141 ok, 0 failures
- [x] Pre-commit hooks (cargo-fmt, cargo-clippy, shfmt, shellcheck) —
green

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes when root lifecycle hooks run across multiple commands and
adds a new env var for all lifecycle scripts, which may affect projects
relying on prior hook behavior or script environment.
> 
> **Overview**
> Improves pnpm parity for lifecycle scripts by exporting
`npm_config_user_agent` (Node-style platform/arch) to all spawned
scripts so dependency postinstalls can correctly detect aube.
> 
> Updates the install pipeline to *skip root*
`preinstall`/`install`/`postinstall`/`prepare` hooks for chained
installs (e.g. `add`/`remove`/`update`), while keeping them enabled for
argumentless `aube install`, `ci`, `deploy`, and nested git-dep
`prepare` installs.
> 
> Ports/extends pnpm lifecycle tests in `test/lifecycle_scripts.bats`
and adds a unit test for the new user-agent formatting.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3a16e90. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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