feat: add alog and trace for BTS event handlers#2102
Conversation
🦋 Changeset detectedLatest commit: 9d7593b 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 |
📝 WalkthroughWalkthroughReplaced Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
50e7186 to
8a04641
Compare
8a04641 to
28b158c
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/react/runtime/src/lynx/tt.ts (1)
204-249: LGTM! Profiling and logging enhance observability.The additions of profiling and debug logging provide valuable insights into BTS event handling. The implementation correctly uses the new
EventDataTypeand logs relevant metadata.♻️ Optional: Extract duplicate snapshot instance metadata logic
Lines 215-217 and 228-230 contain duplicate logic for extracting the snapshot instance type. Consider extracting this into a helper:
const getEventMetadata = (handlerName: string, data: EventDataType, eventHandler: ((...args: unknown[]) => void) | undefined) => { const instanceId = Number(handlerName.split(':')[0]); return { handlerName, type: data.type, snapshotInstanceType: backgroundSnapshotInstanceManager.values.get(instanceId)?.type ?? '', jsFunctionName: eventHandler?.name ?? '', }; };Then use it in both places:
if (__PROFILE__) { profileStart(`ReactLynx::publishEvent`, { args: getEventMetadata(handlerName, data, eventHandler), }); } if (typeof __ALOG__ !== 'undefined' && __ALOG__) { console.alog?.( `[ReactLynxDebug] BTS received event:\n` + JSON.stringify( getEventMetadata(handlerName, data, eventHandler), null, 2, ), ); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.changeset/olive-hounds-enter.mdpackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/types/types.d.tspackages/react/testing-library/src/__tests__/alog.test.jsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with the configuration specified in tsconfig.json
Files:
packages/react/runtime/types/types.d.tspackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.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/types/types.d.tspackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.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/types/types.d.tspackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.ts
🧠 Learnings (32)
📚 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/olive-hounds-enter.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/olive-hounds-enter.md
📚 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:
.changeset/olive-hounds-enter.mdpackages/react/runtime/types/types.d.tspackages/react/runtime/src/lynx/tt.ts
📚 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/olive-hounds-enter.md
📚 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/olive-hounds-enter.md
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Use changeset tool with `pnpm changeset` to document changes before contribution
Applied to files:
.changeset/olive-hounds-enter.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/olive-hounds-enter.md
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to packages/react/**/*.{ts,tsx} : Use JSX syntax and ReactLynx components in React component files within packages/react/
Applied to files:
.changeset/olive-hounds-enter.mdpackages/react/runtime/types/types.d.tspackages/react/runtime/src/lynx/tt.ts
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to packages/react/components/**/*.{ts,tsx} : Optimize component library in packages/react/components/ using ReactLynx syntax
Applied to files:
.changeset/olive-hounds-enter.mdpackages/react/runtime/types/types.d.tspackages/react/runtime/src/lynx/tt.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/types/types.d.tspackages/react/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.ts
📚 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-11-11T08:05:14.163Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1932
File: packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx:10-26
Timestamp: 2025-11-11T08:05:14.163Z
Learning: In packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx, the test intentionally uses selectionStart twice in the result string (instead of selectionStart and selectionEnd) because it prioritizes testing whether x-input-ng works functionally, rather than validating the correctness of selection values.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-13T09:23:36.222Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1502
File: packages/react/testing-library/types/entry.d.ts:97-97
Timestamp: 2025-08-13T09:23:36.222Z
Learning: React Testing Library's rerender function accepts React.ReactNode (including strings, numbers, null, etc.), not just React.ReactElement. The typing should match RTL's behavior by using React.ReactNode for maximum compatibility.
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-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to **/__test__/**/*.{ts,tsx,js} : Use vitest-based unit tests as configured in vitest.config.ts
Applied to files:
packages/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/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-11T06:00:04.376Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:59-61
Timestamp: 2025-08-11T06:00:04.376Z
Learning: In the lynx-family/lynx-stack repository, the `testingLibraryPlugin` in `packages/react/testing-library/src/plugins/vitest.ts` intentionally uses `process.exit` when jsdom installation fails, maintaining consistency with the previous implementation from `packages/react/testing-library/src/vitest.config.js`. This behavior should not be changed to use `this.error` despite being a Vite plugin best practice.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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/testing-library/src/__tests__/alog.test.jsx
📚 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/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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/__tests__/alog.test.jsx
📚 Learning: 2025-12-30T10:02:35.055Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 2081
File: packages/react/runtime/src/alog/elementPAPICall.ts:109-112
Timestamp: 2025-12-30T10:02:35.055Z
Learning: In packages/react/runtime/src/alog/elementPAPICall.ts, the helper APIs `__GetTag` and `__GetElementUniqueID` should always exist when instrumenting FiberElement PAPIs, so defensive checks for their existence are unnecessary.
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 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/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-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: 2026-01-04T11:17:23.990Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-core-wasm/AGENTS.md:0-0
Timestamp: 2026-01-04T11:17:23.990Z
Learning: When modifying Rust core logic in src/main_thread, ALWAYS add corresponding tests in tests/element-apis.spec.ts to verify the JS-side behavior
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-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-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/lynx/tt.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/lynx/tt.ts
📚 Learning: 2025-08-19T12:49:38.940Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/template-webpack-plugin/src/LynxCacheEventsSetupListRuntimeModule.ts:110-112
Timestamp: 2025-08-19T12:49:38.940Z
Learning: The GlobalEventEmitter API in the Lynx framework is designed to pass arguments as an array (single parameter) rather than spreading individual arguments. When replaying cached events with emitter.emit(listenerKey, action.data.args), the args array should be passed as-is, not spread with the spread operator.
Applied to files:
packages/react/runtime/src/lynx/tt.ts
🪛 LanguageTool
.changeset/olive-hounds-enter.md
[grammar] ~5-~5: Ensure spelling is correct
Context: --- "@lynx-js/react": patch --- Add alog and trace for BTS event handlers.
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (9)
.changeset/olive-hounds-enter.md (1)
1-5: LGTM!The changeset correctly documents the patch-level addition of alog and trace logging for BTS event handlers. The static analysis hint about "alog" can be safely ignored—it's a project-specific term for application logging used consistently throughout the codebase.
packages/react/runtime/src/lifecycle/event/delayEvents.ts (1)
4-9: LGTM! Type safety improvement.Replacing
unknownwithEventDataTypeprovides better type safety and aligns with the structured event data contract introduced across the event handling pipeline.packages/react/runtime/types/types.d.ts (2)
180-184: LGTM! Well-structured event data interface.The
EventDataTypeinterface provides a good balance between structure (requiredtypefield) and flexibility (index signature for additional properties). This replaces the previousunknowntype with a more descriptive contract.
193-194: LGTM! Public API signatures updated correctly.The function signatures now correctly use
EventDataTypeinstead ofunknown, providing better type safety for consumers of these APIs.packages/react/runtime/src/lynx/tt.ts (2)
183-186: LGTM! Type alignment with EventDataType.The destructuring correctly expects
EventDataTypefor the data payload, consistent with the interface definition and API changes.
251-257: LGTM! Function signatures updated consistently.Both
publicComponentEventanddelayedPublicComponentEventnow correctly useEventDataTypefor the data parameter.packages/react/testing-library/src/__tests__/alog.test.jsx (3)
4-50: LGTM! Test properly exercises new event handling.The test updates correctly:
- Import
fireEventfor user interactions- Add
handleFocuscallback and wire it withcatchfocus- Use
data-testidfor reliable element selection- Simulate
tapandfocusevents to validate the new alog/trace functionality
52-223: LGTM! Main thread snapshots correctly reflect new functionality.The updated snapshots properly capture:
- Dataset binding for
data-testid(line 79)- Event wiring for both
tapandfocushandlers (lines 106, 109)- Additional lifecycle events and patch updates from the user interactions
224-467: LGTM! Background thread snapshots validate new alog/trace implementation.The updated snapshots correctly capture:
- Event handler registration with multiple handlers (lines 249-250)
- BTS received event logs with full metadata including
handlerName,type,snapshotInstanceType, andjsFunctionName(lines 317-334)- Component re-renders triggered by the events
These snapshots validate that the profiling and logging additions in
tt.tsare working as expected.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @packages/react/runtime/src/lynx/tt.ts:
- Around line 239-248: The event handler is incorrectly cast as a variadic
function; update the cast for eventHandler to match the actual invocation by
using a single-argument signature (e.g., (data: EventDataType) => void or (arg:
unknown) => void) where eventHandler is defined/typed, so the call
eventHandler(data) is type-safe; modify the cast near the eventHandler
declaration/assignment (referencing eventHandler and EventDataType) and keep the
existing try/catch that calls lynx.reportError(e as Error) and the subsequent
__PROFILE__/profileEnd handling unchanged.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.changeset/olive-hounds-enter.mdpackages/react/runtime/src/lifecycle/event/delayEvents.tspackages/react/runtime/src/lynx/tt.tspackages/react/runtime/types/types.d.tspackages/react/testing-library/src/__tests__/alog.test.jsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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/lifecycle/event/delayEvents.tspackages/react/runtime/types/types.d.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/lifecycle/event/delayEvents.tspackages/react/runtime/types/types.d.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/lifecycle/event/delayEvents.tspackages/react/runtime/types/types.d.ts
🧠 Learnings (32)
📚 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/olive-hounds-enter.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/olive-hounds-enter.md
📚 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:
.changeset/olive-hounds-enter.mdpackages/react/runtime/src/lynx/tt.ts
📚 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/olive-hounds-enter.md
📚 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/olive-hounds-enter.md
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Use changeset tool with `pnpm changeset` to document changes before contribution
Applied to files:
.changeset/olive-hounds-enter.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/olive-hounds-enter.md
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to packages/react/**/*.{ts,tsx} : Use JSX syntax and ReactLynx components in React component files within packages/react/
Applied to files:
.changeset/olive-hounds-enter.mdpackages/react/runtime/src/lynx/tt.tspackages/react/runtime/types/types.d.ts
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to packages/react/components/**/*.{ts,tsx} : Optimize component library in packages/react/components/ using ReactLynx syntax
Applied to files:
.changeset/olive-hounds-enter.mdpackages/react/runtime/src/lynx/tt.tspackages/react/runtime/types/types.d.ts
📚 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-11-11T08:05:14.163Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1932
File: packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx:10-26
Timestamp: 2025-11-11T08:05:14.163Z
Learning: In packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx, the test intentionally uses selectionStart twice in the result string (instead of selectionStart and selectionEnd) because it prioritizes testing whether x-input-ng works functionally, rather than validating the correctness of selection values.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-13T09:23:36.222Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1502
File: packages/react/testing-library/types/entry.d.ts:97-97
Timestamp: 2025-08-13T09:23:36.222Z
Learning: React Testing Library's rerender function accepts React.ReactNode (including strings, numbers, null, etc.), not just React.ReactElement. The typing should match RTL's behavior by using React.ReactNode for maximum compatibility.
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-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/__tests__/alog.test.jsx
📚 Learning: 2025-12-30T10:02:35.055Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 2081
File: packages/react/runtime/src/alog/elementPAPICall.ts:109-112
Timestamp: 2025-12-30T10:02:35.055Z
Learning: In packages/react/runtime/src/alog/elementPAPICall.ts, the helper APIs `__GetTag` and `__GetElementUniqueID` should always exist when instrumenting FiberElement PAPIs, so defensive checks for their existence are unnecessary.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-26T05:10:01.608Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-26T05:10:01.608Z
Learning: Applies to **/__test__/**/*.{ts,tsx,js} : Use vitest-based unit tests as configured in vitest.config.ts
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-08-11T06:00:04.376Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:59-61
Timestamp: 2025-08-11T06:00:04.376Z
Learning: In the lynx-family/lynx-stack repository, the `testingLibraryPlugin` in `packages/react/testing-library/src/plugins/vitest.ts` intentionally uses `process.exit` when jsdom installation fails, maintaining consistency with the previous implementation from `packages/react/testing-library/src/vitest.config.js`. This behavior should not be changed to use `this.error` despite being a Vite plugin best practice.
Applied to files:
packages/react/testing-library/src/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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/testing-library/src/__tests__/alog.test.jsx
📚 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/__tests__/alog.test.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
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.502Z
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/__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 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/testing-library/src/__tests__/alog.test.jsx
📚 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/testing-library/src/__tests__/alog.test.jsxpackages/react/runtime/src/lynx/tt.tspackages/react/runtime/types/types.d.ts
📚 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-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: 2026-01-04T11:17:23.990Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-core-wasm/AGENTS.md:0-0
Timestamp: 2026-01-04T11:17:23.990Z
Learning: When modifying Rust core logic in src/main_thread, ALWAYS add corresponding tests in tests/element-apis.spec.ts to verify the JS-side behavior
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-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/lynx/tt.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/lynx/tt.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-08-19T12:49:38.940Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/template-webpack-plugin/src/LynxCacheEventsSetupListRuntimeModule.ts:110-112
Timestamp: 2025-08-19T12:49:38.940Z
Learning: The GlobalEventEmitter API in the Lynx framework is designed to pass arguments as an array (single parameter) rather than spreading individual arguments. When replaying cached events with emitter.emit(listenerKey, action.data.args), the args array should be passed as-is, not spread with the spread operator.
Applied to files:
packages/react/runtime/src/lynx/tt.ts
🧬 Code graph analysis (1)
packages/react/runtime/src/lynx/tt.ts (2)
packages/react/runtime/src/snapshot.ts (1)
backgroundSnapshotInstanceManager(164-220)packages/react/runtime/src/debug/utils.ts (2)
profileStart(9-15)profileEnd(17-23)
🪛 LanguageTool
.changeset/olive-hounds-enter.md
[grammar] ~5-~5: Ensure spelling is correct
Context: --- "@lynx-js/react": patch --- Add alog and trace for BTS event handlers.
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (10)
packages/react/runtime/types/types.d.ts (1)
180-183: LGTM! Good type safety improvement.The
EventDataTypeinterface provides better type safety for event payloads by enforcing a requiredtypefield while maintaining flexibility for additional properties.packages/react/testing-library/src/__tests__/alog.test.jsx (3)
4-4: LGTM! Proper test setup for event handling.The test correctly sets up event handlers and uses
data-testidfor element retrieval, following testing-library best practices.Also applies to: 16-23, 38-43
45-50: LGTM! Correct event firing pattern.The test properly uses
act()to wrap event firing and includes theeventType: 'catchEvent'option to match thecatchfocusbinding.
79-79: LGTM! Snapshots correctly capture the new alog/trace behavior.The updated snapshots show:
- Dataset binding for the test element (line 79)
- catchEvent registration (line 109)
- Detailed BTS event logs with handlerName, type, snapshotInstanceType, and jsFunctionName (lines 317-334)
These changes validate the PR's objective to add alog and trace for BTS event handlers.
Also applies to: 109-109, 317-334
.changeset/olive-hounds-enter.md (1)
1-5: LGTM! Changeset correctly documents the patch.The changeset appropriately categorizes this as a patch release and clearly describes the addition of alog and trace for BTS event handlers.
Note: The static analysis tool's spelling warning for "alog" is a false positive—this is a technical term used throughout the codebase for application logging.
packages/react/runtime/src/lifecycle/event/delayEvents.ts (1)
4-9: LGTM! Type updates align with EventDataType.The changes correctly update delayed event handling to use
EventDataTypeinstead ofunknown, maintaining type consistency with the broader event system changes.packages/react/runtime/src/lynx/tt.ts (4)
183-183: LGTM! Event data properly typed.The lifecycle event data extraction correctly uses
EventDataTypefor type safety.
204-237: LGTM! Profiling and logging provide valuable debug context.The additions correctly:
- Update the signature to use
EventDataType- Guard profiling/logging behind
__PROFILE__and__ALOG__flags- Capture detailed event context (handlerName, type, snapshotInstanceType, jsFunctionName)
- Use consistent logic between profiling and logging blocks
The string operations and Map lookups for extracting snapshot context are acceptable since they only run in debug builds.
251-253: LGTM! Signature correctly updated.The
publicComponentEventfunction signature properly usesEventDataTypeand forwards topublishEvent.
255-257: LGTM! Delayed event handling correctly updated.The
delayedPublicComponentEventfunction signature properly usesEventDataTypeand forwards todelayedPublishEvent.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging this PR will degrade performance by 8.34%Comparing Summary
Performance Changes
Footnotes
|
Web Explorer#7453 Bundle Size — 383.56KiB (0%).9d7593b(current) vs af0abe8 main#7449(baseline) Bundle metrics
Bundle size by type
|
| Current #7453 |
Baseline #7449 |
|
|---|---|---|
252.66KiB |
252.66KiB |
|
95.85KiB |
95.85KiB |
|
35.05KiB |
35.05KiB |
Bundle analysis report Branch feat/event-alog Project dashboard
Generated by RelativeCI Documentation Report issue
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/motion@0.0.3 ### Patch Changes - Fix an issue that motion/mini will accidentally imports full version, causing compiling error ([#2204](#2204)) ## @lynx-js/react@0.116.3 ### Patch Changes - fix: remove `lynx.createSelectorQuery` deprecated warning in production ([#2195](#2195)) - Add a DEV-only guard that detects MainThread flush loops caused by re-entrant MTS handlers. ([#2159](#2159)) This typically happens when a MainThread handler (e.g. event callback or `MainThreadRef`) performs UI mutations (like `Element.setStyleProperty`, `setStyleProperties`, `setAttribute`, or `invoke`) that synchronously trigger a flush which re-enters the handler again. - Avoid DEV_ONLY_SetSnapshotEntryName on standalone lazy bundle. ([#2184](#2184)) - Add alog and trace for BTS event handlers. ([#2102](#2102)) - fix: Main thread functions cannot access properties on `this` before hydration completes. ([#2194](#2194)) This fixes the `cannot convert to object` error. - Remove element api calls alog by default, and only enable it when `__ALOG_ELEMENT_API__` is defined to `true` or environment variable `REACT_ALOG_ELEMENT_API` is set to `true`. ([#2192](#2192)) - fix: captured variables in main thread functions within class components do not update correctly ([#2197](#2197)) ## @lynx-js/rspeedy@0.13.4 ### Patch Changes - Bump ts-blank-space v0.7.0 ([#2238](#2238)) - Bump Rsbuild v1.7.3 with Rspack v1.7.5. ([#2189](#2189)) - Updated dependencies \[]: - @lynx-js/web-rsbuild-server-middleware@0.19.8 ## @lynx-js/qrcode-rsbuild-plugin@0.4.5 ### Patch Changes - Only register console shortcuts when running in TTY environments ([#2202](#2202)) ## @lynx-js/react-rsbuild-plugin@0.12.8 ### Patch Changes - Updated dependencies \[[`4240138`](4240138)]: - @lynx-js/react-webpack-plugin@0.7.4 - @lynx-js/react-alias-rsbuild-plugin@0.12.8 - @lynx-js/use-sync-external-store@1.5.0 - @lynx-js/react-refresh-webpack-plugin@0.3.4 - @lynx-js/template-webpack-plugin@0.10.3 ## @lynx-js/testing-environment@0.1.11 ### Patch Changes - Remove element api calls alog by default, and only enable it when `__ALOG_ELEMENT_API__` is defined to `true` or environment variable `REACT_ALOG_ELEMENT_API` is set to `true`. ([#2192](#2192)) ## @lynx-js/web-constants@0.19.8 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-worker-rpc@0.19.8 ## @lynx-js/web-core@0.19.8 ### Patch Changes - fix: avoid error when LynxView is removed immediately after connected ([#2182](#2182)) - Updated dependencies \[]: - @lynx-js/web-constants@0.19.8 - @lynx-js/web-mainthread-apis@0.19.8 - @lynx-js/web-worker-rpc@0.19.8 - @lynx-js/web-worker-runtime@0.19.8 ## @lynx-js/web-core-wasm@0.0.3 ### Patch Changes - Updated dependencies \[[`e0972ef`](e0972ef), [`3bc017e`](3bc017e), [`e2d349e`](e2d349e), [`d924b6a`](d924b6a)]: - @lynx-js/web-elements@0.11.2 - @lynx-js/web-worker-rpc@0.19.8 ## @lynx-js/web-elements@0.11.2 ### Patch Changes - Add scrollHeight/scrollWidth getters to XList. ([#2156](#2156)) - Inherit padding styles for x-input elements. ([#2199](#2199)) - Remove the default lazy-loading attribute from x-image elements. ([#2186](#2186)) - Fix x-input number type forwarding to the inner input element. ([#2193](#2193)) ## @lynx-js/web-mainthread-apis@0.19.8 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.19.8 ## @lynx-js/web-worker-runtime@0.19.8 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.19.8 - @lynx-js/web-mainthread-apis@0.19.8 - @lynx-js/web-worker-rpc@0.19.8 ## @lynx-js/react-webpack-plugin@0.7.4 ### Patch Changes - Remove element api calls alog by default, and only enable it when `__ALOG_ELEMENT_API__` is defined to `true` or environment variable `REACT_ALOG_ELEMENT_API` is set to `true`. ([#2192](#2192)) ## create-rspeedy@0.13.4 ## @lynx-js/react-alias-rsbuild-plugin@0.12.8 ## upgrade-rspeedy@0.13.4 ## @lynx-js/web-core-server@0.19.8 ## @lynx-js/web-rsbuild-server-middleware@0.19.8 ## @lynx-js/web-worker-rpc@0.19.8 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Behavior
Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist