Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 29, 2025

and add benchmark

Summary by CodeRabbit

  • New Features

    • Added HTTP benchmarking tooling and automated run script for side-by-side endpoint tests.
  • Documentation

    • Added a comprehensive benchmarking guide with setup, commands, and performance results.
  • Tests

    • Added extensive tests covering stack-inspection behavior; added conditional skips for flaky Windows tests.
  • Chores

    • Updated benchmark controllers and routes to return versioned greetings; added package manifest scripts and ignore patterns.

@fengmk2 fengmk2 requested a review from Copilot October 29, 2025 12:39
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

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

Refactors benchmark HTTP suite to TypeScript, adds docs and a run script, updates controllers/routes and package.json, enhances stack-trace utilities and tests, and marks flaky Windows tests to skip.

Changes

Cohort / File(s) Summary
Stack Trace Utility (core)
packages/core/src/utils/index.ts
Updated hardcoded egg-mock URL reference to 5.x in stack handling and removed istanbul ignore-if.
Stack Trace Utility (common-util)
tegg/core/common-util/src/StackUtil.ts
Made withLine optional, adjusted defaults, added fallback call-site capture, standardized stack entry formatting, and switched to scriptName/indexed stacks for callee resolution.
StackUtil Tests
tegg/core/common-util/test/StackUtil.test.ts
Added comprehensive tests covering various stack depths, call patterns, indices, and formatting.
HTTP Benchmark Controllers
tegg/benchmark/http/app/controller/FooTeggController.ts, tegg/benchmark/http/app/controller/template/egg_controller_1.ts, tegg/benchmark/http/app/controller/template/egg_controller_1.js
Converted/added controllers to TypeScript, changed response to include package version, and removed old JS export. Updated route paths used in handlers.
HTTP Benchmark Routing
tegg/benchmark/http/app/router.ts, tegg/benchmark/http/app/router.js
Replaced JS router with TS router; registered /hello-egg route and removed old JS router file.
HTTP Benchmark Config & Plugins
tegg/benchmark/http/config/config.default.ts, tegg/benchmark/http/config/config.default.js, tegg/benchmark/http/config/plugin.js
Replaced JS config with TypeScript defineConfig export; removed old JS config and plugin registration file.
HTTP Benchmark Package & Scripts
tegg/benchmark/http/package.json
Set type: "module", expanded scripts (start, stop, build, prebench, bench), and updated dependencies/devDependencies (moved to beta variants and TS tooling).
HTTP Benchmark Run & Docs
tegg/benchmark/http/run.sh, tegg/benchmark/http/README.md, tegg/benchmark/http/.gitignore
Added benchmark orchestration script (start server, log system info, curl endpoints, run wrk tests, stop server), comprehensive README with results and instructions, and .gitignore entries for *.d.ts, *.js, *.log.
Tests: Windows skips
packages/egg/test/egg.test.ts, plugins/schedule/test/customTypeError.test.ts
Marked flaky tests to skip on Windows (describe.skipIf(process.platform === 'win32')) with explanatory comments.

Sequence Diagram(s)

sequenceDiagram
  participant S as run.sh (controller)
  participant N as npm server
  participant C as curl (smoke checks)
  participant W as wrk (load test)

  rect rgba(135,206,235,0.12)
  Note over S,N: Start phase
  S->>N: npm run start (background)
  N-->>S: PID
  end

  rect rgba(144,238,144,0.12)
  Note over S,C: Verification phase
  S->>S: log system & Node info
  S->>C: curl /hello-egg
  S->>C: curl /hello-tegg
  C-->>S: HTTP responses
  end

  rect rgba(255,228,181,0.12)
  Note over S,W: Load test phase
  S->>W: wrk against /hello-egg
  W-->>S: results
  S->>W: wrk against /hello-tegg
  W-->>S: results
  end

  rect rgba(240,128,128,0.12)
  Note over S,N: Teardown
  S->>N: kill PID (npm stop)
  N-->>S: stopped
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • Cross-references for changed route names (/hello-egg vs /egg1, /hello-tegg) across benchmarks and scripts
    • StackUtil signature change impact on callers throughout repo
    • New fallback stack capture behavior across Node.js versions
    • package.json beta dependency intent and module type implications
    • Newly added tests and potential platform-specific flakiness

Possibly related PRs

  • deps: use oxfmt 0.8 #5633 — touches same utils area (packages/core/src/utils/index.ts) and likely overlaps in stack-trace/utility handling.

Poem

I hopped through stacks and filed my trace,
Switched controllers to TypeScript with grace,
Benchmarks hum, wrk drums a beat,
Routes aligned and tests skip their feet,
A rabbit's small patch — fast, neat, and fleet 🐰

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.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 "refactor: try to use utils.getCallSites instead" accurately describes the primary technical change in this changeset, which is the refactoring of the StackUtil.getCalleeFromStack method to use Node.js's util.getCallSites API instead of the previous approach. While the PR also includes substantial benchmark suite additions (new files, configuration, and a run script), these are supporting work to validate the refactoring. The title correctly focuses on the core functional change and is clear, concise, and specific enough for a teammate to understand the primary objective when scanning commit history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch use-nodejs-getCallSites

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
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 primarily focuses on enhancing stack trace utility and introducing performance benchmarking. The getCalleeFromStack method has been refactored to leverage modern Node.js util.getCallSites for more efficient stack frame capture, ensuring robust fallback for broader compatibility. Concurrently, a new HTTP benchmark suite, fully migrated to TypeScript, has been added to systematically compare the performance characteristics of tegg HttpController and egg router Controller, providing data-driven insights into their efficiency.

Highlights

  • Refactor Stack Trace Utility: The StackUtil.getCalleeFromStack method has been refactored to conditionally leverage util.getCallSites for capturing stack frames, providing a more efficient and direct approach when available, while maintaining a robust fallback to Error.captureStackTrace for broader compatibility.
  • Introduce HTTP Benchmark Suite: A new HTTP benchmark suite has been added under tegg/benchmark/http. This suite is designed to systematically compare the performance of tegg HttpController against egg router Controller across different Node.js versions.
  • Benchmark Suite TypeScript Migration: The newly introduced benchmark suite is fully implemented in TypeScript, including controllers, router definitions, and configuration files, replacing previous JavaScript counterparts to align with modern development practices.
  • Enhanced StackUtil Testing: A comprehensive new test file, tegg/core/common-util/test/StackUtil.test.ts, has been added to provide extensive test coverage for the getCalleeFromStack utility, ensuring its reliability across various call contexts and scenarios.
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.

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 refactors stack trace retrieval to use the more efficient util.getCallSites where available, and adds a comprehensive benchmark suite to compare performance between tegg HttpController and egg router Controller. The changes are a good improvement, especially the performance optimization and the addition of benchmarks. I've found a critical issue that could lead to a crash, a few high-severity issues including a type error and a test suite misconfiguration, and some medium-severity suggestions for improving code clarity. Please see my detailed comments.

@cloudflare-workers-and-pages
Copy link

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

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: b6c5a64
Status: ✅  Deploy successful!
Preview URL: https://10f5ca66.egg-cci.pages.dev
Branch Preview URL: https://use-nodejs-getcallsites.egg-cci.pages.dev

View logs

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 41.66667% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.43%. Comparing base (9e05322) to head (b6c5a64).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
tegg/core/common-util/src/StackUtil.ts 41.66% 17 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5665      +/-   ##
==========================================
- Coverage   87.60%   87.43%   -0.18%     
==========================================
  Files         561      561              
  Lines       10912    10931      +19     
  Branches     1231     1238       +7     
==========================================
- Hits         9559     9557       -2     
- Misses       1272     1290      +18     
- Partials       81       84       +3     

☔ 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

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

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: b6c5a64
Status: ✅  Deploy successful!
Preview URL: https://04650ef4.egg-v3.pages.dev
Branch Preview URL: https://use-nodejs-getcallsites.egg-v3.pages.dev

View logs

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 refactors the StackUtil implementation to use Node.js's new util.getCallSites() API with fallback to the legacy Error stack trace approach, adds comprehensive test coverage, and updates the tegg HTTP benchmark to use modern TypeScript and ESM modules. The PR also includes documentation improvements with benchmark results.

