Skip to content

fix(tegg): restore bundled manifest paths#5934

Open
killagu wants to merge 8 commits intonextfrom
agent/egg-dev/01ea13af
Open

fix(tegg): restore bundled manifest paths#5934
killagu wants to merge 8 commits intonextfrom
agent/egg-dev/01ea13af

Conversation

@killagu
Copy link
Copy Markdown
Contributor

@killagu killagu commented May 7, 2026

Summary

  • Restore bundled tegg manifest module references and descriptors against the runtime bundle baseDir before module config and load-unit creation.
  • Fall back to app.baseDir for controller load-unit initialization when app.config.baseDir is not populated yet.
  • Add focused coverage for manifest path restoration and controller load-unit baseDir fallback.

Dependency

Tests

  • pnpm install
  • pnpm exec vitest run tegg/core/loader/test/LoaderFactoryManifest.test.ts tegg/plugin/config/test/ReadModule.test.ts tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts --testTimeout 30000
  • pnpm -C tools/egg-bundler exec vitest run test/ManifestLoader.test.ts test/EntryGenerator.test.ts --testTimeout 30000
  • pnpm -C tegg/core/loader run typecheck
  • pnpm -C tegg/plugin/config run typecheck
  • pnpm -C tegg/plugin/tegg run typecheck
  • pnpm -C tegg/plugin/controller run typecheck
  • pnpm exec oxfmt --check changed files
  • pnpm exec oxlint --type-aware changed files
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Manifest-based caching/restoration of loader paths and per-plugin metadata for consistent, faster plugin resolution and bundle-aware path restoration.
    • Bundled apps virtualize framework search paths so frameworks resolve correctly at runtime.
  • Bug Fixes

    • More resilient controller/module path resolution when base directory config is absent.
  • Tests

    • Added/updated tests validating manifest-based path/metadata restoration and increased startup timeouts for stability.

Copilot AI review requested due to automatic review settings May 7, 2026 03:01
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

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

EggLoader and egg-bundler persist and restore loader metadata via a new eggLoader manifest extension (cached eggPaths and per-plugin info). Bundle output runtime patches framework customEggPaths to virtualize manifest-provided framework roots. Tegg loaders restore manifest-encoded relative paths to absolute runtime paths.

Changes

Loader Manifest Persistence

Layer / File(s) Summary
Data Shape & Types
packages/core/src/loader/egg_loader.ts
Adds LoaderManifestExtension, LoaderManifestPluginInfo interfaces and LOADER_MANIFEST_EXTENSION key.
Egg Path Restoration
packages/core/src/loader/egg_loader.ts
getEggPaths() reads extensions.eggLoader.eggPaths from bundle store, converts to absolute, merges with discovered paths, and excludes bundle-output-root entries.
Plugin Metadata Apply / Persist
packages/core/src/loader/egg_loader.ts
loadPlugin() applies cached per-plugin metadata into merged allPlugins before resolution and persists selected plugin metadata back into manifest extension after selection (skips when using bundle output store).
Helpers
packages/core/src/loader/egg_loader.ts
Adds helpers for manifest read/write, manifest-relative/absolute path conversion, bundle-output-root detection, and a realpath utility.
Tests / Wiring
packages/core/test/loader/mixin/load_plugin.test.ts
New test installs a StartupManifest via ManifestStore.fromBundle, asserts eggPaths and bundled plugin path restoration, and resets the bundle store after tests.

Tegg Manifest Path Restoration

Layer / File(s) Summary
Restore Helpers
tegg/plugin/config/src/app.ts
Adds restoreManifestModulePath and restoreTeggManifestExtension to convert manifest moduleReferences[].path and moduleDescriptors[].unitPath to absolute paths under app.baseDir.
Scan & Load Integration
tegg/plugin/config/src/app.ts
#scanModuleReferences and #loadModuleConfigs use restored manifest paths when present (preserving already-absolute paths).
Loader Integration
tegg/plugin/tegg/src/lib/EggModuleLoader.ts
Restores TEGG_MANIFEST_KEY extension to absolute paths and uses it as loadAppManifest when descriptors exist, skipping collect when provided.
Tests
tegg/plugin/config/test/ReadModule.test.ts, tegg/core/loader/test/LoaderFactoryManifest.test.ts, tegg/plugin/tegg/test/lib/EggModuleLoader.test.ts
Added/updated tests validate manifest-based module reference/descriptor restoration and that LoaderFactory.loadApp / EggModuleLoader receive restored absolute paths.

