Skip to content

chore: migrate to utoo CI#5830

Draft
elrrrrrrr wants to merge 102 commits intonextfrom
chore-ut-ci
Draft

chore: migrate to utoo CI#5830
elrrrrrrr wants to merge 102 commits intonextfrom
chore-ut-ci

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Contributor

@elrrrrrrr elrrrrrrr commented Mar 12, 2026

Summary

Migrate the main CI workflow (.github/workflows/ci.yml) from pnpm to utoo (ut). The E2E workflow (.github/workflows/e2e-test.yml) keeps pnpm for now — it requires catalog: / workspace: protocol resolution and publishConfig overrides during pack which ut pm-pack does not yet provide.

image

CI changes

  • .github/workflows/ci.yml: replace pnpm/action-setup + pnpm install + pnpm run with utooland/setup-utoo + ut install --from pnpm + ut run
  • package.json: convert pnpm-specific scripts (pnpm -r, pnpm --filter, pnpm exec) to ut equivalents (ut run --workspaces, ut run --workspace <name>)
  • tools/scripts/package.json: same conversion for cov / ci scripts
  • .gitignore: add .utoo.toml (ut local cache) and .claude/ (Claude Code session state)
  • .oxfmtrc.json: ignore root package.json because ut install --from pnpm rewrites it (adds an npm-style workspaces field) and the new field position trips oxfmt's expected ordering — this is a no-op for the source package.json since it's never directly hand-formatted

Source code adaptations

These are the only source/test changes required to make the migrated CI work. Each is justified below.

File What Why ut requires it
packages/utils/src/import.ts Replace the ESM/CJS branching in importResolve with a single getRequire().resolve(filepath, { paths }) call (-34 net lines) The original ESM branch called import.meta.resolve(filepath) without a parent URL, which silently ignored the caller's paths and resolved from @eggjs/utils's own context. That worked under pnpm's nested node_modules (each consumer had its own copies) but breaks under ut's flat hoisting. require.resolve correctly honors paths, walks up node_modules, reads exports, and auto-appends extensions for legacy CJS subpaths (e.g. tsconfig-paths/register). It fixes a latent bug at the same time.
packages/cluster/test/options.test.ts Add the flat-hoisted node_modules/egg path to the accepted framework paths (+2 lines) Under pnpm, egg is found at packages/cluster/node_modules/egg. Under ut flat hoisting, it's at the workspace root node_modules/egg. The test now accepts both.
packages/tsconfig/test/index.test.ts Use require.resolve('typescript/bin/tsc') instead of hardcoded path.join(__dirname, '..', 'node_modules', ...) The hardcoded path assumes typescript is nested under packages/tsconfig/node_modules/. Under flat hoisting it lives at the root. require.resolve works under both layouts and is strictly a portability improvement.
tegg/plugin/controller/src/lib/impl/mcp/MCPControllerRegister.ts Remove // @ts-expect-error content-type is not typed (1 line) Under ut's flat hoisting, @types/content-type is discoverable from this file's location, so the underlying type error no longer exists and @ts-expect-error itself becomes an unused-directive lint failure.
tegg/plugin/mcp-proxy/src/index.ts Remove two // @ts-expect-error directives for content-type and koa-compose (2 lines) Same as above.
tsdown.config.ts Add publint: { pack: 'npm' } (1 line) publint auto-detects the package manager and runs <pm> pack to validate. The ut CI environment has no pnpm binary in PATH, so without this flag publint runs pnpm pack and fails. Pinning to npm makes it portable.

Why E2E stays on pnpm

The E2E job packs every workspace package into a tgz so downstream projects (cnpmcore, examples) can install them as overrides. This requires three things during pack that ut pm-pack does not currently do:

  1. Apply publishConfig overrides (so exports points at dist/ instead of src/.ts)

Without those, the resulting tgz contains literal catalog: / workspace:* strings in dependencies and source-tree paths in exports, which break downstream npm install. pnpm -r pack handles all three natively. We will revisit once ut adds them.