Key changes:

  • Modernizes StackUtil to use util.getCallSites() with legacy fallback
  • Adds comprehensive test coverage for StackUtil with 13 test cases
  • Converts tegg benchmark from CommonJS to TypeScript/ESM
  • Updates benchmark dependencies to beta versions

Reviewed Changes

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

Show a summary per file
File Description
tegg/core/common-util/test/StackUtil.test.ts New comprehensive test suite for StackUtil with 13 test cases covering various scenarios
tegg/core/common-util/src/StackUtil.ts Refactors getCalleeFromStack to use util.getCallSites() with legacy fallback, adds JSDoc
tegg/benchmark/http/run.sh New benchmark runner script for automated performance testing
tegg/benchmark/http/package.json Updates dependencies to beta versions and adds build/bench scripts
tegg/benchmark/http/config/plugin.js Removed - tegg plugins now integrated into main egg package
tegg/benchmark/http/config/config.default.ts New TypeScript config replacing CommonJS version
tegg/benchmark/http/config/config.default.js Removed - replaced by TypeScript version
tegg/benchmark/http/app/router.ts New TypeScript router replacing CommonJS version
tegg/benchmark/http/app/router.js Removed - replaced by TypeScript version
tegg/benchmark/http/app/controller/template/egg_controller_1.ts New TypeScript controller with version info
tegg/benchmark/http/app/controller/template/egg_controller_1.js Removed - replaced by TypeScript version
tegg/benchmark/http/app/controller/FooTeggController.ts Updates import path and response to include version info
tegg/benchmark/http/README.md New comprehensive benchmark documentation with results
tegg/benchmark/http/.gitignore New gitignore for generated files
packages/utils/src/import.ts Adds clarifying comment about EGG_TS_ENABLE behavior
packages/core/src/utils/index.ts Updates egg-mock GitHub URL to 5.x branch

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: 4

🧹 Nitpick comments (4)
packages/utils/src/import.ts (1)

55-61: Avoid assuming Node ≥ 22 implies TS runtime support.

Relying on Node version alone can resolve to .ts files without a loader, breaking imports. Prefer checking only loader-registered extensions/env toggles.

Apply:

-      process.env.EGG_TS_ENABLE === 'true' ||
-      parseInt(process.versions.node.split('.', 1)[0], 10) >= 22;
+      process.env.EGG_TS_ENABLE === 'true';

Optionally, add a loader/CLI check (e.g., EGG_TS_LOADER set by eggctl/oxc/ts-node) if you want an explicit runtime toggle.

Would you confirm that eggctl (or your runtime) always registers a TS loader before importModule is used? If not, the Node ≥ 22 branch risks runtime failures.

tegg/benchmark/http/config/config.default.ts (1)

1-5: Drop redundant type cast for clarity.

defineConfig returns PartialEggConfig; the final cast is unnecessary.

-export default defineConfig({
-  keys: 'tegg_benchmark',
-}) as PartialEggConfig;
+export default defineConfig({
+  keys: 'tegg_benchmark',
+});
tegg/benchmark/http/package.json (1)

3-3: Tighten scripts and deps for the benchmark package.

  • Move build-time only packages to devDependencies: @eggjs/tsconfig, @types/node.
  • dev uses egg-bin but it's not declared. Either add it or replace with an eggctl dev equivalent if available.
  • Mark package as private to avoid accidental publish.
  • If /app/controller uses JSON import attributes requiring Node ≥ 22, declare engines.

Suggested patch:

 {
   "name": "tegg_benchmark",
   "type": "module",
+  "private": true,
+  "engines": {
+    "node": ">=18" 
+  },
   "scripts": {
     "start": "eggctl start --workers 4",
     "stop": "eggctl stop",
-    "dev": "egg-bin dev",
+    "dev": "egg-bin dev",
     "build": "tsc",
     "prebench": "npm run build",
     "bench": "sh run.sh"
   },
   "dependencies": {
-    "@eggjs/tsconfig": "beta",
-    "@types/node": "24",
     "egg": "beta"
   },
   "devDependencies": {
     "@eggjs/bin": "beta",
     "@eggjs/scripts": "beta",
-    "typescript": "5"
+    "typescript": "5",
+    "@types/node": "24",
+    "@eggjs/tsconfig": "beta",
+    "egg-bin": "latest"
   }
 }