Bundled Runtime Framework Path Virtualization

Layer / File(s) Summary
Manifest Normalization
tools/egg-bundler/src/lib/ManifestLoader.ts
Recognizes extensions.eggLoader, copies it to extensions['eggLoader'], and normalizes eggPaths and per-plugin path via existing relative-key normalization.
Worker Entry Generation
tools/egg-bundler/src/lib/EntryGenerator.ts
Generates worker runtime code (imports fs) that maps manifest eggLoader.eggPaths into bundle node_modules roots, detects output-root paths, and patches framework Application/Agent customEggPaths() to return a de-duplicated union while excluding output-root duplicates.
Tests
tools/egg-bundler/test/EntryGenerator.test.ts, tools/egg-bundler/test/ManifestLoader.test.ts
Adds integration test asserting runtime virtualization of framework paths; updates ManifestLoader tests to expect normalized extensions.eggLoader; asserts generated worker emits __patchFrameworkPaths call.

Controller Loader & Test Timeouts / Minor Fixes

Layer / File(s) Summary
Controller BaseDir Fallback
tegg/plugin/controller/src/lib/ControllerLoadUnitHandler.ts
_init() now uses this.app.config.baseDir ?? this.app.baseDir to compute controller directory.
Controller Handler Test
tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts
New unit test verifies _init() uses app.baseDir fallback and factory call sequencing.
Test Timeouts / Fixes
tegg/plugin/aop/test/aop.test.ts, tegg/plugin/orm/test/index.test.ts, tegg/plugin/tegg/test/ModuleConfig.test.ts
Increases mm.app/app.ready() timeouts to 30000 ms and fixes an incomplete mm.app() call in ORM test.

Sequence Diagram

sequenceDiagram
    participant Bundler as Bundler (build)
    participant ManifestStore as ManifestStore
    participant Runtime as Generated Worker
    participant EggLoader as EggLoader
    participant Framework as egg Framework

    Bundler->>ManifestStore: collect loader metadata -> extensions.eggLoader
    Bundler->>ManifestStore: normalize eggLoader paths/plugins

    Note over Runtime: Startup

    Runtime->>ManifestStore: retrieve manifest.extensions.eggLoader
    ManifestStore-->>Runtime: eggPaths + plugin metadata
    Runtime->>Runtime: __patchFrameworkPaths() → virtualize framework roots

    Runtime->>EggLoader: getEggPaths()
    EggLoader->>ManifestStore: read eggLoader.eggPaths
    EggLoader-->>Runtime: return merged absolute eggPaths (exclude output-root)

    Runtime->>EggLoader: loadPlugin()
    EggLoader->>ManifestStore: read plugin metadata
    EggLoader->>EggLoader: apply cached plugin info → merged allPlugins
    EggLoader->>ManifestStore: persist selected plugin metadata
    EggLoader-->>Runtime: loadPlugin() complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • eggjs/egg#5844: Foundation for ManifestStore-based loader caching this change builds upon.
  • eggjs/egg#5906: Related bundler/manifest wiring and ManifestLoader/EntryGenerator changes.
  • eggjs/egg#5932: Related manifest path restoration and bundler runtime adjustments.

Suggested reviewers

  • jerryliang64
  • gxkl
  • Dipper30

"I hid the paths inside a file, kept plugins snug and free,
Bundles wake with memories, no more discovery spree,
EggLoader hums a tune, restoring paths that roam,
Framework roots virtual, now every egg finds home,
A rabbit’s little patch—hops tidy, light, and spry." 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 'fix(tegg): restore bundled manifest paths' directly and precisely describes the main change across all modified files—enabling restoration of bundled manifest paths for tegg module references and descriptors.
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/01ea13af

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 7, 2026

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 52da926
Status: ✅  Deploy successful!
Preview URL: https://5cb92046.egg-cci.pages.dev
Branch Preview URL: https://agent-egg-dev-01ea13af.egg-cci.pages.dev

View logs

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.27%. Comparing base (f6c7b7c) to head (52da926).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5934      +/-   ##
==========================================
+ Coverage   85.18%   85.27%   +0.08%     
==========================================
  Files         668      668              
  Lines       19288    19358      +70     
  Branches     3784     3816      +32     
==========================================
+ Hits        16431    16507      +76     
+ Misses       2465     2459       -6     
  Partials      392      392              

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

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

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

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 52da926
Status: ✅  Deploy successful!
Preview URL: https://1c2e8ae3.egg-v3.pages.dev
Branch Preview URL: https://agent-egg-dev-01ea13af.egg-v3.pages.dev

