-
Notifications
You must be signed in to change notification settings - Fork 111
chore: fix flaky main thread tests #1377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fix flaky main thread tests #1377
Conversation
|
📝 WalkthroughWalkthroughAn import statement for the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
⏰ 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). (4)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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)
packages/web-platform/web-tests/shell-project/mainthread-test.ts (2)
7-7: Consider using a more direct import path.The nested
node_modulespath in the import is unusual and potentially fragile. This could break if the dependency structure changes or in different installation contexts.Consider importing directly from the package:
-import { initWasm } from '@lynx-js/web-mainthread-apis/node_modules/@lynx-js/web-style-transformer'; +import { initWasm } from '@lynx-js/web-style-transformer';Or verify if this nested import is intentional due to specific dependency resolution requirements.
8-8: Good fix for flaky tests, consider adding error handling.Initializing WebAssembly synchronously before test setup is a solid approach to fix race condition issues that could cause flaky tests. The top-level await ensures WebAssembly is ready before any test logic runs.
Consider adding error handling to make failures more explicit:
-await initWasm(); +try { + await initWasm(); +} catch (error) { + console.error('Failed to initialize WebAssembly:', error); + throw error; +}
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/web-platform/web-tests/shell-project/mainthread-test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PupilTong
PR: lynx-family/lynx-stack#1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
🧬 Code Graph Analysis (1)
packages/web-platform/web-tests/shell-project/mainthread-test.ts (1)
packages/web-platform/web-style-transformer/index.js (1)
initWasm(3-23)
packages/web-platform/web-tests/shell-project/mainthread-test.ts
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #1377 will not alter performanceComparing Summary
|
React Example#3451 Bundle Size — 235.18KiB (0%).cb9feea(current) vs a4ee4fd main#3450(baseline) Bundle metrics
|
| Current #3451 |
Baseline #3450 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
156 |
156 |
|
63 |
63 |
|
45.94% |
45.94% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #3451 |
Baseline #3450 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
89.42KiB |
89.42KiB |
Bundle analysis report Branch PupilTong:p/hw/fix-main-thread-t... Project dashboard
Generated by RelativeCI Documentation Report issue
Web Explorer#3441 Bundle Size — 352.53KiB (0%).cb9feea(current) vs a4ee4fd main#3440(baseline) Bundle metrics
Bundle size by type
|
| Current #3441 |
Baseline #3440 |
|
|---|---|---|
226.4KiB |
226.4KiB |
|
94.29KiB |
94.29KiB |
|
31.83KiB |
31.83KiB |
Bundle analysis report Branch PupilTong:p/hw/fix-main-thread-t... Project dashboard
Generated by RelativeCI Documentation Report issue
Summary by CodeRabbit