Adjust engines.node to >=22 if keeping with { type: 'json' }.

Please confirm whether egg-bin is expected to be available via the monorepo toolchain; if not, the dev script will fail without adding it here.

Also applies to: 5-11, 13-16, 18-21

tegg/core/common-util/src/StackUtil.ts (1)

55-66: Nit: logging label suggests util.getCallSites even on fallback.

Consider changing the prefix to a neutral “stacks:” to avoid confusion when the fallback path is taken.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d9cb88 and 3539a20.

📒 Files selected for processing (16)
  • packages/core/src/utils/index.ts (1 hunks)
  • packages/utils/src/import.ts (1 hunks)
  • tegg/benchmark/http/.gitignore (1 hunks)
  • tegg/benchmark/http/README.md (1 hunks)
  • tegg/benchmark/http/app/controller/FooTeggController.ts (1 hunks)
  • tegg/benchmark/http/app/controller/template/egg_controller_1.js (0 hunks)
  • tegg/benchmark/http/app/controller/template/egg_controller_1.ts (1 hunks)
  • tegg/benchmark/http/app/router.js (0 hunks)
  • tegg/benchmark/http/app/router.ts (1 hunks)
  • tegg/benchmark/http/config/config.default.js (0 hunks)
  • tegg/benchmark/http/config/config.default.ts (1 hunks)
  • tegg/benchmark/http/config/plugin.js (0 hunks)
  • tegg/benchmark/http/package.json (1 hunks)
  • tegg/benchmark/http/run.sh (1 hunks)
  • tegg/core/common-util/src/StackUtil.ts (2 hunks)
  • tegg/core/common-util/test/StackUtil.test.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • tegg/benchmark/http/config/plugin.js
  • tegg/benchmark/http/app/router.js
  • tegg/benchmark/http/app/controller/template/egg_controller_1.js
  • tegg/benchmark/http/config/config.default.js
🧰 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/utils/src/import.ts
  • packages/core/src/utils/index.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/utils/src/import.ts
  • packages/core/src/utils/index.ts
  • tegg/core/common-util/src/StackUtil.ts
  • tegg/core/common-util/test/StackUtil.test.ts
  • tegg/benchmark/http/app/controller/template/egg_controller_1.ts
  • tegg/benchmark/http/app/controller/FooTeggController.ts
  • tegg/benchmark/http/app/router.ts
  • tegg/benchmark/http/config/config.default.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/utils/src/import.ts
  • packages/core/src/utils/index.ts
tegg/**/src/**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Do not use CommonJS APIs (require, module.exports); author code as ESM

Files:

  • tegg/core/common-util/src/StackUtil.ts
tegg/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Use .js extensions in ESM import specifiers in TypeScript source

Files:

  • tegg/core/common-util/src/StackUtil.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suites

Files:

  • tegg/core/common-util/test/StackUtil.test.ts
🧠 Learnings (3)
📚 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 : Set package.json "type": "module" (ESM only; no CommonJS) in all tegg packages

Applied to files:

  • tegg/benchmark/http/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: Run build, test, and versioning commands from the monorepo root (Egg.js repo), not from tegg/

Applied to files:

  • tegg/benchmark/http/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:

  • tegg/benchmark/http/package.json
🧬 Code graph analysis (5)
tegg/core/common-util/src/StackUtil.ts (1)
plugins/multipart/test/fixtures/apps/multipart-for-await/app/controller/upload.js (1)
  • util (6-6)
tegg/core/common-util/test/StackUtil.test.ts (1)
tegg/core/common-util/src/StackUtil.ts (1)
  • StackUtil (15-98)
tegg/benchmark/http/app/controller/template/egg_controller_1.ts (1)
tools/egg-bin/test/fixtures/example-ts-cluster/node_modules/egg/index.js (1)
  • pkg (1-1)
tegg/benchmark/http/app/controller/FooTeggController.ts (1)
packages/egg/src/index.ts (2)
  • HTTPMethod (157-157)
  • HTTPMethodEnum (158-158)
tegg/benchmark/http/config/config.default.ts (1)
packages/egg/src/lib/define.ts (1)
  • defineConfig (29-31)
🪛 Shellcheck (0.11.0)
tegg/benchmark/http/run.sh

[warning] 5-5: pid appears unused. Verify use (or export if used externally).

(SC2034)

⏰ 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). (3)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test bin (ubuntu-latest, 22, 0/3)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (14)
tegg/benchmark/http/.gitignore (1)

1-3: LGTM for benchmark artifacts ignore.

Good to ignore TS outputs and logs in this subpackage.

tegg/benchmark/http/app/controller/FooTeggController.ts (2)

11-11: String format looks fine.

Version-tagged greeting is straightforward and stable.


2-2: The code is correct; no changes needed.

The root package.json specifies "engines": { "node": ">=22.18.0" }. The with { type: 'json' } syntax is supported unflagged in Node 22.10.0 and later. Since the codebase explicitly targets Node ≥22.18.0, the import statement is compatible and no alternatives are required.

Likely an incorrect or invalid review comment.

tegg/core/common-util/src/StackUtil.ts (2)

24-27: API change verified; all call sites are compatible with optional parameter defaults.

The grep search confirms all 8 production usages explicitly specify stackIndex values (4 or 5), ensuring no callers depend on the default. The withLine default of false aligns with all existing calls. No breaking changes detected.


28-33: Review comment is inapplicable to this codebase.

The codebase explicitly requires Node >= 22.18.0, which is well above the minimum version where util.getCallSites() is available. The util.getCallSites() function was added in Node.js v22.9.0 and its types are available in @types/node from that version forward. The code already has a proper guard (if (typeof util.getCallSites === 'function')), the types are imported directly from 'node:util', and the fallback will never execute in the supported runtime environment. The review's concern about the fallback being used on older Node versions does not apply here.

Likely an incorrect or invalid review comment.

packages/core/src/utils/index.ts (1)

39-39: LGTM! Documentation updated to match current branch.

The URL reference correctly points to the 5.x branch, keeping the comment aligned with the current codebase structure.

tegg/core/common-util/test/StackUtil.test.ts (2)

1-137: LGTM! Comprehensive test coverage.

The test suite is well-structured with helper functions to create predictable stack frames, and covers essential scenarios including line number formatting, stack index handling, nested calls, edge cases, and path validation.


148-171: LGTM! Good coverage of class method scenarios.

The tests appropriately cover both instance and static method call patterns.

tegg/benchmark/http/app/router.ts (1)

1-5: LGTM! Clean TypeScript router implementation.

The router correctly registers the /hello-egg endpoint with proper TypeScript typing for the Application parameter.

tegg/benchmark/http/README.md (1)

1-130: LGTM! Comprehensive benchmark documentation.

The documentation provides clear setup instructions and detailed benchmark results across multiple Node.js versions with system information, making it easy to understand and reproduce the benchmarks.

tegg/benchmark/http/run.sh (2)

7-12: LGTM! Good practice to log system information.

Capturing OS, CPU model, speed, cores, Node.js version, and timestamp provides essential context for benchmark results.


14-33: LGTM! Well-structured benchmark execution.

The script appropriately waits for the server to start, verifies both endpoints with curl, and then runs comprehensive load tests with wrk.

tegg/benchmark/http/app/controller/template/egg_controller_1.ts (2)

1-2: LGTM! Modern import assertion syntax.

Using with { type: 'json' } follows the standardized import assertion syntax for JSON modules.


4-7: LGTM! Controller correctly returns version-tagged response.

The controller implementation is clean and correctly formats the response body with the egg version from package.json.

fengmk2 and others added 4 commits October 29, 2025 20:49
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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: 0

🧹 Nitpick comments (2)
plugins/schedule/test/customTypeError.test.ts (1)

8-9: Consider creating a tracking issue for this Windows flakiness.

The conditional skip is consistent with existing patterns in the codebase and pragmatically addresses CI flakiness. However, skipping reduces Windows test coverage for cluster-based scheduling behavior.

Consider:

  1. Creating a GitHub issue to track the root cause investigation (hook timeout suggests async cleanup or cluster startup timing issues on Windows)
  2. Investigating whether increasing the hook timeout or adjusting the cluster configuration could make the test stable on Windows
packages/egg/test/egg.test.ts (1)

199-200: Multiple Windows skips in this file suggest a systemic issue.

The conditional skip is consistent with the existing pattern used at lines 169, 184, 419, and 439. However, this file now has 5 test suites skipped on Windows, significantly reducing coverage for config dumping, timing, and context creation on that platform.

Since multiple tests in this file exhibit Windows flakiness with hook timeouts, consider:

  1. Creating a single tracking issue for Windows test stability in this suite
  2. Investigating whether a common infrastructure change (e.g., extended timeouts, improved cleanup, or CI-specific configuration) could address multiple skips
  3. Documenting any known Windows-specific limitations in the test setup utilities
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0a8a88 and b6c5a64.

📒 Files selected for processing (3)
  • packages/egg/test/egg.test.ts (1 hunks)
  • plugins/schedule/test/customTypeError.test.ts (1 hunks)
  • tegg/core/common-util/test/StackUtil.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tegg/core/common-util/test/StackUtil.test.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/**/test/**/*.test.ts

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