View logs

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 introduces a mechanism to bundle and restore loader state, including framework paths and plugin information, through a new manifest extension. Key changes include the ability for the core loader to merge paths from the manifest, utilities for restoring relative paths at runtime, and enhancements to the bundler to normalize manifest data and patch framework paths in generated entries. Feedback highlights potential issues with path comparison logic in both the core loader and the bundler's generated code, specifically regarding the handling of symbolic links when identifying root paths.

Comment thread packages/core/src/loader/egg_loader.ts
Comment thread tools/egg-bundler/src/lib/EntryGenerator.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 fixes bundled runtime startup for tegg + egg loader by replaying manifest-derived paths against the runtime bundle baseDir early enough to avoid “collapsed to outputDir” resolution, and adds targeted regression tests across bundler/core/tegg.

Changes:

  • Normalize and replay eggLoader manifest extension (eggPaths + plugin paths) during bundler manifest load and core loader startup.
  • Restore tegg manifest module reference/descriptor paths against runtime baseDir before module config + load-unit creation.
  • Add focused tests for framework path virtualization in the generated worker entry, tegg manifest restoration, and controller load-unit baseDir fallback.

Reviewed changes

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

Show a summary per file
File Description
tools/egg-bundler/src/lib/ManifestLoader.ts Normalize extensions.eggLoader paths during manifest normalization.
tools/egg-bundler/src/lib/EntryGenerator.ts Patch framework customEggPaths() in generated worker to virtualize eggPaths under output node_modules/ before startEgg().
tools/egg-bundler/test/ManifestLoader.test.ts Extend coverage for normalized eggLoader extension payload.
tools/egg-bundler/test/EntryGenerator.test.ts Add runtime test ensuring framework eggPaths are virtualized before startEgg() executes.
tools/egg-bundler/test/snapshots/EntryGenerator.worker.canonical.snap Update canonical worker snapshot to include framework-path patching logic.
packages/core/src/loader/egg_loader.ts Apply bundled loader manifest eggPaths/plugin metadata and collect eggLoader extension for manifest generation.
packages/core/test/loader/mixin/load_plugin.test.ts Add coverage that bundled loader manifest eggPaths + plugin paths are applied.
tegg/core/loader/src/LoaderFactory.ts Add helpers to restore manifest module paths against runtime baseDir.
tegg/core/loader/test/LoaderFactoryManifest.test.ts Add test verifying restored manifest paths match on-disk loader results.
tegg/plugin/tegg/src/lib/EggModuleLoader.ts Restore tegg manifest extension paths before calling LoaderFactory.loadApp().
tegg/plugin/config/src/app.ts Restore manifest module reference paths before config/load-unit creation.
tegg/plugin/config/test/ReadModule.test.ts Add coverage for restoring manifest module references against runtime baseDir.
tegg/plugin/controller/src/lib/ControllerLoadUnitHandler.ts Fallback to app.baseDir when config.baseDir isn’t available yet.
tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts Add regression test for controller load-unit baseDir fallback.
tegg/plugin/aop/test/aop.test.ts Increase test timeout for readiness.
tegg/plugin/orm/test/index.test.ts Increase test timeout for readiness.
tegg/plugin/tegg/test/ModuleConfig.test.ts Increase test timeout for readiness.

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 (2)
tegg/core/loader/src/LoaderFactory.ts (1)

46-57: ⚡ Quick win

Consider defensive fallbacks for potentially missing arrays.

manifest.moduleReferences and manifest.moduleDescriptors come from raw deserialized JSON, so either field can be absent despite the type annotation. Calling .map() on undefined would throw and crash app startup.

This inconsistency is also visible in the caller (EggModuleLoader.ts line 44), where restoredManifestTegg?.moduleDescriptors?.length uses optional chaining to guard — yet that check happens after restoreTeggManifestExtension would have already thrown if moduleDescriptors was missing.