Test plan

  • typecheck
  • Test scripts (ubuntu 22 + 24) ✅
  • Test bin (ubuntu + windows) ✅
  • Test matrix (ubuntu × 22/24, macos × 22/24, windows × 22/24) ✅
  • E2E Test (examples + cnpmcore) ✅

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08f3e808-b861-4af6-ae5f-97f0f5d99a01

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore-ut-ci

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 and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the project's dependency and workspace management. It transitions from using pnpm-workspace.yaml to a combination of a new .utoo.toml file for dependency catalogs and direct configuration within package.json for workspaces and overrides. This change streamlines how dependencies are declared and managed across the monorepo, likely in preparation for or as part of a new CI setup.

Highlights

  • Configuration Migration: Migrated dependency catalog and workspace definitions from pnpm-workspace.yaml to .utoo.toml and package.json respectively.
  • New Configuration File: Introduced a new .utoo.toml file to centralize dependency version management.
  • Package.json Updates: Updated package.json to include workspace paths and define package overrides, specifically for vite.
  • Removed PNPM Workspace File: Removed the pnpm-workspace.yaml file as its configurations were moved to other files.
Changelog
  • .utoo.toml
    • Added a new file to define a comprehensive catalog of project dependencies and their versions.
  • package.json
    • Added a workspaces array to explicitly define the project's monorepo structure.
    • Introduced an overrides section to specify a custom version for the vite package.
    • Removed the packageManager field, indicating a shift in how the package manager is specified or managed.
  • pnpm-workspace.yaml
    • Removed the file, as its contents for workspace definition and dependency catalog have been migrated to package.json and .utoo.toml.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/ci.yml
    • .github/workflows/e2e-test.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 12, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Copy link
Copy Markdown
Contributor

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

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 refactors the project's dependency and workspace management by migrating configuration from pnpm-workspace.yaml to a new .utoo.toml file and package.json. My review focuses on the maintainability of the new configuration and the potential impact on the developer workflow. I've suggested sorting the new dependency catalog for better readability and pointed out a potential issue with the removal of the packageManager enforcement that could be addressed with documentation.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 12, 2026

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d1b472
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 12, 2026

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d1b472
Status:🚫  Build failed.

View logs

@elrrrrrrr elrrrrrrr changed the title chore(ci): utoo ci chore: migrate to utoo CI and fix circular dependencies Mar 16, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.49%. Comparing base (25d86b1) to head (0d1b472).
⚠️ Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5830      +/-   ##
==========================================
- Coverage   85.88%   85.49%   -0.40%     
==========================================
  Files         666      660       -6     
  Lines       18841    18828      -13     
  Branches     3636     3646      +10     
==========================================
- Hits        16182    16097      -85     
- Misses       2296     2360      +64     
- Partials      363      371       +8     

☔ View full report in Codecov by Sentry.
📢 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.