packages/**/test/**/*.test.ts: Name test files as test/**/*.test.ts and run them with Vitest
Use import { describe, it } from 'vitest' in tests
Use Node.js built-in assert module for test assertions

Files:

  • packages/egg/test/egg.test.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/test/egg.test.ts
  • plugins/schedule/test/customTypeError.test.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suites

Files:

  • packages/egg/test/egg.test.ts
  • plugins/schedule/test/customTypeError.test.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/test/egg.test.ts
  • plugins/schedule/test/customTypeError.test.ts
{packages/!(cookies)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Vitest test files must follow the naming pattern test/**/*.test.ts

Files:

  • packages/egg/test/egg.test.ts
  • plugins/schedule/test/customTypeError.test.ts
{packages/**/test/**,plugins/**/test/**}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Node.js assert for assertions in Vitest tests

Files:

  • packages/egg/test/egg.test.ts
  • plugins/schedule/test/customTypeError.test.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: For features affecting HTTP or process orchestration, add regression tests that exercise both the CommonJS and TypeScript example apps
📚 Learning: 2025-10-23T17:37:37.567Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.567Z
Learning: Applies to tegg/plugin/*/{test,tests}/**/*.ts : Add Vitest tests for plugins using eggjs/mock; tests will be discovered by the root vitest config

Applied to files:

  • packages/egg/test/egg.test.ts
⏰ 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). (20)
  • GitHub Check: Test (macos-latest, 24, 1/5)
  • GitHub Check: Test (windows-latest, 24, 2/5)
  • GitHub Check: Test (macos-latest, 24, 4/5)
  • GitHub Check: Test (ubuntu-latest, 22, 3/5)
  • GitHub Check: Test (windows-latest, 22, 2/5)
  • GitHub Check: Test (macos-latest, 24, 5/5)
  • GitHub Check: Test (windows-latest, 22, 3/5)
  • GitHub Check: Test (ubuntu-latest, 22, 2/5)
  • GitHub Check: Test (windows-latest, 22, 5/5)
  • GitHub Check: Test (macos-latest, 24, 2/5)
  • GitHub Check: Test (macos-latest, 22, 2/5)
  • GitHub Check: Test (windows-latest, 24, 1/5)
  • GitHub Check: Test (ubuntu-latest, 24, 2/5)
  • GitHub Check: Test (ubuntu-latest, 24, 1/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 0/3)
  • GitHub Check: Test bin (windows-latest, 22, 1/3)
  • GitHub Check: Test bin (windows-latest, 22, 0/3)
  • GitHub Check: Test bin (windows-latest, 22, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 22, 1/3)
  • GitHub Check: typecheck

@fengmk2 fengmk2 merged commit 5fd3030 into next Oct 29, 2025
48 of 52 checks passed
@fengmk2 fengmk2 deleted the use-nodejs-getCallSites branch October 29, 2025 14:54
@coderabbitai coderabbitai bot mentioned this pull request Oct 31, 2025
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