🛡️ Proposed defensive fix
 export function restoreTeggManifestExtension(manifest: TeggManifestExtension, baseDir: string): TeggManifestExtension {
   return {
-    moduleReferences: manifest.moduleReferences.map((ref) => ({
+    moduleReferences: (manifest.moduleReferences ?? []).map((ref) => ({
       ...ref,
       path: restoreManifestModulePath(ref.path, baseDir),
     })),
-    moduleDescriptors: manifest.moduleDescriptors.map((desc) => ({
+    moduleDescriptors: (manifest.moduleDescriptors ?? []).map((desc) => ({
       ...desc,
       unitPath: restoreManifestModulePath(desc.unitPath, baseDir),
     })),
   };
 }
🤖 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 `@tegg/core/loader/src/LoaderFactory.ts` around lines 46 - 57, The function
restoreTeggManifestExtension will throw if manifest.moduleReferences or
manifest.moduleDescriptors are undefined; update restoreTeggManifestExtension to
defensively handle missing arrays by using safe fallbacks (e.g.,
manifest.moduleReferences ?? [] and manifest.moduleDescriptors ?? []) before
calling .map(); keep using restoreManifestModulePath for each element and return
the same TeggManifestExtension shape with empty arrays when fields are absent.
tegg/plugin/config/test/ReadModule.test.ts (1)

59-80: ⚡ Quick win

Consider key-aware getExtension mock for better isolation.

getExtension() currently ignores its argument and always returns the tegg manifest. If loadMetadata() also calls getExtension() for other keys (e.g., eggLoader), those calls silently return the tegg payload, which could mask unexpected interactions.

🔧 Proposed tighter mock
-          getExtension() {
+          getExtension(key: string) {
+            if (key !== 'tegg') return undefined;
             return {
               moduleReferences: [
🤖 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 `@tegg/plugin/config/test/ReadModule.test.ts` around lines 59 - 80, The current
mock of getExtension in the test always returns the tegg manifest regardless of
the requested key, which can mask unintended interactions; update the mock used
in ReadModule.test.ts so that getExtension(key) returns different payloads based
on the key (e.g., when key === 'tegg' return the
moduleReferences/moduleDescriptors object, when key === 'eggLoader' or others
return undefined or a minimal stub). Locate the getExtension mock in the test
(the anonymous object under manifest) and change it to a key-aware function that
switches on the incoming key to return only the intended manifest for the tegg
key and safe defaults for any other keys.
🤖 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 `@tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts`:
- Around line 5-6: Update the ESM imports in ControllerLoadUnitHandler.test:
replace the TypeScript file extensions in the import statements that reference
CONTROLLER_LOAD_UNIT and ControllerLoadUnitHandler so they import the compiled
ESM module names (use .js instead of .ts); locate the two imports that currently
import '../../src/lib/ControllerLoadUnit.ts' and
'../../src/lib/ControllerLoadUnitHandler.ts' and change them to their .js
counterparts to comply with the repo ESM import rule.

---

Nitpick comments:
In `@tegg/core/loader/src/LoaderFactory.ts`:
- Around line 46-57: The function restoreTeggManifestExtension will throw if
manifest.moduleReferences or manifest.moduleDescriptors are undefined; update
restoreTeggManifestExtension to defensively handle missing arrays by using safe
fallbacks (e.g., manifest.moduleReferences ?? [] and manifest.moduleDescriptors
?? []) before calling .map(); keep using restoreManifestModulePath for each
element and return the same TeggManifestExtension shape with empty arrays when
fields are absent.

In `@tegg/plugin/config/test/ReadModule.test.ts`:
- Around line 59-80: The current mock of getExtension in the test always returns
the tegg manifest regardless of the requested key, which can mask unintended
interactions; update the mock used in ReadModule.test.ts so that
getExtension(key) returns different payloads based on the key (e.g., when key
=== 'tegg' return the moduleReferences/moduleDescriptors object, when key ===
'eggLoader' or others return undefined or a minimal stub). Locate the
getExtension mock in the test (the anonymous object under manifest) and change
it to a key-aware function that switches on the incoming key to return only the
intended manifest for the tegg key and safe defaults for any other keys.
🪄 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: bf35f149-cf3e-45bb-8ad3-fbd22d091e4f

📥 Commits

Reviewing files that changed from the base of the PR and between f6c7b7c and 2b7e09d.

⛔ Files ignored due to path filters (1)
  • tools/egg-bundler/test/__snapshots__/EntryGenerator.worker.canonical.snap is excluded by !**/*.snap
📒 Files selected for processing (16)
  • packages/core/src/loader/egg_loader.ts
  • packages/core/test/loader/mixin/load_plugin.test.ts
  • tegg/core/loader/src/LoaderFactory.ts
  • tegg/core/loader/test/LoaderFactoryManifest.test.ts
  • tegg/plugin/aop/test/aop.test.ts
  • tegg/plugin/config/src/app.ts
  • tegg/plugin/config/test/ReadModule.test.ts
  • tegg/plugin/controller/src/lib/ControllerLoadUnitHandler.ts
  • tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts
  • tegg/plugin/orm/test/index.test.ts
  • tegg/plugin/tegg/src/lib/EggModuleLoader.ts
  • tegg/plugin/tegg/test/ModuleConfig.test.ts
  • tools/egg-bundler/src/lib/EntryGenerator.ts
  • tools/egg-bundler/src/lib/ManifestLoader.ts
  • tools/egg-bundler/test/EntryGenerator.test.ts
  • tools/egg-bundler/test/ManifestLoader.test.ts

Comment thread tegg/plugin/controller/test/lib/ControllerLoadUnitHandler.test.ts Outdated
Copilot AI review requested due to automatic review settings May 7, 2026 03:20
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tegg/plugin/config/src/app.ts (1)

85-100: ⚠️ Potential issue | 🔴 Critical

This replacement loses critical path resolution logic and will break module loading

ModuleConfigUtil.resolveModuleDir appends 'config' to relative paths:

return path.join(baseDir, 'config', moduleDir);

restoreManifestModulePath does not:

return path.join(baseDir, modulePath);

When reference.path is relative, the new code will look for module config at ${baseDir}/${path} instead of ${baseDir}/config/${path}, causing readModuleNameSync and loadModuleConfigSync to fail on the wrong directory. This differs from the pattern still used in tegg/standalone/standalone/src/Runner.ts, which continues using resolveModuleDir. Either the manifest paths are guaranteed absolute (in which case the semantic change should be documented), or this change introduces a critical bug in module resolution.

🤖 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 `@tegg/plugin/config/src/app.ts` around lines 85 - 100, The replacement in
_loadModuleConfigs() breaks relative-path handling because
restoreManifestModulePath does not include the 'config' segment like
ModuleConfigUtil.resolveModuleDir does; update _loadModuleConfigs() to resolve
module directories using the same logic as ModuleConfigUtil.resolveModuleDir (or
call that method) when constructing absoluteRef.path for relative reference.path
values so readModuleNameSync and loadModuleConfigSync receive the expected
${baseDir}/config/${moduleDir}; preserve ModuleReference.optional/name handling
and only alter how absoluteRef.path is computed.
🤖 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 `@tegg/plugin/config/src/app.ts`:
- Around line 19-30: restoreTeggManifestExtension currently calls
manifest.moduleDescriptors.map(...) without guarding for missing
moduleDescriptors which will throw a TypeError; update
restoreTeggManifestExtension to treat moduleDescriptors like moduleReferences
(use manifest.moduleDescriptors ?? [] or skip mapping when undefined) and only
map/restore unitPath when entries exist, leaving moduleReferences mapping as-is
(still using restoreManifestModulePath for ref.path) and avoid unnecessary work
since the call-site only consumes moduleReferences.

---

Outside diff comments:
In `@tegg/plugin/config/src/app.ts`:
- Around line 85-100: The replacement in _loadModuleConfigs() breaks
relative-path handling because restoreManifestModulePath does not include the
'config' segment like ModuleConfigUtil.resolveModuleDir does; update
_loadModuleConfigs() to resolve module directories using the same logic as
ModuleConfigUtil.resolveModuleDir (or call that method) when constructing
absoluteRef.path for relative reference.path values so readModuleNameSync and
loadModuleConfigSync receive the expected ${baseDir}/config/${moduleDir};
preserve ModuleReference.optional/name handling and only alter how
absoluteRef.path is computed.
🪄 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: f2a97f00-6fdb-47db-b307-0919df12c7ba

📥 Commits

Reviewing files that changed from the base of the PR and between 2b7e09d and 6c31c74.

📒 Files selected for processing (3)
  • tegg/core/loader/test/LoaderFactoryManifest.test.ts
  • tegg/plugin/config/src/app.ts
  • tegg/plugin/tegg/src/lib/EggModuleLoader.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tegg/plugin/tegg/src/lib/EggModuleLoader.ts

Comment thread tegg/plugin/config/src/app.ts
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 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread tegg/core/loader/test/LoaderFactoryManifest.test.ts Outdated
Copilot AI review requested due to automatic review settings May 7, 2026 04:45
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 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread tegg/plugin/config/src/app.ts
Comment thread tegg/plugin/tegg/src/lib/EggModuleLoader.ts
Comment thread packages/core/src/loader/egg_loader.ts
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