Skip to content

fix(core): include plugin dynamic files in manifest#5922

Merged
killagu merged 10 commits intonextfrom
agent/egg-dev/7e0d31d1
May 4, 2026
Merged

fix(core): include plugin dynamic files in manifest#5922
killagu merged 10 commits intonextfrom
agent/egg-dev/7e0d31d1

Conversation

@killagu
Copy link
Copy Markdown
Contributor

@killagu killagu commented May 3, 2026

Summary

  • Stack on top of PR fix(bundler): map runtime paths for bundled workers #5921 / EGG-65 runtime mapping commit because that dependency is not yet in origin/next.
  • Complete generated startup manifests with convention-based plugin dynamic files (agent, app, app/extend/*, and app/middleware) so bundled single-mode workers can load files skipped by metadataOnly agent startup.
  • Add a security-like @eggjs/security fixture verifying agent, app, app/extend/agent, app/extend/application, and app/middleware/securities are present in the manifest.

Validation

  • pnpm exec vitest run packages/core/test/loader/manifest_coverage.test.ts
  • pnpm exec vitest run packages/core/test/loader/manifest.test.ts packages/core/test/loader/manifest_roundtrip.test.ts packages/core/test/loader/manifest_fingerprint.test.ts packages/core/test/loader/manifest_query.test.ts packages/core/test/loader/manifest_coverage.test.ts
  • pnpm --filter @eggjs/egg-bundler test -- EntryGenerator.test.ts
  • pnpm --filter @eggjs/core typecheck
  • pnpm --filter @eggjs/egg-bundler typecheck
  • pnpm exec oxfmt --check packages/core/src/loader/egg_loader.ts packages/core/test/loader/manifest_coverage.test.ts tools/egg-bundler/src/lib/EntryGenerator.ts tools/egg-bundler/test/EntryGenerator.test.ts
  • git diff --check origin/next...HEAD

Notes: targeted oxlint on changed files exits 0 with existing warnings in pre-existing egg_loader.ts lines outside this patch.

Summary by CodeRabbit

  • New Features

    • Manifest post-processing now caches convention-based module resolution and records directory-discovered middleware lists for metadata-only runs.
    • Bundler/runtime treats framework as a package specifier, validates specifiers, and precomputes output↔original-app aliasing for deterministic module lookup.
  • Documentation

    • Updated bundler docs, CLI help, and wiki to explain runtime path mapping, output-dir semantics, and framework-specifier behavior.
  • Tests & Chores

    • Added fixtures and tests for manifest resolve-cache, file discovery, deterministic worker generation, and framework-specifier validation.

Copilot AI review requested due to automatic review settings May 3, 2026 10:31
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Post-processes StartupManifest during manifest generation to precompute conventional module resolve aliases and directory-based middleware file-discovery metadata; updates egg-bundler worker entry generation to emit precomputed absolute/resolve-cache alias arrays and call startEgg with the bundle output as runtime baseDir and an explicit framework specifier.

Changes

Manifest Generation & Bundler Runtime Path Mapping

Layer / File(s) Summary
Core Manifest Post-Processing
packages/core/src/loader/egg_loader.ts
Capture StartupManifest from generateManifest(), call #collectConventionalDynamicFiles(manifest), add CONVENTIONAL_EXTEND_NAMES, import globby, and add helpers to populate manifest.resolveCache (conventional module aliases) and manifest.fileDiscovery (middleware dir file lists).
Test Fixtures & Coverage
packages/core/test/fixtures/manifest-dynamic-plugin/package.json, packages/core/test/fixtures/manifest-dynamic-plugin/config/plugin.js, packages/core/test/loader/manifest_coverage.test.ts
Add fixture package and plugin config; new metadataOnly tests assert manifest.resolveCache contains convention entries for @eggjs/security and manifest.fileDiscovery includes discovered middleware files.
Bundler Entry Generation Helpers
tools/egg-bundler/src/lib/EntryGenerator.ts
Validate framework specifier, add alias-collection/normalization helpers, compute/de-duplicate alias arrays (__APP_ABSOLUTE_ALIASES, __APP_RESOLVE_CACHE_ALIASES), derive __outputDir at runtime, import framework module by specifier, update bundle-map helpers, and call startEgg({ baseDir: __outputDir, framework: __framework, mode: 'single' }).
Bundler Framework Validation
tools/egg-bundler/src/lib/frameworkSpecifier.ts, tools/egg-bundler/src/lib/Bundler.ts
Add assertFrameworkPackageSpecifier(framework) to reject path-like/URL-like framework values; invoked from Bundler.run() and EntryGenerator.
Bundler CLI & Wiring
tools/egg-bin/src/commands/bundle.ts, tools/egg-bin/test/commands/bundle.test.ts, tools/egg-bin/README.md
Redefine --framework as a package specifier; add getBundleFrameworkSpecifier() to read pkg.egg.framework when omitted; tests updated to expect specifier passthrough (no absolute-path resolution).
Bundler Tests — Worker Runtime & Determinism
tools/egg-bundler/test/EntryGenerator.test.ts, tools/egg-bundler/test/deterministic.test.ts
Stabilize tests with path/regex normalization; update assertions for new startEgg call shape and framework-module wiring; add tests for absolute-alias preservation (including symlink cases) and an integration-style test executing the generated worker; determinism tests normalize embedded original-app absolute aliases.
Docs & Logs
tools/egg-bundler/docs/output-structure.md, wiki/packages/egg-bundler.md, wiki/log.md, tools/egg-bundler/README.md, tools/egg-bundler/src/index.ts
Document runtime behavior: worker uses deploy output dir as runtime baseDir, forwards explicit framework specifier mapped to bundled framework module, and emits precomputed absolute & resolve-cache alias mappings; update CLI docs to state framework must be a package specifier.

Sequence Diagram(s)

sequenceDiagram
  participant Bundler as Bundler (build-time)
  participant Worker as Generated Worker (runtime)
  participant ManifestStore as ManifestStore
  participant Framework as Bundled Framework Module
  participant StartEgg as startEgg

  Bundler->>Worker: emit worker with __APP_ABSOLUTE_ALIASES & __APP_RESOLVE_CACHE_ALIASES
  Worker->>ManifestStore: ManifestStore.fromBundle(__outputDir, bundleMap, aliases)
  Worker->>Framework: import * as __frameworkModule from <framework-specifier>
  Worker->>StartEgg: startEgg({ baseDir: __outputDir, framework: __framework, mode: 'single' })
  StartEgg->>Framework: use __frameworkModule for framework wiring
  StartEgg->>ManifestStore: consult precomputed resolveCache/fileDiscovery for module resolution
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • fengmk2
  • jerryliang64
  • gxkl

"I’m a rabbit with a manifest map,
I hop through aliases, tidy each gap,
outputDir set and middleware found,
resolveCache cached, no runtime round,
bundle-bound paths snug and sound."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% 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 pull request title 'fix(core): include plugin dynamic files in manifest' directly and specifically describes the main change: updating the manifest generation to include convention-based plugin dynamic files for bundled workers.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/egg-dev/7e0d31d1

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.

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

cloudflare-workers-and-pages Bot commented May 3, 2026

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a893cb
Status: ✅  Deploy successful!
Preview URL: https://2a48a1d9.egg-cci.pages.dev
Branch Preview URL: https://agent-egg-dev-7e0d31d1.egg-cci.pages.dev

View logs

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

cloudflare-workers-and-pages Bot commented May 3, 2026

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a893cb
Status: ✅  Deploy successful!
Preview URL: https://fc9e5f61.egg-v3.pages.dev
Branch Preview URL: https://agent-egg-dev-7e0d31d1.egg-v3.pages.dev

View logs

@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.08%. Comparing base (22fc588) to head (6a893cb).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5922      +/-   ##
==========================================
+ Coverage   85.04%   85.08%   +0.03%     
==========================================
  Files         667      667              
  Lines       19128    19185      +57     
  Branches     3725     3743      +18     
==========================================
+ Hits        16268    16324      +56     
- Misses       2467     2468       +1     
  Partials      393      393              

☔ 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.

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 enhances the EggLoader to collect conventional dynamic files—including agent/app boots, extends, and middleware—into the startup manifest, ensuring these entry points are available in bundled environments. It also updates the EntryGenerator in egg-bundler to support complex path mapping and aliasing, allowing bundled applications to resolve modules via relative keys, output-dir absolute paths, and original absolute paths. Feedback was provided to expand the file extension patterns for middleware discovery to include .mjs and .cjs and to verify that the middleware path is a directory before globbing to prevent potential runtime errors.

Comment thread packages/core/src/loader/egg_loader.ts Outdated
Comment thread packages/core/src/loader/egg_loader.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes bundled-worker startup manifests by ensuring convention-based plugin dynamic files (e.g., agent, app, app/extend/*, app/middleware) are captured even when manifests are generated via metadataOnly startup, so bundled single-mode workers can resolve these files at runtime.

Changes:

  • Extend EggLoader.generateManifest() to additionally record conventional plugin dynamic entrypoints into resolveCache/fileDiscovery.
  • Enhance EntryGenerator’s worker entry to treat outputDir as runtime baseDir, pass framework explicitly to startEgg, and precompute alias keys for runtime module lookup (relKey, output-abs, original-app-abs, and resolveCache request aliases).
  • Add/adjust tests, fixtures, snapshots, and documentation to validate and describe the behavior.

Reviewed changes

Copilot reviewed 11 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wiki/packages/egg-bundler.md Documents worker runtime path mapping and lookup key strategy.
wiki/log.md Records the documentation update in the wiki log.
tools/egg-bundler/test/deterministic.test.ts Updates determinism checks to normalize documented embedded absolute aliases in worker runtime output.
tools/egg-bundler/test/snapshots/EntryGenerator.worker.canonical.snap Updates canonical worker entry snapshot to reflect new runtime baseDir/framework/alias logic.
tools/egg-bundler/test/EntryGenerator.test.ts Extends tests for alias keying, symlink behavior, and executing generated worker with explicit framework through bundle loader.
tools/egg-bundler/src/lib/EntryGenerator.ts Implements outputDir-as-runtime-baseDir, explicit framework passing, and richer bundle-map aliasing (incl. resolveCache aliases).
tools/egg-bundler/docs/output-structure.md Updates docs to reflect new startEgg({ baseDir: outputDir, framework, ... }) and aliasing behavior.
packages/core/test/loader/manifest_coverage.test.ts Adds coverage test asserting plugin conventional dynamic files appear in the manifest under metadataOnly loading.
packages/core/test/fixtures/manifest-dynamic-plugin/package.json Adds a new fixture app for manifest coverage.
packages/core/test/fixtures/manifest-dynamic-plugin/config/plugin.js Enables the fixture @eggjs/security plugin.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/package.json Adds a fixture plugin package with eggPlugin metadata.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/agent.js Adds fixture plugin agent boot file.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app.js Adds fixture plugin app boot file.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/agent.js Adds fixture plugin agent extend file.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/application.js Adds fixture plugin application extend file.
packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/middleware/securities.js Adds fixture plugin middleware file for discovery coverage.
packages/core/src/loader/egg_loader.ts Augments manifest generation to include convention-based dynamic plugin files and middleware discovery.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/loader/egg_loader.ts`:
- Line 11: Update the globby usage to match the current API: replace the default
import "globby" with the named import "globbySync" and update any calls that use
globby(...) to globbySync(...); also fix the glob syntax used (change
"**/*.(js|ts)" to the brace expansion "**/*.{js,ts}") so file matching works
correctly — search for the import statement and all usages around egg_loader.ts
(e.g., where the glob pattern is defined) and update the import symbol and the
pattern accordingly.
🪄 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: 9f6e1049-956c-414a-b275-5b6ecf69b34b

📥 Commits

Reviewing files that changed from the base of the PR and between 77fbaef and 7aeaf80.

⛔ Files ignored due to path filters (7)
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/middleware/securities.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/package.json is excluded by !**/node_modules/**
  • tools/egg-bundler/test/__snapshots__/EntryGenerator.worker.canonical.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • packages/core/src/loader/egg_loader.ts
  • packages/core/test/fixtures/manifest-dynamic-plugin/config/plugin.js
  • packages/core/test/fixtures/manifest-dynamic-plugin/package.json
  • packages/core/test/loader/manifest_coverage.test.ts
  • tools/egg-bundler/docs/output-structure.md
  • tools/egg-bundler/src/lib/EntryGenerator.ts
  • tools/egg-bundler/test/EntryGenerator.test.ts
  • tools/egg-bundler/test/deterministic.test.ts
  • wiki/log.md
  • wiki/packages/egg-bundler.md

Comment thread packages/core/src/loader/egg_loader.ts
@killagu killagu force-pushed the agent/egg-dev/7e0d31d1 branch from 7aeaf80 to db3a8ce Compare May 3, 2026 10:50
Copilot AI review requested due to automatic review settings May 3, 2026 14:43
@killagu killagu force-pushed the agent/egg-dev/7e0d31d1 branch from db3a8ce to 9167ab7 Compare May 3, 2026 14:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 25 changed files in this pull request and generated 1 comment.

Comment thread tools/egg-bin/src/commands/bundle.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tools/egg-bin/src/commands/bundle.ts`:
- Around line 38-48: getBundleFrameworkSpecifier currently returns
pkg.egg.framework or the --framework flag verbatim, which drops support for
custom/absolute framework paths; update it to reuse the existing normalization
logic from packages/utils/src/framework.ts (e.g. call the resolver function used
in lines 28-91, such as resolveFrameworkSpecifier) so that path-like values
(relative/absolute or custom locations) are resolved to the same canonical form
the bundler expects while non-path framework names are preserved; locate
getBundleFrameworkSpecifier, import and call the resolver with baseDir and the
raw framework value (falling back to 'egg') and return the resolved specifier to
maintain compatibility.
🪄 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: 02dcca4c-a5b0-4524-aae2-dc2f73c132f3

📥 Commits

Reviewing files that changed from the base of the PR and between db3a8ce and 9167ab7.

⛔ Files ignored due to path filters (7)
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/app/middleware/securities.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/manifest-dynamic-plugin/node_modules/@eggjs/security/package.json is excluded by !**/node_modules/**
  • tools/egg-bundler/test/__snapshots__/EntryGenerator.worker.canonical.snap is excluded by !**/*.snap
📒 Files selected for processing (18)
  • packages/core/src/loader/egg_loader.ts
  • packages/core/test/fixtures/manifest-dynamic-plugin/config/plugin.js
  • packages/core/test/fixtures/manifest-dynamic-plugin/package.json
  • packages/core/test/loader/manifest_coverage.test.ts
  • tools/egg-bin/README.md
  • tools/egg-bin/src/commands/bundle.ts
  • tools/egg-bin/test/commands/bundle.test.ts
  • tools/egg-bundler/README.md
  • tools/egg-bundler/docs/output-structure.md
  • tools/egg-bundler/src/index.ts
  • tools/egg-bundler/src/lib/Bundler.ts
  • tools/egg-bundler/src/lib/EntryGenerator.ts
  • tools/egg-bundler/src/lib/frameworkSpecifier.ts
  • tools/egg-bundler/test/Bundler.test.ts
  • tools/egg-bundler/test/EntryGenerator.test.ts
  • tools/egg-bundler/test/deterministic.test.ts
  • wiki/log.md
  • wiki/packages/egg-bundler.md
✅ Files skipped from review due to trivial changes (7)
  • packages/core/test/fixtures/manifest-dynamic-plugin/config/plugin.js
  • packages/core/test/fixtures/manifest-dynamic-plugin/package.json
  • tools/egg-bin/README.md
  • wiki/packages/egg-bundler.md
  • tools/egg-bundler/src/index.ts
  • wiki/log.md
  • tools/egg-bundler/test/deterministic.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/src/loader/egg_loader.ts
  • packages/core/test/loader/manifest_coverage.test.ts

Comment thread tools/egg-bin/src/commands/bundle.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/core/test/loader/manifest_coverage.test.ts (1)

104-134: ⚡ Quick win

testApp.close() is skipped when an assertion throws early

Both new tests call await testApp.close() at the end without a finally guard. A failing assertion aborts the test body and the app is never closed, potentially leaving file-watchers or open handles that can interfere with subsequent tests. This matches the pre-existing pattern in the file; consider fixing all affected tests together.

♻️ Proposed pattern – use `try/finally` for guaranteed cleanup
  it('should collect configured customLoader directories in metadataOnly startup', async () => {
    const testApp = createApp('custom-loader', { metadataOnly: true });
-   await testApp.loader.loadPlugin();
-   // ... assertions ...
-   await testApp.close();
+   try {
+     await testApp.loader.loadPlugin();
+     // ... assertions ...
+   } finally {
+     await testApp.close();
+   }
  });

Alternatively, use Vitest's onTestFinished hook:

- it('should collect ...', async () => {
-   const testApp = createApp('custom-loader', { metadataOnly: true });
+ it('should collect ...', async ({ onTestFinished }) => {
+   const testApp = createApp('custom-loader', { metadataOnly: true });
+   onTestFinished(() => testApp.close());
    // ... rest of body without manual close() ...
- await testApp.close();
  });

Also applies to: 136-166

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/test/loader/manifest_coverage.test.ts` around lines 104 - 134,
The tests create a testApp and call await testApp.close() at the end but do not
guarantee cleanup if an assertion throws; update each affected it block (the
ones that create testApp and call testApp.close(), e.g., the test using
createApp('custom-loader', { metadataOnly: true }) and the other similar test)
to declare testApp before the test body and wrap the test logic and assertions
in a try/finally where the finally always awaits testApp.close(); alternatively
you may register cleanup via Vitest's onTestFinished, but the direct fix is:
move creation so testApp is in scope, put all load/manifest/assert calls inside
try { ... } and do finally { await testApp.close(); } to ensure watchers/handles
are closed on failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/test/loader/manifest_coverage.test.ts`:
- Around line 112-131: The assertions call manifest.fileDiscovery[...]
.includes(...) directly which throws if the key is missing; change each includes
invocation to use optional chaining so the lookup becomes
manifest.fileDiscovery['app/adapter']?.includes('docker.js') (and similarly for
'app/util', 'app/repository', 'app/plugin', 'config/b/app/plugin' and the other
occurrences around the later assertions) so that assert.ok receives false and
the custom message instead of a TypeError; update all six shown includes and the
matching ones later in the file.

---

Nitpick comments:
In `@packages/core/test/loader/manifest_coverage.test.ts`:
- Around line 104-134: The tests create a testApp and call await testApp.close()
at the end but do not guarantee cleanup if an assertion throws; update each
affected it block (the ones that create testApp and call testApp.close(), e.g.,
the test using createApp('custom-loader', { metadataOnly: true }) and the other
similar test) to declare testApp before the test body and wrap the test logic
and assertions in a try/finally where the finally always awaits testApp.close();
alternatively you may register cleanup via Vitest's onTestFinished, but the
direct fix is: move creation so testApp is in scope, put all
load/manifest/assert calls inside try { ... } and do finally { await
testApp.close(); } to ensure watchers/handles are closed on failure.
🪄 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: c72bfb8b-951b-43d2-a797-e077df72e825

📥 Commits

Reviewing files that changed from the base of the PR and between 9167ab7 and 6abded8.

📒 Files selected for processing (1)
  • packages/core/test/loader/manifest_coverage.test.ts

Comment thread packages/core/test/loader/manifest_coverage.test.ts Outdated
Copilot AI review requested due to automatic review settings May 3, 2026 15:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 25 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings May 4, 2026 01:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 27 changed files in this pull request and generated 1 comment.

export function assertFrameworkPackageSpecifier(framework: string): void {
if (!framework || isPathLikeFrameworkSpecifier(framework)) {
throw new Error(
`[@eggjs/egg-bundler] framework must be a package specifier for bundled runtime, got path-like value: ${framework}`,
@killagu killagu force-pushed the agent/egg-dev/7e0d31d1 branch from ee9ce75 to 1a4d3cc Compare May 4, 2026 01:44
Copilot AI review requested due to automatic review settings May 4, 2026 02:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 15 changed files in this pull request and generated 1 comment.

Comment thread packages/core/src/loader/manifest.ts Outdated
@killagu killagu merged commit 871e596 into next May 4, 2026
26 checks passed
@killagu killagu deleted the agent/egg-dev/7e0d31d1 branch May 4, 2026 14:47
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