Skip to content

fix(dal-gen): await async loader.load() for egg4 compatibility#295

Open
elrrrrrrr wants to merge 1 commit into
5.xfrom
fix/dal-gen-async-loader
Open

fix(dal-gen): await async loader.load() for egg4 compatibility#295
elrrrrrrr wants to merge 1 commit into
5.xfrom
fix/dal-gen-async-loader

Conversation

@elrrrrrrr

Copy link
Copy Markdown

What

In egg4 the tegg loader's load() is async (returns a Promise), but lib/dal-gen.js consumed it synchronously:

const clazzList = loader.load();
for (const clazz of clazzList) { ... }   // TypeError: clazzList is not iterable

So egg-bin generate dal code <module> fails with clazzList is not iterable against egg4 / @eggjs/tegg@4. Note @eggjs/dal-runtime's own DaoLoader already awaits .load().

Fix

const clazzList = await loader.load();

The call site is already inside an async IIFE, so this is safe. Targeting 5.x since the dal command only exists on the 5.x line.

🤖 Generated with Claude Code

In egg4 the tegg loader's `load()` is async and returns a Promise, but
`lib/dal-gen.js` consumed it synchronously, so `for (const clazz of clazzList)`
threw `TypeError: clazzList is not iterable` during `egg-bin generate dal code`.
(`@eggjs/dal-runtime`'s own DaoLoader already awaits it.) Await the loader.

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

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

Copy link
Copy Markdown

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 updates lib/dal-gen.js to correctly await the asynchronous loader.load() function call when retrieving the list of classes. There are no review comments, and I have no additional feedback to provide.

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.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: 4c328b73-0a8d-4bf9-a0b8-8c941b9d4160

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 fix/dal-gen-async-loader

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.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f9398f4) to head (1309cdf).
⚠️ Report is 7 commits behind head on 5.x.

Additional details and impacted files
@@            Coverage Diff            @@
##               5.x      #295   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12         8    -4     
  Lines           93        60   -33     
  Branches        16        12    -4     
=========================================
- Hits            93        60   -33     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant