Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a workspace script runner and top-level Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Runner as run-workspace-scripts.mjs
participant WS as pnpm-workspace.yaml
participant FS as Filesystem
participant Sub as Subprocess/npm
Dev->>Runner: invoke script name (e.g. clean)
Runner->>WS: read workspace patterns
Runner->>FS: expand patterns & enumerate package dirs
Runner->>FS: read each workspace `package.json`
alt workspace has script
Runner->>Sub: spawn `npm run --silent <script>` (inherit stdio)
Sub-->>Runner: exit code
Runner->>Dev: propagate non-zero exit code (fail early)
else no script found
Runner->>Dev: print "No workspace scripts found for \"<script>\""
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Deploying egg with
|
| Latest commit: |
f9bd11d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2260a69f.egg-cci.pages.dev |
| Branch Preview URL: | https://agent-egg-dev-8ea216e0.egg-cci.pages.dev |
Deploying egg-v3 with
|
| Latest commit: |
f9bd11d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2bb84efc.egg-v3.pages.dev |
| Branch Preview URL: | https://agent-egg-dev-8ea216e0.egg-v3.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request refactors test scripts and improves test reliability across several packages, notably by implementing dynamic socket paths in cluster tests and adding a manifest retrieval helper in tegg tests. Feedback recommends caching the manifest extension in the new helper to prevent redundant, expensive generation during test execution.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #5908 +/- ##
==========================================
- Coverage 85.04% 85.03% -0.02%
==========================================
Files 665 665
Lines 19100 19100
Branches 3716 3716
==========================================
- Hits 16244 16242 -2
- Misses 2463 2465 +2
Partials 393 393 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Stabilizes CI benchmark-related tests and workspace scripts by reducing timing flakiness and improving determinism around manifest generation and unix-socket readiness.
Changes:
- Update root
clean/pretestscripts to run reliably under workspace runners by delegating viapnpm -r(excluding the workspace root). - Make cluster unix-socket listen-path test deterministic by using a unique tmp socket path and waiting until the socket is connectable before issuing requests.
- Reduce schedule stop-test flakiness by widening the interval fixture timing and avoiding failures when the log file is not created.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds root clean and adjusts pretest to delegate across workspaces via pnpm -r excluding @eggjs/monorepo. |
packages/cluster/test/app_worker.test.ts |
Adds unix-socket readiness polling and uses a unique tmp socket path for the listen-path test. |
packages/cluster/test/fixtures/apps/app-listen-path/config/config.default.js |
Allows overriding the socket path via EGG_APP_LISTEN_PATH_SOCKET to support deterministic tests. |
plugins/schedule/test/stop.test.ts |
Avoids reading a non-existent log file by checking existence first. |
plugins/schedule/test/fixtures/stop/app/schedule/interval.js |
Increases schedule interval to reduce timing-related flakes. |
tegg/plugin/tegg/test/ManifestCollection.test.ts |
Adds a fallback to generateManifest() when the tegg manifest extension is not present in the loaded manifest. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/run-workspace-scripts.mjs (1)
42-44: ⚡ Quick winMake workspace traversal order deterministic
readdirSync()order can vary by filesystem. Sorting here makesclean/pretestexecution stable across CI environments.Deterministic ordering patch
return readdirSync(baseDir, { withFileTypes: true }) .filter((entry) => entry.isDirectory()) + .sort((a, b) => a.name.localeCompare(b.name)) .map((entry) => join(baseDir, entry.name));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/run-workspace-scripts.mjs` around lines 42 - 44, The directory list produced by readdirSync is non-deterministic across filesystems; in the block that calls readdirSync(baseDir, { withFileTypes: true }).filter(...).map(...), sort the Dirent entries by entry.name (e.g., using localeCompare) before mapping to join(baseDir, entry.name) so workspace traversal (and tasks like clean/pretest) runs in a stable, deterministic order across CI.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@scripts/run-workspace-scripts.mjs`:
- Around line 42-44: The directory list produced by readdirSync is
non-deterministic across filesystems; in the block that calls
readdirSync(baseDir, { withFileTypes: true }).filter(...).map(...), sort the
Dirent entries by entry.name (e.g., using localeCompare) before mapping to
join(baseDir, entry.name) so workspace traversal (and tasks like clean/pretest)
runs in a stable, deterministic order across CI.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b7649e46-0eab-4be8-ab25-46939e3e87b7
📒 Files selected for processing (3)
package.jsonscripts/run-workspace-scripts.mjstegg/plugin/tegg/test/ManifestCollection.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- package.json
- tegg/plugin/tegg/test/ManifestCollection.test.ts
There was a problem hiding this comment.
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 `@plugins/schedule/test/stop.test.ts`:
- Around line 34-46: The test captures a baseline before the interval callback
runs because it waits for 'egg-schedule.log' loader entry; change it to wait for
the actual "interval" log in stop-web.log before closing the app so
beforeCloseCount reflects a real interval execution (use waitForLog(logPath,
'interval', longerTimeout) or equivalent), then proceed to call await
app!.close(); keep the later sleep/assert logic but increase the polling/timeout
value to be longer than the 5s schedule interval to avoid flaky failures.
🪄 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: 51db55da-83a7-4c0e-89c8-d19abd113800
📒 Files selected for processing (4)
packages/cluster/test/app_worker.test.tsplugins/schedule/test/fixtures/stop/app/schedule/interval.jsplugins/schedule/test/stop.test.tsscripts/run-workspace-scripts.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
- plugins/schedule/test/fixtures/stop/app/schedule/interval.js
- scripts/run-workspace-scripts.mjs
Summary
Validation
Summary by CodeRabbit
New Features
Tests
Chores