elrrrrrrr and others added 10 commits March 30, 2026 17:13
- Replace pnpm/action-setup with setup-utoo in all CI jobs
- Use ut install --from pnpm for dependency installation
- Replace pnpm run/filter commands with ut run equivalents
- Use --workspaces --if-present for topological workspace execution
- Use --workspace <pkg> for targeted package execution
- Use -- passthrough for tsdown args (ut run build -- --workspace)
- Remove pnpm dedupe --check step (no longer needed)
- Fix tools/scripts ci script to use ut run cov
ut does not install optional peer deps automatically, so
unplugin-unused (required by tsdown's unused.level feature) must
be declared explicitly. Also includes workspaces/overrides fields
auto-resolved from pnpm config by ut install.
publint auto-detects pnpm via pnpm-lock.yaml and calls pnpm pack,
but pnpm is not on PATH when using setup-utoo. Set pack: 'npm'
explicitly so pnpm binary is not required for publint checks.
- Replace pnpm/action-setup with setup-utoo
- Use ut install --from pnpm for dependency installation
- Use ut run build for building all packages
- Replace pnpm -r pack with npm pack --workspaces
- Sync pnpm-lock.yaml to include unplugin-unused
npm pack --workspaces fails on packages without version (e.g. site).
Also, pnpm -r pack places tarballs in workspace root, while npm pack
places them in each package's own directory.

pack-all.mjs replicates pnpm -r pack behavior:
- reads workspace patterns from pnpm-workspace.yaml
- skips private/unnamed/unversioned packages
- packs each with --pack-destination to workspace root
oxfmt reordered imports and placed execSync import inside the JSDoc
comment block, making it unavailable at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
npm does not understand catalog: protocol; ut install handles it correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pack

npm pack does not resolve pnpm catalog: or workspace: protocol entries,
leaving them raw in the tgz package.json. Downstream npm install then
fails with EUNSUPPORTEDPROTOCOL. Pre-resolve these to actual semver
versions before packing, then restore the originals.

Also revert downstream test commands back to npm install/run since
cnpmcore/examples use plain semver and npm can install the cleaned tgzs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
npm pack does not apply publishConfig.exports automatically. Packages
use devExports (src/) in exports and dist/ in publishConfig.exports.
Without merging publishConfig first, the tgz contains src/ exports and
downstream npm install fails to find the source files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use import.meta.resolve(specifier, parentUrl) with each caller-provided
path to avoid relying on package manager hoisting behavior. Falls back
to resolving from the current module context only after all provided
paths have been exhausted.

Also remove stale @ts-expect-error comments in tegg mcp-proxy and
controller plugins where content-type and koa-compose now ship types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…in pack-all.mjs

Named catalogs (pnpm catalogs.<name>) were being looked up in the
default catalog instead of the named catalog section. This caused
@eggjs/router to be packed with path-to-regexp ^6.3.0 instead of
^1.9.0, breaking the Layer.js constructor which uses the old default
export API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
elrrrrrrr and others added 6 commits April 9, 2026 00:13
The Test bin job's "Run tests" step ran `ut run build` (no
`--workspace`), which built the entire monorepo (all packages, plugins,
tegg, tools — 30+ packages) before invoking egg-bin's tests. The
equivalent step on next runs `pnpm build --workspace ./tools/egg-bin`,
building only the package under test.

The full-monorepo build was the cause of:
  - Test bin (ubuntu-latest, 24): 134s -> 234s (+100s, +75%)
  - Test bin (windows-latest, 24): 189s -> 345s (+156s, +82%)

`ut run ci --workspace @eggjs/bin` already correctly limits the test
phase; the build phase was the only thing leaking outside the
@eggjs/bin scope.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…evDep

- Test bin: `ut run build -- --workspace @eggjs/bin` passes
  --workspace through to tsdown so only @eggjs/bin is built,
  matching next's `pnpm build --workspace ./tools/egg-bin`.
- Test scripts: same treatment with `--workspace tools/scripts`.
- Add `utoo: ^1` to catalog + root devDependencies + allow its
  postinstall via onlyBuiltDependencies so local `ut` works.
