Skip to content

chore(e2e): pack with utoo pm-pack instead of pnpm#6013

Merged
killagu merged 3 commits into
nextfrom
claude/priceless-lamport-9bd29b
Jun 28, 2026
Merged

chore(e2e): pack with utoo pm-pack instead of pnpm#6013
killagu merged 3 commits into
nextfrom
claude/priceless-lamport-9bd29b

Conversation

@killagu

@killagu killagu commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Remove the last pnpm dependency from the ecosystem-ci (E2E) workflow by packing
workspace tarballs with utoo's ut pm-pack instead of pnpm -r pack.

PR #5963 switched the repo from pnpm to utoo but had to keep pnpm around in
E2E solely for pnpm -r pack, because ut pm-pack could not resolve pnpm
workspace: / catalog: protocols in the emitted manifests. utoo >= 1.1 can
now resolve them, so E2E no longer needs pnpm at all.

How it works

utoo 1.1 resolves the protocols, but from npm-native sources rather than
pnpm-workspace.yaml, and does not replicate every npm pack behavior. The new
tooling bridges the gaps during the pack step and restores the tree afterward:

  • workspace:* is resolved via the npm-style workspaces field in the root
    package.json → injected temporarily from pnpm-workspace.yaml.
  • catalog: / catalog:<name> is resolved from .utoo.toml
    ([catalog] / [catalogs.<name>]) → generated from pnpm-workspace.yaml.
  • ut pm-pack does not apply publishConfig, which egg packages use to flip
    exports from src/*.ts to dist/*.js at publish time → pack-all.mjs
    applies publishConfig onto each manifest before packing (otherwise the
    tarballs ship src exports and downstream installs fail with
    MODULE_NOT_FOUND).
  • ut pm-pack <path> writes the tgz into the package dir (no
    --pack-destination) → moved to the repo root for patch-project.ts.

Files:

  • scripts/gen-utoo-catalog.mjs — generate .utoo.toml from
    pnpm-workspace.yaml (gitignored; not committed).
  • ecosystem-ci/pack-all.mjs — drop-in replacement for pnpm -r pack.
  • .github/workflows/e2e-test.yml — install/build use the repo-default utoo
    (matching ci.yml); the pack step installs utoo@1.1.1 into an isolated
    prefix and runs pack-all.mjs via UT_BIN, since 1.1 is not yet on the
    latest tag that setup-utoo installs. Once 1.1 is promoted to latest,
    the isolated install can be dropped and ut pm-pack called directly.

Tests

  • ut run lint, ut run typecheck, ut run fmtcheck, ut run build — pass.
  • Full unit suite (vitest run) — pass (3430 passed, 0 failed).
  • pack-all.mjs against utoo 1.1.1 (post-build): 79 tarballs, 0 residual
    workspace: / catalog:, 0 tarballs exporting src/*.ts; named catalog
    (packages/router^1.9.0) and workspace:* (egg@eggjs/core exact
    version) resolve; @eggjs/utils / @eggjs/bin export dist; tree restored.

Summary by CodeRabbit

  • New Features

    • Added a new project utility to generate configuration needed for workspace package handling.
    • Updated end-to-end automation to use a newer package management flow for building and packaging.
  • Bug Fixes

    • Improved package bundling so workspace packages are packaged more reliably for end-to-end testing.

Remove the last pnpm dependency from the ecosystem-ci (E2E) workflow by
packing workspace tarballs with `ut pm-pack` (utoo >= 1.1) instead of
`pnpm -r pack`. utoo 1.1 resolves `workspace:` / `catalog:` protocols, but
from npm-native sources (the `workspaces` field and `.utoo.toml`) rather than
`pnpm-workspace.yaml`, so generate those on demand and restore the tree after.

- scripts/gen-utoo-catalog.mjs: generate .utoo.toml from pnpm-workspace.yaml
  (catalog: -> [catalog], catalogs.<name> -> [catalogs.<name>]); gitignored.
- ecosystem-ci/pack-all.mjs: drop-in for `pnpm -r pack` -- generate .utoo.toml,
  temporarily inject `workspaces`, `ut pm-pack` each publishable package, move
  the tgz to the repo root for patch-project.ts, then restore package.json.
- e2e-test.yml: install/build use the repo-default utoo (matching ci.yml); the
  pack step installs utoo@1.1.x into an isolated prefix and runs pack-all.mjs
  via UT_BIN, since 1.1 is not yet on the `latest` tag setup-utoo installs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 28, 2026 05:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 688f6aa6-e9d4-4cb0-aee9-a02473db6aaf

📥 Commits

Reviewing files that changed from the base of the PR and between 5092c0e and 4b1e463.

📒 Files selected for processing (1)
  • ecosystem-ci/pack-all.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • ecosystem-ci/pack-all.mjs

📝 Walkthrough

Walkthrough

The E2E workflow switches from pnpm-based install/build/pack steps to utoo-based commands. Two new scripts add catalog generation and workspace tarball packing for the E2E packaging flow.

Changes

utoo-based E2E packing migration

Layer / File(s) Summary
TOML catalog generator (gen-utoo-catalog.mjs)
scripts/gen-utoo-catalog.mjs
New script reads pnpm-workspace.yaml and generates .utoo.toml with [catalog] and [catalogs.*] blocks; exports generateUtooToml for reuse.
Workspace pack-all script (ecosystem-ci/pack-all.mjs)
ecosystem-ci/pack-all.mjs
New script discovers non-private workspace packages, generates .utoo.toml, temporarily injects workspaces into root package.json, runs ut pm-pack per package, moves tarballs to the repo root, and restores state in finally.
E2E workflow utoo wiring
.github/workflows/e2e-test.yml
Replaces pnpm/action-setup, pnpm install, pnpm build, and pnpm -r pack with setup-utoo, ut install --from pnpm, ut run build, and pack-all.mjs via a temp-installed utoo@1.1.x prefix.

Sequence Diagram(s)

sequenceDiagram
  participant E2EWorkflow
  participant packAll as pack-all.mjs
  participant genToml as gen-utoo-catalog.mjs
  participant ut as ut pm-pack

  E2EWorkflow->>packAll: node ecosystem-ci/pack-all.mjs
  packAll->>genToml: generateUtooToml(rootDir)
  genToml-->>packAll: .utoo.toml content
  loop each workspace package
    packAll->>ut: ut pm-pack <packageDir>
    ut-->>packAll: package tarball
    packAll->>packAll: move .tgz to repo root
  end
  packAll-->>E2EWorkflow: tarballs ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • eggjs/egg#5739: Introduces the E2E workflow packing and patching flow that this PR updates to use utoo-based packing.

Suggested labels

chore: gitAction

Suggested reviewers

  • fengmk2

Poem

🐇 I hop through builds with utoo cheer,
Catalogs align, and tarballs appear.
From workspace roots to .tgz in a blink,
This bunny packs fast — or so I think!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: replacing pnpm packing in E2E with utoo pm-pack.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/priceless-lamport-9bd29b

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Jun 28, 2026

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4b1e463
Status: ✅  Deploy successful!
Preview URL: https://72bcc92a.egg-cci.pages.dev
Branch Preview URL: https://claude-priceless-lamport-9bd.egg-cci.pages.dev

View logs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces scripts to pack workspace packages using ut pm-pack and dynamically generate .utoo.toml from pnpm-workspace.yaml. Feedback highlights two key issues: first, any pre-existing .utoo.toml file is permanently overwritten during packing and should be backed up and restored; second, the direct execution check in gen-utoo-catalog.mjs fails on Windows due to path format differences and should be updated to use import.meta.filename.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread ecosystem-ci/pack-all.mjs Outdated
Comment on lines +62 to +63
const utooTomlPath = path.join(rootDir, '.utoo.toml');
const utooTomlExisted = fs.existsSync(utooTomlPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If .utoo.toml already exists, its original content is overwritten by fs.writeFileSync(utooTomlPath, ...) on line 67, but it is never restored in the finally block. This will permanently overwrite any pre-existing .utoo.toml file a developer might have locally.

We should read and store the original content of .utoo.toml if it exists, and restore it in the finally block, just like we do for package.json.

Suggested change
const utooTomlPath = path.join(rootDir, '.utoo.toml');
const utooTomlExisted = fs.existsSync(utooTomlPath);
const utooTomlPath = path.join(rootDir, '.utoo.toml');
const originalUtooToml = fs.existsSync(utooTomlPath) ? fs.readFileSync(utooTomlPath, 'utf8') : null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5092c0e: back up the original .utoo.toml (originalUtooToml) and restore it in finally, deleting only when it did not pre-exist.

Comment thread ecosystem-ci/pack-all.mjs Outdated
Comment on lines +90 to +92
// Restore package.json; remove generated .utoo.toml unless it pre-existed.
fs.writeFileSync(pkgJsonPath, originalPkgJson);
if (!utooTomlExisted && fs.existsSync(utooTomlPath)) fs.rmSync(utooTomlPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Restore the original .utoo.toml file if it pre-existed, or delete it if it was newly created, to avoid permanently overwriting local developer configurations.

    // Restore package.json and .utoo.toml
    fs.writeFileSync(pkgJsonPath, originalPkgJson);
    if (originalUtooToml !== null) {
      fs.writeFileSync(utooTomlPath, originalUtooToml);
    } else if (fs.existsSync(utooTomlPath)) {
      fs.rmSync(utooTomlPath);
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5092c0e: the finally block now restores a pre-existing .utoo.toml and only rmSyncs it (with force) when it was newly generated.

Comment thread scripts/gen-utoo-catalog.mjs Outdated
Comment on lines +76 to +78
if (import.meta.url === `file://${process.argv[1]}`) {
main();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

On Windows, process.argv[1] contains backslashes (e.g., C:\\path\\to\\script.mjs), whereas import.meta.url is a URL with forward slashes and a file:/// prefix (e.g., file:///C:/path/to/script.mjs). This causes the equality check to fail on Windows, meaning main() will never be executed when running the script directly.

Since the project uses Node.js >= 20.11.0 (as evidenced by the use of import.meta.dirname in pack-all.mjs), you can use import.meta.filename and compare it with path.resolve(process.argv[1]) for a robust, cross-platform check.

Suggested change
if (import.meta.url === `file://${process.argv[1]}`) {
main();
}
if (process.argv[1] && import.meta.filename === path.resolve(process.argv[1])) {
main();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5092c0e: now uses process.argv[1] && import.meta.filename === path.resolve(process.argv[1]), which is correct on Windows.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4b1e463
Status: ✅  Deploy successful!
Preview URL: https://7b1f6dbd.egg-v3.pages.dev
Branch Preview URL: https://claude-priceless-lamport-9bd.egg-v3.pages.dev

View logs

Comment thread ecosystem-ci/pack-all.mjs Fixed
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.94%. Comparing base (ff17536) to head (4b1e463).
⚠️ Report is 2 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #6013   +/-   ##
=======================================
  Coverage   81.94%   81.94%           
=======================================
  Files         677      677           
  Lines       20651    20651           
  Branches     4099     4099           
=======================================
  Hits        16922    16922           
  Misses       3215     3215           
  Partials      514      514           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/e2e-test.yml:
- Around line 207-210: The isolated `utoo` install in the e2e workflow is using
a floating `1.1.x` range, which can change CI behavior unexpectedly. Update the
`npm install` step in the workflow job that creates `UT_PREFIX` and runs
`pack-all.mjs` to install `utoo` at the exact `1.1.1` version instead, and keep
future version bumps deliberate.

In `@ecosystem-ci/pack-all.mjs`:
- Around line 62-67: The .utoo.toml handling in pack-all.mjs is clobbering an
existing repository file because the script always writes the generated content
but only deletes it when the file did not exist before. Update the try/finally
flow around utooTomlPath and utooTomlExisted so the original .utoo.toml contents
are preserved and restored after the pm-pack run, rather than leaving the
generated file in place. Use the existing utooTomlPath, utooTomlExisted, and
generateUtooToml logic to either back up the original file before writeFileSync
or read/restore it in the cleanup branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7953efe-e95d-4201-8d2a-d3393dad3e8d

📥 Commits

Reviewing files that changed from the base of the PR and between b39c019 and 8c8d561.

📒 Files selected for processing (3)
  • .github/workflows/e2e-test.yml
  • ecosystem-ci/pack-all.mjs
  • scripts/gen-utoo-catalog.mjs

Comment thread .github/workflows/e2e-test.yml
Comment thread ecosystem-ci/pack-all.mjs
- pack-all.mjs: apply publishConfig (exports -> dist) onto each manifest before
  `ut pm-pack`, since utoo does not apply it. Published tarballs now ship dist
  exports instead of src, fixing downstream MODULE_NOT_FOUND in the E2E jobs.
- pack-all.mjs: back up and restore a pre-existing .utoo.toml; replace existsSync
  checks with try-based reads to avoid the file-system race CodeQL flagged.
- gen-utoo-catalog.mjs: Windows-safe direct-run check via import.meta.filename.
- e2e-test.yml: pin the isolated utoo install to 1.1.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
ecosystem-ci/pack-all.mjs (1)

38-40: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Use an allowlist for publishConfig overrides
This denylist still lets config-only keys like ignore leak into the packed package.json, and future npm-only keys will have the same problem. Since packages here already use publishConfig.exports, main, and types as manifest overrides, copying only known manifest fields is safer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ecosystem-ci/pack-all.mjs` around lines 38 - 40, The current publishConfig
filtering in pack-all.mjs uses a denylist, which can still leak npm-only
settings like ignore into the packed manifest. Update the publishConfig override
logic to use an allowlist of known manifest fields instead of
PUBLISH_CONTROL_KEYS, and only copy supported manifest overrides such as
exports, main, and types when building the published package.json.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@ecosystem-ci/pack-all.mjs`:
- Around line 38-40: The current publishConfig filtering in pack-all.mjs uses a
denylist, which can still leak npm-only settings like ignore into the packed
manifest. Update the publishConfig override logic to use an allowlist of known
manifest fields instead of PUBLISH_CONTROL_KEYS, and only copy supported
manifest overrides such as exports, main, and types when building the published
package.json.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f91ad664-ef00-490d-bf85-5a58a327a732

📥 Commits

Reviewing files that changed from the base of the PR and between 8c8d561 and 5092c0e.

📒 Files selected for processing (3)
  • .github/workflows/e2e-test.yml
  • ecosystem-ci/pack-all.mjs
  • scripts/gen-utoo-catalog.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/gen-utoo-catalog.mjs

Address review feedback: copy only known manifest fields (exports, main,
types, bin, module, ...) from publishConfig instead of denylisting
publish-control keys, so config-only keys (e.g. `ignore`) cannot leak into
the packed package.json.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 28, 2026 06:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@killagu

killagu commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the publishConfig allowlist nitpick in 4b1e463: applyPublishConfig now copies only known manifest fields (exports, main, types, bin, module, …) instead of denylisting publish-control keys, so config-only keys can't leak into the packed manifest. Verified locally: @eggjs/utils/@eggjs/bin tarballs still export dist, 0 tarballs export src.

@killagu killagu merged commit 92c47ea into next Jun 28, 2026
27 checks passed
@killagu killagu deleted the claude/priceless-lamport-9bd29b branch June 28, 2026 08:39
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.

3 participants