Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 27, 2025

Summary by CodeRabbit

  • New Features

    • Error utilities are now publicly available for direct import and use.
    • Plugin modules for validation, AOP, controllers, data access, event bus, ORM, and scheduling are now exposed as part of the package API.
  • Chores

    • Package declarations and dependencies updated to align the public API surface and maintain consistency.

@fengmk2 fengmk2 requested a review from Copilot October 27, 2025 17:14
Copy link
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 adds support for exporting the @eggjs/errors package through the main egg package by creating a new errors.ts entry point. This allows consumers to import error types directly from egg/errors rather than having to import from @eggjs/errors directly.

Key Changes:

  • Created a new errors.ts file that re-exports everything from @eggjs/errors
  • Added corresponding package.json export entries for both TypeScript and JavaScript consumers
  • Added @eggjs/errors as a workspace dependency

Reviewed Changes

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

File Description
packages/egg/src/errors.ts New file that re-exports all exports from @eggjs/errors
packages/egg/package.json Added export entries for ./errors and added @eggjs/errors dependency (also alphabetized dependencies)
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fengmk2, 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 introduces a new feature that exports the @eggjs/errors module directly from the main egg package. This enhancement simplifies the import paths for error handling utilities, allowing developers to access common error definitions more conveniently through egg/errors. The update involves modifying the package.json to expose the new entry point and adding a simple re-export file in the source directory.

Highlights

  • New Export: The egg package now directly exports egg/errors, providing a convenient way to access error definitions without needing to import @eggjs/errors separately.
  • Dependency Update: The @eggjs/errors package has been added as a workspace dependency to the packages/egg module.
  • API Simplification: This change streamlines the API for error handling, making it more integrated within the egg framework.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a public ./errors export to the egg package and introduces a re-export barrel that surfaces @eggjs/errors exports from packages/egg/src/errors.ts. No runtime logic changes.

Changes

Cohort / File(s) Summary
Package exports & dependencies
packages/egg/package.json
Added ./errors to both exports and publishConfig.exports (pointing to ./src/errors.ts and ./dist/errors.js respectively). Added @eggjs/errors and several plugin packages as workspace:* dependencies; adjusted dependency declarations.
Errors re-export barrel
packages/egg/src/errors.ts
New file exporting export * from '@eggjs/errors'; to re-export the errors package surface.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Check packages/egg/package.json for correct export paths and publishConfig consistency.
  • Verify @eggjs/errors exists in the workspace and exposes the expected exports.
  • Confirm build output includes dist/errors.js for publishing.

Poem

🐰
I found a trail of exports bright,
Re-exported errors hopping into light.
Packages linked, a tidy art—
A little barrel, a giant heart. 🥕✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: export egg/errors" accurately and concisely describes the primary change in the changeset. The modifications consist of adding a new public export for the errors module by creating a re-export barrel in packages/egg/src/errors.ts and configuring the export paths in package.json. The title directly captures this main objective without being vague or including unnecessary details, making it clear to reviewers scanning history what the change accomplishes.

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.

Copy link
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 adds a new export for egg/errors by re-exporting from the @eggjs/errors package. The implementation is straightforward and correct. I have one suggestion regarding the dependency versioning in package.json to improve consistency and stability.

"@eggjs/core": "workspace:*",
"@eggjs/dal-plugin": "workspace:*",
"@eggjs/development": "workspace:*",
"@eggjs/errors": "workspace:^",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with other workspace dependencies in this package, it's recommended to use workspace:* instead of workspace:^. Using workspace:* ensures that the exact version from the workspace is used when publishing. This provides more stability for a framework package like egg, as workspace:^ would be translated to a ^ version range on publish, potentially pulling in newer, incompatible minor versions of @eggjs/errors.

    "@eggjs/errors": "workspace:*"

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 27, 2025

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: e14f971
Status: ✅  Deploy successful!
Preview URL: https://391781ed.egg-cci.pages.dev
Branch Preview URL: https://export-egg-errors.egg-cci.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 27, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: e14f971
Status: ✅  Deploy successful!
Preview URL: https://c7f413c9.egg-v3.pages.dev
Branch Preview URL: https://export-egg-errors.egg-v3.pages.dev

View logs

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbb96d3 and b0d48c0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/egg/package.json (3 hunks)
  • packages/egg/src/errors.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use TypeScript for all source files in packages (no JavaScript source files)

Files:

  • packages/egg/src/errors.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable

Files:

  • packages/egg/src/errors.ts
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts: For isolatedDeclarations support, all exported functions/methods/getters must have explicit return type annotations
Avoid computed property names with symbols in class declarations (no get SYM)
Add explicit type annotations for class properties when needed (no inferred exported property types)
Exported symbols must use unique symbol type (e.g., export const X: unique symbol = Symbol('x'))

Files:

  • packages/egg/src/errors.ts
packages/*/package.json

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use "workspace:*" for internal workspace dependencies in package.json

Files:

  • packages/egg/package.json
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}

📄 CodeRabbit inference engine (CLAUDE.md)

All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")

Files:

  • packages/egg/package.json
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}

📄 CodeRabbit inference engine (CLAUDE.md)

{packages/**/package.json,plugins/**/package.json,tools/**/package.json}: Use workspace:* for internal dependencies between monorepo packages
Use catalog: versions for external dependencies defined in pnpm-workspace.yaml
Include script "typecheck": "tsc --noEmit" in all packages
Include script "lint": "oxlint --type-aware" in all packages
Include script "lint:fix" that runs oxlint with --fix (e.g., "pnpm run lint -- --fix")

Files:

  • packages/egg/package.json
🧠 Learnings (5)
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Use Egg.js >= 4.1.0

Applied to files:

  • packages/egg/src/errors.ts
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to plugins/*/package.json : Plugins must declare peerDependencies: { "egg": "workspace:*" }

Applied to files:

  • packages/egg/package.json
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/plugin/*/package.json : Plugin packages must define eggPlugin in package.json with dependencies

Applied to files:

  • packages/egg/package.json
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/{core,plugin,standalone}/*/package.json : Use workspace:* for internal monorepo dependencies and catalog: for external dependencies

Applied to files:

  • packages/egg/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to {packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Use workspace:* for internal dependencies between monorepo packages

Applied to files:

  • packages/egg/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test (macos-latest, 24, 1/5)
  • GitHub Check: Test (macos-latest, 22, 1/5)
  • GitHub Check: Test bin (windows-latest, 22, 1/3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Test bin (windows-latest, 22, 0/3)
  • GitHub Check: Test scripts (ubuntu-latest, 22)
  • GitHub Check: typecheck
  • GitHub Check: Test scripts (ubuntu-latest, 24)
🔇 Additional comments (2)
packages/egg/src/errors.ts (1)

1-1: LGTM!

Clean barrel re-export that delegates to @eggjs/errors. Follows ESM conventions and aligns with the PR objective to expose the errors module.

packages/egg/package.json (1)

29-29: Exports properly aligned.

The addition of "./errors" to both publishConfig.exports and exports correctly exposes the errors module for both distribution and source entry points, maintaining consistency with the package API surface.

Also applies to: 87-87

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5655      +/-   ##
==========================================
- Coverage   87.68%   87.67%   -0.01%     
==========================================
  Files         565      565              
  Lines       11010    11010              
  Branches     1243     1243              
==========================================
- Hits         9654     9653       -1     
- Misses       1275     1276       +1     
  Partials       81       81              

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

@fengmk2 fengmk2 merged commit 4780809 into next Oct 28, 2025
48 of 51 checks passed
@fengmk2 fengmk2 deleted the export-egg-errors branch October 28, 2025 13:15
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