- Add workspaces and overrides fields to root package.json.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tsdown uses `-F, --filter <pattern>` to scope builds to specific
packages, not `--workspace` (which just enables workspace mode
without filtering). The previous commit passed `--workspace @eggjs/bin`
through to tsdown which errored with "No workspace packages found".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
utoo now supports glob patterns in `--workspace`. Replace the serial
`&& --workspace` chain with a single `--workspace 'helloworld-*'`
so all matching example packages are tested in parallel via utoo's
topological scheduler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The latest utoo release (with workspace glob support) now errors
on packages that don't define the requested script, instead of
silently skipping them. Add `--if-present` to `clean-dist` and
`typecheck` scripts to restore the skip-missing behavior. `pretest`
and `preci` already had it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm on next passes `--workspace ./tools/egg-bin` through to tsdown
(pnpm doesn't recognize `--workspace` as its own flag). tsdown's
`--workspace [dir]` expects a directory path, not a package name.

Previous attempts:
  --workspace @eggjs/bin  → "No workspace packages found" (pkg name)
  --filter @eggjs/bin     → works but slower than expected

Correct form matching next: `-- --workspace ./tools/egg-bin`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/eggjs/egg/issues/comments/4047416827","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: skip review by coderabbit.ai -->\n\n> [!IMPORTANT]\n> ## Review skipped\n> \n> Draft detected.\n> \n> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository. To trigger a single review, invoke the `@coderabbitai review` command.\n> \n> <details>\n> <summary>⚙️ Run configuration</summary>\n> \n> **Configuration used**: defaults\n> \n> **Review profile**: CHILL\n> \n> **Plan**: Pro\n> \n> **Run ID**: `9004d336-f76f-4e60-a323-eebffb3a4d8e`\n> \n> </details>\n> \n> You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file.\n> \n> Use the checkbox below for a quick retry:\n> - [ ] <!-- {\"checkboxId\": \"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe\"} --> 🔍 Trigger review\n\n<!-- end of auto-generated comment: skip review by coderabbit.ai -->\n\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n- [ ] <!-- {\"checkboxId\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Commit unit tests in branch `chore-ut-ci`\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=eggjs/egg&utm_content=5830)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->"},"request":{"retryCount":3,"signal":{},"retries":3,"retryAfter":16}}}

Use `--workspace 'helloworld-*' --if-present` so helloworld-commonjs
(which has no `test` script) is skipped cleanly while helloworld-
typescript and helloworld-tegg run in parallel via utoo's topological
scheduler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
elrrrrrrr and others added 21 commits April 10, 2026 22:04
Add `"build": "tsdown"` to tools/egg-bin/package.json so the CI can
run `ut run build --workspace @eggjs/bin` directly — utoo finds the
script in egg-bin's own package.json and runs tsdown locally, without
going through root tsdown workspace discovery.

This isolates whether the CI build slowdown (178s vs 3s on next) was
caused by the `--` passthrough mechanism or by tsdown workspace
scanning overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
egg-bin's `ci` script chain is `ci → npm run cov → pretest(tsdown)
→ vitest run --coverage`. The `pretest` lifecycle hook already runs
tsdown before tests, so the explicit `ut run build --workspace
@eggjs/bin` was a redundant second tsdown invocation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bare `tsdown` in pretest walks up the directory tree, finds the root
tsdown.config.ts (which has workspace mode enabled), and builds all
30+ packages (~178s on CI). Adding `-c tsdown.config.ts` pins it to
egg-bin's own config so it only builds egg-bin (~2s).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous commit pinned pretest to `tsdown -c tsdown.config.ts` to
avoid walking up to the root workspace config (which builds all 30+
packages). But the local config was missing shared defaults from root:
`entry`, `external`, and `exports.devExports`. Without these, the
build output was incomplete and tests failed.

Add the missing settings so egg-bin can build standalone without
depending on the root workspace config inheritance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of duplicating root tsdown settings in egg-bin's local config
and using `-c tsdown.config.ts` in pretest, use the simpler approach:

1. CI explicit build: `ut run build -- --workspace ./tools/egg-bin`
   passes `--workspace` through to root tsdown which correctly scopes
   the workspace build to egg-bin only (~2s).
2. Remove `pretest` from egg-bin to avoid a second tsdown invocation
   that walks up to root workspace config and rebuilds all 30+ packages
   (~178s).
3. Revert the duplicated shared settings in egg-bin's tsdown.config.ts.

Net result: one tsdown invocation (~2s) instead of two (2s + 178s).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…uild

The `--` passthrough (`ut run build -- --workspace ./tools/egg-bin`)
does not effectively scope the build on CI — root tsdown still builds
all 30+ packages (~180s). Using utoo's own `--workspace` flag runs
egg-bin's local `build: tsdown` script which only finds the local
tsdown.config.ts and completes in ~2s.

Combined with the pretest removal in the previous commit, Test bin
should now be: build ~2s + vitest ~10s = ~15s total.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bare `tsdown` in egg-bin's build script walks up to root
tsdown.config.ts (workspace mode) and builds all 30+ packages (~180s).
Pin it with `-c tsdown.config.ts` and add the shared settings from
root config (entry, external, devExports) so it can build standalone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adding `workspaces` to root package.json (for utoo) activated
vitest's automatic workspace detection. When egg-bin's `cov` script
ran bare `vitest run --coverage`, vitest walked up, found the root
workspaces config, discovered 28 vitest.config.ts files across the
monorepo, and ran ALL packages' tests — not just egg-bin's.

Pin with `-c vitest.config.ts` so vitest only runs egg-bin's 10 test
files (~10s) instead of the full monorepo (~200s).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Temporarily switch Test bin from `ut run ci --workspace @eggjs/bin`
to `cd tools/egg-bin && npm run ci` to determine if utoo's process
environment (env vars, stdout handling) is causing the 160x vitest
transform slowdown on CI (4860ms vs 30ms locally).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Temporarily switch Test bin job from `ut install --from pnpm` to
`pnpm install --no-frozen-lockfile` to determine if the node_modules
layout difference (utoo flat hoist vs pnpm symlinks) is causing the
~90s CI slowdown in vitest test execution.

Both `ut run` and `npm run` produce the same ~200s. If pnpm install
brings it back to ~107s (matching next branch), the root cause is
confirmed to be the node_modules layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert the pnpm install diagnostic. Results showed pnpm install on CI
produced the same ~220s Run tests as utoo install (~194s), confirming
the slowdown is NOT caused by node_modules layout differences.
Awaiting next branch rerun to determine if it's CI runner variance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `-c vitest.config.ts` flag prevented vitest from inheriting the
root config's critical performance settings:
  - pool: 'threads' (vs default forks)
  - isolate: false (skip per-test isolation)
  - experimental.fsModuleCache: true (filesystem module cache)
  - env.NODE_OPTIONS: '--import=tsx/esm'

Without these, vitest transform went from 24ms to 4860ms (200x) and
total Run tests from ~107s to ~200s on CI.

Removing `-c` lets vitest auto-merge root + local configs, restoring
the performance characteristics that match the next branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diagnostic: delete `workspaces` and `overrides` from root package.json
after `ut install` but before running egg-bin tests. This prevents
npm from entering workspace mode when `npm run cov` executes inside
egg-bin.

Use `cd tools/egg-bin && npx tsdown && npm run ci` since utoo's
`--workspace` flag won't work without the workspaces field.

If Run tests drops from ~190s to ~107s, confirms that the root
`workspaces` field in package.json is the cause of the CI slowdown.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Temporarily revert packages/utils/src/import.ts to the exact next
branch version (without Fallback 1) to determine if the import.ts
changes are causing the ~90s CI slowdown in Test bin.

Also clean up the diagnostic steps from the previous commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rt.ts

Use `ut run build -- --workspace ./tools/egg-bin` which passes
through to root tsdown (same as next's `pnpm build --workspace
./tools/egg-bin`). This uses root+local dual config instead of
`tsdown -c tsdown.config.ts` (local only).

Testing whether the dual config produces different dist/ output
that makes vitest tests ~90s faster.

Also restores import.ts with Fallback 1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… package.json

Isolate the test-bin ~90s CI slowdown by reverting test-bin job to use
pnpm (identical to next branch) and removing the workspaces/overrides
fields from root package.json. This helps determine whether the slowdown
is caused by code changes or the utoo environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…his branch)

pnpm-lock.yaml was removed on chore-ut-ci since utoo manages deps.
The diagnostic pnpm test-bin job needs --no-frozen-lockfile and no cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diagnostic-only commit to isolate whether import.ts changes cause
the test-bin CI slowdown. Will be reverted after results are collected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diagnostic-only commit to isolate whether Fallback 1 alone causes the
test-bin slowdown. All other import.ts changes from chore-ut-ci stay
reverted (from f3ced6a).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add stderr logging to capture exactly which resolutions trigger
Fallback 1 in CI and how long each takes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The require.resolve Fallback 1 added in 7c2e381/01a4caab was found to
cause a ~90s slowdown in the Test bin CI job (107s → ~200s).

Root cause: Fallback 1 walks up the directory tree via require.resolve,
causing @eggjs/mock/setup_vitest and @eggjs/tegg-vitest/runner to be
resolvable from test fixture directories (they are hoisted to the
workspace root node_modules). On the next branch these resolutions fail
with ImportResolveError and egg-bin's test command skips loading mock
setup and tegg runner. With Fallback 1 they succeed, making every
forked egg-bin test process load the heavy mock framework + tegg runner
(+3-4s per test × ~46 tests ≈ 150s total).

Diagnostic bisect data:
- utils fully reverted to next: 107s ✅
- utils + Fallback 1 only: 208s ❌

Keep setSnapshotModuleLoader and the getRequire() extensions check —
they are additive features that don't affect runtime behavior.

Co-Authored-By: Claude Opus 4.6 (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.

2 participants