Conversation
🦋 Changeset detectedLatest commit: 0878692 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughAdds element-level FiberElement API instrumentation that logs structured console.alog entries, wires it into alog initialization and test setup, expands tests/snapshots to expect the logs, and appends dev-only troubleshooting hints to certain patch/snapshot error messages; also adds guarded pretty-printed patch/hydration logging. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/react/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (16)📓 Common learnings📚 Learning: 2025-10-29T10:28:27.519ZApplied to files:
📚 Learning: 2025-11-04T10:15:14.965ZApplied to files:
📚 Learning: 2025-09-23T08:54:39.966ZApplied to files:
📚 Learning: 2025-12-30T10:02:23.790ZApplied to files:
📚 Learning: 2025-12-29T11:26:09.487ZApplied to files:
📚 Learning: 2025-08-11T05:57:18.212ZApplied to files:
📚 Learning: 2025-12-29T11:26:09.487ZApplied to files:
📚 Learning: 2025-08-12T16:09:32.413ZApplied to files:
📚 Learning: 2025-09-18T04:43:54.426ZApplied to files:
📚 Learning: 2025-08-27T12:42:01.095ZApplied to files:
📚 Learning: 2025-08-13T09:20:00.936ZApplied to files:
📚 Learning: 2025-08-06T13:28:57.182ZApplied to files:
📚 Learning: 2025-09-18T04:43:54.426ZApplied to files:
📚 Learning: 2025-10-11T06:16:12.517ZApplied to files:
📚 Learning: 2025-09-12T09:43:04.847ZApplied to files:
⏰ 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)
🔇 Additional comments (9)
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 |
5f45d83 to
556b08d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/react/runtime/src/alog/elementPAPICall.ts (2)
55-58: Non-null assertion may throw if element not in map.
formatFiberElementusesfiberElementMap.get(fiberElement)!which will fail if the element isn't in the map. While current usage guards withfiberElementMap.has(), a defensive check would be safer.🔎 Optional defensive refactor
function formatFiberElement(fiberElement: FiberElement): string { - const fiberElementInfo = fiberElementMap.get(fiberElement)!; + const fiberElementInfo = fiberElementMap.get(fiberElement); + if (!fiberElementInfo) { + return `<unknown element>`; + } return `${fiberElementInfo.tag}#${fiberElementInfo.uniqueId}`; }
111-114: Non-null assertions on__GetTagand__GetElementUniqueIDcould throw.If these APIs are not available in
globalWithIndex, accessing them with!will throw. Consider adding a guard or fallback.🔎 Optional defensive refactor
fiberElementMap.set(result as FiberElement, { - tag: originalFiberElementPAPIs['__GetTag']!(result as FiberElement) as string, - uniqueId: originalFiberElementPAPIs['__GetElementUniqueID']!(result as FiberElement) as number, + tag: originalFiberElementPAPIs['__GetTag']?.(result as FiberElement) as string ?? 'unknown', + uniqueId: originalFiberElementPAPIs['__GetElementUniqueID']?.(result as FiberElement) as number ?? -1, });Based on learnings, the team prioritizes performance and compile-time safety over defensive runtime checks. If
__GetTagand__GetElementUniqueIDare guaranteed to be present when Create* APIs exist, this can be safely ignored.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.changeset/cruel-feet-grow.mdpackages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/alog/index.tspackages/react/runtime/src/lifecycle/patch/updateMainThread.tspackages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/testing-library/src/vitest-global-setup.js
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,ts,tsx}: Follow eslint rules as configured in eslint.config.js including React and TypeScript specific rules
Follow code formatting rules specified in .dprint.jsonc and biome.jsonc
Files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/runtime/src/lifecycle/patch/updateMainThread.tspackages/react/runtime/src/alog/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with the configuration specified in tsconfig.json
Files:
packages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/src/lifecycle/patch/updateMainThread.tspackages/react/runtime/src/alog/index.ts
packages/react/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use JSX syntax and ReactLynx components in React component files within packages/react/
Files:
packages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/src/lifecycle/patch/updateMainThread.tspackages/react/runtime/src/alog/index.ts
**/__test__/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (AGENTS.md)
**/__test__/**/*.{ts,tsx,js}: Place test files in test/ directories adjacent to source files
Use vitest-based unit tests as configured in vitest.config.ts
Files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
🧠 Learnings (34)
📓 Common learnings
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: The `web-elements` package provides a Native UI implementation for the LynxJS Web Platform using Web Components built on the `element-reactive` reactive framework
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/testing-library/src/__tests__/alog.test.jsx.changeset/cruel-feet-grow.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/all.ts : Export new components in `src/elements/all.ts` and add export configuration to `package.json` under `exports` for both types and default
Applied to files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/runtime/src/alog/index.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Group DOM updates to minimize layout thrashing in web component implementations
Applied to files:
packages/react/testing-library/src/vitest-global-setup.js
📚 Learning: 2025-09-28T08:46:43.177Z
Learnt from: f0rdream
Repo: lynx-family/lynx-stack PR: 1835
File: packages/react/worklet-runtime/src/workletRuntime.ts:52-55
Timestamp: 2025-09-28T08:46:43.177Z
Learning: The legacy worklet path with `_lepusWorkletHash` in `packages/react/worklet-runtime/src/workletRuntime.ts` is preserved for compatibility with MTS (Mini-app Threading Service) that doesn't support Initial Frame Rendering. This path will not be touched in current implementations.
Applied to files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/react/testing-library/src/vitest-global-setup.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsx.changeset/cruel-feet-grow.md
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Minimize heavy computation in `attributeChangedCallback` as these elements run on the main thread
Applied to files:
packages/react/testing-library/src/vitest-global-setup.js
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : When creating new elements, inherit from `Element` via `Component` decorator and use reactive utilities provided by `element-reactive`
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/index.ts : Ensure `index.ts` files and complex logic have clear, descriptive comments matching the implementation
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsx.changeset/cruel-feet-grow.md
📚 Learning: 2025-12-26T05:10:01.595Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.595Z
Learning: Applies to packages/react/components/**/*.{ts,tsx} : Optimize component library in packages/react/components/ using ReactLynx syntax
Applied to files:
packages/react/runtime/src/lynx/tt.ts.changeset/cruel-feet-grow.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Create a separate spec file for new components (e.g., `tests/x-webview.spec.ts`) instead of adding to the monolithic `web-elements.spec.ts`
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Use Playwright for all E2E and functional tests with standard assertions like `expect(locator).toBeVisible()`, `expect(locator).toHaveCSS()`, and `diffScreenShot` for screenshot comparisons
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : When a component makes external requests (e.g., via `iframe` or `fetch`), mock them using `page.route` in Playwright tests to ensure tests are hermetic and fast
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-13T09:20:00.936Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1502
File: packages/react/testing-library/types/entry.d.ts:71-71
Timestamp: 2025-08-13T09:20:00.936Z
Learning: In lynx-js/react testing library, wrapper components must have children as a required prop because they are always called with `h(WrapperComponent, null, innerElement)` where innerElement is passed as children. The type `React.JSXElementConstructor<{ children: React.ReactNode }>` correctly requires children to be mandatory.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-10-11T06:16:12.517Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1820
File: packages/web-platform/web-tests/tests/react.spec.ts:834-856
Timestamp: 2025-10-11T06:16:12.517Z
Learning: In packages/web-platform/web-tests/tests/react.spec.ts, the tests `basic-bindmouse` and `basic-mts-bindtouchstart` are NOT duplicates despite having similar test structures. They test different event types: `basic-bindmouse` validates mouse events (mousedown, mouseup, mousemove) with mouse-specific properties (button, buttons, x, y, pageX, pageY, clientX, clientY), while `basic-mts-bindtouchstart` validates touch events (touchstart) with touch arrays (touches, targetTouches, changedTouches). The similar test structure is coincidental and follows testing conventions.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-11-06T01:17:14.493Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/tools/Runtime/ListConsole.ts:48-60
Timestamp: 2025-11-06T01:17:14.493Z
Learning: In the Lynx runtime, console messages always include stack traces, so defensive null checks for `stackTrace.callFrames` in console message handling code are not required.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
.changeset/cruel-feet-grow.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/cruel-feet-grow.md
📚 Learning: 2025-12-26T05:10:01.595Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.595Z
Learning: Use changeset tool with `pnpm changeset` to document changes before contribution
Applied to files:
.changeset/cruel-feet-grow.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/cruel-feet-grow.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
.changeset/cruel-feet-grow.mdpackages/react/runtime/src/lifecycle/patch/updateMainThread.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
.changeset/cruel-feet-grow.md
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.
Applied to files:
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
📚 Learning: 2025-07-18T04:27:18.291Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.
Applied to files:
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
📚 Learning: 2025-09-28T07:52:03.601Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts:151-154
Timestamp: 2025-09-28T07:52:03.601Z
Learning: There are two different registerUpdateDataHandler functions in the lynx-stack codebase:
1. Main thread version in packages/web-platform/web-worker-runtime/src/mainThread/crossThreadHandlers/registerUpdateDataHandler.ts takes (mainThreadRpc: Rpc, backgroundThreadRpc: Rpc, runtime: MainThreadGlobalThis)
2. Background thread version in packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/crossThreadHandlers/registerUpdateDataHandler.ts takes only (rpc: Rpc, tt: NativeTTObject)
Applied to files:
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
📚 Learning: 2025-09-28T07:52:03.601Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts:151-154
Timestamp: 2025-09-28T07:52:03.601Z
Learning: There are two different registerUpdateDataHandler functions in the lynx-stack codebase:
1. Main thread version in packages/web-platform/web-worker-runtime/src/mainThread/crossThreadHandlers/registerUpdateDataHandler.ts takes (mainThreadRpc: Rpc, backgroundThreadRpc: Rpc, runtime: MainThreadGlobalThis)
2. Background thread version in packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/crossThreadHandlers/registerUpdateDataHandler.ts takes only (rpc: Rpc, tt: any)
Applied to files:
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
🧬 Code graph analysis (3)
packages/react/testing-library/src/vitest-global-setup.js (1)
packages/react/runtime/src/alog/elementPAPICall.ts (1)
initElementPAPICallAlog(49-133)
packages/react/runtime/src/lifecycle/patch/updateMainThread.ts (1)
packages/react/runtime/src/debug/formatPatch.ts (1)
prettyFormatSnapshotPatch(8-28)
packages/react/runtime/src/alog/index.ts (2)
packages/react/runtime/src/alog/render.ts (1)
initRenderAlog(11-32)packages/react/runtime/src/alog/elementPAPICall.ts (1)
initElementPAPICallAlog(49-133)
🔇 Additional comments (12)
.changeset/cruel-feet-grow.md (1)
1-5: LGTM!The changeset is properly formatted with a patch version bump for
@lynx-js/react. The description clearly documents the new dual-thread commutation logging feature and its activation conditions.packages/react/runtime/src/lynx/tt.ts (1)
91-103: LGTM!The conditional logging block is well-guarded with the
__ALOG__check and uses optional chaining onconsole.alog. The structured JSON output with the parsedlepusSideis helpful for debugging hydration issues.packages/react/runtime/src/lifecycle/patch/updateMainThread.ts (2)
11-11: LGTM!Import of
prettyFormatSnapshotPatchis correctly added to support the new debug logging.
41-61: LGTM!The refactoring to extract
parsedDataimproves readability, and the conditional logging block follows the same pattern astt.ts. UsingprettyFormatSnapshotPatchprovides human-readable patch data in the debug output.packages/react/runtime/src/alog/index.ts (1)
4-9: LGTM!The new
initElementPAPICallAlogis correctly imported and invoked afterinitRenderAlog(). Using the defaultglobalThisparameter is appropriate for the runtime context.packages/react/testing-library/src/vitest-global-setup.js (2)
11-11: LGTM!Import correctly uses the compiled
libpath for the testing library context.
112-113: LGTM!Correctly passes
targettoinitElementPAPICallAlogto patch the main thread globals in the testing environment rather than using the defaultglobalThis.packages/react/runtime/__test__/alog/elementPAPICall.test.js (1)
1-49: LGTM!Good test coverage for the ElementPAPICall alogging. The test correctly:
- Switches to the main thread environment
- Mocks
console.alogbefore initialization- Exercises various element creation and manipulation APIs
- Verifies the exact sequence and format of log messages
packages/react/testing-library/src/__tests__/alog.test.jsx (3)
38-172: LGTM!The extended snapshot comprehensively captures the new ElementPAPICall logs and BTS ↔ MTS communication logs. The sequence of 37 API calls covers element creation, manipulation, events, and lifecycle events.
188-235: LGTM!The background thread snapshot correctly captures the new
MTS -> BTS OnLifecycleEventlog with the pretty-printed hydration data structure.
256-301: LGTM!The state change scenario snapshot correctly verifies that the logging continues to work after initial hydration, showing the
SetAttributeoperation and subsequentFlushElementTreecalls.packages/react/runtime/src/alog/elementPAPICall.ts (1)
49-133: Well-structured logging instrumentation.The implementation correctly:
- Filters to only existing APIs before wrapping
- Preserves original API references for internal use
- Uses optional chaining on
console.alog- Provides readable formatted output for fiber elements and their IDs
- Integrates profiling support with
__PROFILE__guard
556b08d to
0fa7bfb
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/react/runtime/__test__/alog/elementPAPICall.test.js (2)
6-49: Consider adding test cleanup for better isolation.The test directly assigns
console.alog = vi.fn()without restoring it afterward. While this works for a single test, it may affect other tests if they share the same console object or if additional tests are added to this suite.🔎 Suggested cleanup pattern
+import { describe, it, vi, expect, afterEach } from 'vitest'; import { initElementPAPICallAlog } from '../../src/alog/elementPAPICall'; import { globalEnvManager } from '../utils/envManager'; -import { expect } from 'vitest'; describe('ElementPAPICall Alog', () => { + let originalAlog; + + afterEach(() => { + console.alog = originalAlog; + }); + it('should log ElementPAPICall as ALog', () => { globalEnvManager.switchToMainThread(); + originalAlog = console.alog; console.alog = vi.fn(); initElementPAPICallAlog();
1-4: Consolidate imports from the same module.
expectis imported separately from other vitest utilities.🔎 Suggested fix
-import { describe, it, vi } from 'vitest'; +import { describe, it, vi, expect } from 'vitest'; import { initElementPAPICallAlog } from '../../src/alog/elementPAPICall'; import { globalEnvManager } from '../utils/envManager'; -import { expect } from 'vitest';
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.changeset/cruel-feet-grow.mdpackages/react/runtime/__test__/alog/elementPAPICall.test.jspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/src/alog/index.tspackages/react/runtime/src/lifecycle/patch/updateMainThread.tspackages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/testing-library/src/vitest-global-setup.js
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/react/testing-library/src/vitest-global-setup.js
- packages/react/runtime/src/alog/index.ts
- .changeset/cruel-feet-grow.md
- packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with the configuration specified in tsconfig.json
Files:
packages/react/runtime/src/lynx/tt.tspackages/react/runtime/src/alog/elementPAPICall.ts
packages/react/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use JSX syntax and ReactLynx components in React component files within packages/react/
Files:
packages/react/runtime/src/lynx/tt.tspackages/react/runtime/src/alog/elementPAPICall.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,ts,tsx}: Follow eslint rules as configured in eslint.config.js including React and TypeScript specific rules
Follow code formatting rules specified in .dprint.jsonc and biome.jsonc
Files:
packages/react/runtime/src/lynx/tt.tspackages/react/runtime/src/alog/elementPAPICall.tspackages/react/runtime/__test__/alog/elementPAPICall.test.js
**/__test__/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (AGENTS.md)
**/__test__/**/*.{ts,tsx,js}: Place test files in test/ directories adjacent to source files
Use vitest-based unit tests as configured in vitest.config.ts
Files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
🧠 Learnings (22)
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-12-26T05:10:01.595Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.595Z
Learning: Applies to packages/react/components/**/*.{ts,tsx} : Optimize component library in packages/react/components/ using ReactLynx syntax
Applied to files:
packages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-09-28T08:46:43.177Z
Learnt from: f0rdream
Repo: lynx-family/lynx-stack PR: 1835
File: packages/react/worklet-runtime/src/workletRuntime.ts:52-55
Timestamp: 2025-09-28T08:46:43.177Z
Learning: The legacy worklet path with `_lepusWorkletHash` in `packages/react/worklet-runtime/src/workletRuntime.ts` is preserved for compatibility with MTS (Mini-app Threading Service) that doesn't support Initial Frame Rendering. This path will not be touched in current implementations.
Applied to files:
packages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/react/runtime/src/lynx/tt.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : When a component makes external requests (e.g., via `iframe` or `fetch`), mock them using `page.route` in Playwright tests to ensure tests are hermetic and fast
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-13T09:20:00.936Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1502
File: packages/react/testing-library/types/entry.d.ts:71-71
Timestamp: 2025-08-13T09:20:00.936Z
Learning: In lynx-js/react testing library, wrapper components must have children as a required prop because they are always called with `h(WrapperComponent, null, innerElement)` where innerElement is passed as children. The type `React.JSXElementConstructor<{ children: React.ReactNode }>` correctly requires children to be mandatory.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-10-11T06:16:12.517Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1820
File: packages/web-platform/web-tests/tests/react.spec.ts:834-856
Timestamp: 2025-10-11T06:16:12.517Z
Learning: In packages/web-platform/web-tests/tests/react.spec.ts, the tests `basic-bindmouse` and `basic-mts-bindtouchstart` are NOT duplicates despite having similar test structures. They test different event types: `basic-bindmouse` validates mouse events (mousedown, mouseup, mousemove) with mouse-specific properties (button, buttons, x, y, pageX, pageY, clientX, clientY), while `basic-mts-bindtouchstart` validates touch events (touchstart) with touch arrays (touches, targetTouches, changedTouches). The similar test structure is coincidental and follows testing conventions.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-11-06T01:17:14.493Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/tools/Runtime/ListConsole.ts:48-60
Timestamp: 2025-11-06T01:17:14.493Z
Learning: In the Lynx runtime, console messages always include stack traces, so defensive null checks for `stackTrace.callFrames` in console message handling code are not required.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/all.ts : Export new components in `src/elements/all.ts` and add export configuration to `package.json` under `exports` for both types and default
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : When creating new elements, inherit from `Element` via `Component` decorator and use reactive utilities provided by `element-reactive`
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/index.ts : Ensure `index.ts` files and complex logic have clear, descriptive comments matching the implementation
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-07-18T04:27:18.291Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.
Applied to files:
packages/react/runtime/src/alog/elementPAPICall.ts
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Create a separate spec file for new components (e.g., `tests/x-webview.spec.ts`) instead of adding to the monolithic `web-elements.spec.ts`
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Use Playwright for all E2E and functional tests with standard assertions like `expect(locator).toBeVisible()`, `expect(locator).toHaveCSS()`, and `diffScreenShot` for screenshot comparisons
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
📚 Learning: 2025-12-29T11:26:09.487Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.487Z
Learning: Applies to packages/web-platform/web-elements/tests/fixtures/**/*.html : Use HTML files for test fixtures and define a helper function `goto(page, fixtureName)` to handle navigation and waiting for resources like `document.fonts.ready`
Applied to files:
packages/react/runtime/__test__/alog/elementPAPICall.test.js
🧬 Code graph analysis (2)
packages/react/runtime/src/alog/elementPAPICall.ts (1)
packages/react/runtime/src/debug/utils.ts (2)
profileStart(9-15)profileEnd(17-23)
packages/react/runtime/__test__/alog/elementPAPICall.test.js (2)
packages/react/runtime/__test__/utils/envManager.ts (1)
globalEnvManager(86-86)packages/react/runtime/src/alog/elementPAPICall.ts (1)
initElementPAPICallAlog(47-131)
🔇 Additional comments (6)
packages/react/runtime/src/lynx/tt.ts (1)
91-103: LGTM!The debug logging block is well-guarded with proper checks for
__ALOG__and uses optional chaining onconsole.alog. Positioning between the timing marks and using the parsedbeforeobject (rather than the raw string) for cleaner output is a nice touch.packages/react/runtime/src/alog/elementPAPICall.ts (3)
7-45: LGTM!The API list is well-organized and comprehensive. The previously flagged duplicate
__FlushElementTreeentries have been resolved.
47-63: LGTM!The initialization logic is sound. The non-null assertion on line 54 is safe since
formatFiberElementis only called after afiberElementMap.has()check. The reduce pattern for collecting original APIs is acceptable given the small, fixed list size.
115-127: LGTM!The result formatting and logging logic is correct. The nullish check on line 124 properly handles both
nullresults and theundefinedthatJSON.stringify(undefined)returns. Optional chaining onconsole.alogensures graceful degradation.packages/react/testing-library/src/__tests__/alog.test.jsx (2)
40-171: LGTM!The expanded snapshot comprehensively captures the new FiberElement API call logging format, including the human-readable element references (e.g.,
PAGE#0,VIEW#1) and the BTS → MTS communication logs. The three__FlushElementTreecalls (#31-33) represent actual runtime behavior during hydration, not duplicate instrumentation.
188-301: LGTM!The background thread snapshot now correctly captures the
MTS -> BTS OnLifecycleEventlog with the parsed hydration data structure. The state update snapshot (lines 256-301) properly shows the incrementalSetAttributepatch and subsequent flush operations, validating the end-to-end logging flow.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #2081 will degrade performance by 10.5%Comparing Summary
Benchmarks breakdown
Footnotes
|
React Example#6810 Bundle Size — 237.01KiB (~+0.01%).0878692(current) vs bba05e2 main#6800(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch feat/dual-thread-alog Project dashboard Generated by RelativeCI Documentation Report issue |
Web Explorer#6970 Bundle Size — 379.18KiB (0%).0878692(current) vs bba05e2 main#6960(baseline) Bundle metrics
|
| Current #6970 |
Baseline #6960 |
|
|---|---|---|
152.57KiB |
152.57KiB |
|
32.53KiB |
32.53KiB |
|
0% |
0% |
|
8 |
8 |
|
8 |
8 |
|
236 |
236 |
|
16 |
16 |
|
3.03% |
3.03% |
|
4 |
4 |
|
0 |
0 |
Bundle size by type no changes
| Current #6970 |
Baseline #6960 |
|
|---|---|---|
249.67KiB |
249.67KiB |
|
96.98KiB |
96.98KiB |
|
32.53KiB |
32.53KiB |
Bundle analysis report Branch feat/dual-thread-alog Project dashboard
Generated by RelativeCI Documentation Report issue
344b1a8 to
681e415
Compare
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @lynx-js/gesture-runtime@2.1.1 ### Patch Changes - Add `NativeGesture` ([#2076](#2076)) ## @lynx-js/react@0.115.3 ### Patch Changes - Add dual-thread commutation logs for troubleshooting when `REACT_ALOG=true` or global define `__ALOG__` is set. ([#2081](#2081)) - Use error cause to simplify the error msg of lazy bundle loading. User can catch the error cause to get the original result: ([#2056](#2056)) ```ts const LazyComponent = lazy(async () => { try { const mod = await import("./lazy-bundle"); return mod.default; } catch (error) { console.error(`Lazy Bundle load failed message: ${error.message}`); // User can catch the error cause to get the original result console.error(`Lazy Bundle load failed result: ${error.cause}`); throw error; } }); ``` ## @lynx-js/rspeedy@0.12.5 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-rsbuild-server-middleware@0.19.4 ## @lynx-js/react-rsbuild-plugin@0.12.4 ### Patch Changes - ([#2051](#2051)) - Updated dependencies \[]: - @lynx-js/react-alias-rsbuild-plugin@0.12.4 - @lynx-js/use-sync-external-store@1.5.0 - @lynx-js/react-refresh-webpack-plugin@0.3.4 - @lynx-js/react-webpack-plugin@0.7.3 ## @lynx-js/testing-environment@0.1.9 ### Patch Changes - Fix duplicated `<page />` elements on body when multiple `__CreatePage` called. ([#2065](#2065)) ## @lynx-js/web-constants@0.19.4 ### Patch Changes - Updated dependencies \[[`bba05e2`](bba05e2)]: - @lynx-js/web-worker-rpc@0.19.4 ## @lynx-js/web-core@0.19.4 ### Patch Changes - Updated dependencies \[[`bba05e2`](bba05e2)]: - @lynx-js/web-worker-rpc@0.19.4 - @lynx-js/web-constants@0.19.4 - @lynx-js/web-worker-runtime@0.19.4 - @lynx-js/web-mainthread-apis@0.19.4 ## @lynx-js/web-elements@0.10.1 ### Patch Changes - feat: implement x-webview component ([#2061](#2061)) - feat: support `recyclable="false"` on `list-item` and enable overflow visibility ([#2069](#2069)) ## @lynx-js/web-mainthread-apis@0.19.4 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.19.4 ## @lynx-js/web-worker-rpc@0.19.4 ### Patch Changes - Ensure the `default` export entry is last in the package exports map. ([#2075](#2075)) ## @lynx-js/web-worker-runtime@0.19.4 ### Patch Changes - Updated dependencies \[[`bba05e2`](bba05e2)]: - @lynx-js/web-worker-rpc@0.19.4 - @lynx-js/web-constants@0.19.4 - @lynx-js/web-mainthread-apis@0.19.4 ## create-rspeedy@0.12.5 ## @lynx-js/react-alias-rsbuild-plugin@0.12.4 ## upgrade-rspeedy@0.12.5 ## @lynx-js/web-core-server@0.19.4 ## @lynx-js/web-rsbuild-server-middleware@0.19.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
close #2045
An example log from our examples/react package is as below.
First screen:
Details
Next update:
Details
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist