Skip to content

feat: add alog and trace for BTS event handlers#2102

Merged
upupming merged 6 commits intomainfrom
feat/event-alog
Feb 2, 2026
Merged

feat: add alog and trace for BTS event handlers#2102
upupming merged 6 commits intomainfrom
feat/event-alog

Conversation

@upupming
Copy link
Copy Markdown
Collaborator

@upupming upupming commented Jan 8, 2026

image

Summary by CodeRabbit

  • New Features

    • Added richer logging, tracing, and lightweight profiling around event handlers for better observability.
  • Behavior

    • Tightened event payload typing for more consistent and predictable event delivery.
  • Tests

    • Expanded event-handling tests with additional simulated interactions, dataset bindings, and updated traces/snapshots.

✏️ Tip: You can customize this high-level summary in your review settings.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@upupming upupming requested review from HuJean and hzy as code owners January 8, 2026 13:51
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 8, 2026

🦋 Changeset detected

Latest commit: 9d7593b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lynx-js/react Patch

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

Replaced unknown with a new EventDataType across event APIs and delayed-event storage, added profiling and ALOG-style debug logging in the BTS event publish path, updated event handler invocation to call handlers with typed data, adjusted tests/snapshots, and added a changeset for a patch release.

Changes

Cohort / File(s) Summary
Type definitions
packages/react/runtime/types/types.d.ts
Added EventDataType { type: string; [prop: string]: unknown }. Updated publishEvent and publicComponentEvent signatures in lynxCoreInject to accept EventDataType.
Event lifecycle & runtime
packages/react/runtime/src/lifecycle/event/delayEvents.ts, packages/react/runtime/src/lynx/tt.ts
Tightened delayed event storage and public APIs to EventDataType. Added profileStart/profileEnd and ALOG-style debug logging around publishEvent. Switched handler invocation to direct eventHandler(data) and wired delayed/public event paths accordingly.
Tests & snapshots
packages/react/testing-library/src/__tests__/alog.test.jsx
Added fireEvent usage and a focus handler, attached data-testid, and updated extensive snapshots/log assertions to reflect new dataset binding, event wiring, and added logging traces.
Release metadata
.changeset/olive-hounds-enter.md
New changeset declaring a patch bump for @lynx-js/react and noting addition of alog/trace logging for BTS event handlers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • HuJean
  • hzy

Poem

🐰 I hop through event fields bright,

types in paw to set them right.
I log and time each little trace,
so handlers run in tidy place.
Hooray — the events all behave tonight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add alog and trace for BTS event handlers' directly and clearly summarizes the main change in the changeset—adding logging and tracing capabilities for BTS event handlers across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/event-alog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (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 EventDataType and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 33d4389 and 8a04641.

📒 Files selected for processing (5)
  • .changeset/olive-hounds-enter.md
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/react/runtime/src/lynx/tt.ts
  • packages/react/runtime/types/types.d.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.md
  • packages/react/runtime/types/types.d.ts
  • packages/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.md
  • packages/react/runtime/types/types.d.ts
  • packages/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.md
  • packages/react/runtime/types/types.d.ts
  • packages/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.ts
  • packages/react/testing-library/src/__tests__/alog.test.jsx
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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 unknown with EventDataType provides 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 EventDataType interface provides a good balance between structure (required type field) and flexibility (index signature for additional properties). This replaces the previous unknown type with a more descriptive contract.


193-194: LGTM! Public API signatures updated correctly.

The function signatures now correctly use EventDataType instead of unknown, 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 EventDataType for the data payload, consistent with the interface definition and API changes.


251-257: LGTM! Function signatures updated consistently.

Both publicComponentEvent and delayedPublicComponentEvent now correctly use EventDataType for 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 fireEvent for user interactions
  • Add handleFocus callback and wire it with catchfocus
  • Use data-testid for reliable element selection
  • Simulate tap and focus events 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 tap and focus handlers (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, and jsFunctionName (lines 317-334)
  • Component re-renders triggered by the events

These snapshots validate that the profiling and logging additions in tt.ts are working as expected.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8a04641 and 28b158c.

📒 Files selected for processing (5)
  • .changeset/olive-hounds-enter.md
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/react/runtime/src/lynx/tt.ts
  • packages/react/runtime/types/types.d.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.ts
  • packages/react/runtime/src/lifecycle/event/delayEvents.ts
  • packages/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.md
  • packages/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.md
  • packages/react/runtime/src/lynx/tt.ts
  • packages/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.md
  • packages/react/runtime/src/lynx/tt.ts
  • packages/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.jsx
  • packages/react/runtime/src/lynx/tt.ts
  • packages/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 EventDataType interface provides better type safety for event payloads by enforcing a required type field 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-testid for 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 the eventType: 'catchEvent' option to match the catchfocus binding.


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 EventDataType instead of unknown, 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 EventDataType for 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 publicComponentEvent function signature properly uses EventDataType and forwards to publishEvent.


255-257: LGTM! Delayed event handling correctly updated.

The delayedPublicComponentEvent function signature properly uses EventDataType and forwards to delayedPublishEvent.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/react/runtime/src/lynx/tt.ts 91.89% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 8, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 8.34%

Comparing feat/event-alog (9d7593b) with main (af0abe8)

Summary

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 61 untouched benchmarks
⏩ 3 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 47.2 ms 42 ms +12.57%
basic-performance-nest-level-100 7.1 ms 7.8 ms -8.34%

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Jan 8, 2026

Web Explorer

#7453 Bundle Size — 383.56KiB (0%).

9d7593b(current) vs af0abe8 main#7449(baseline)

Bundle metrics  Change 1 change
                 Current
#7453
     Baseline
#7449
No change  Initial JS 154.71KiB 154.71KiB
No change  Initial CSS 35.05KiB 35.05KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 236(-0.84%) 238
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.99% 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7453
     Baseline
#7449
No change  JS 252.66KiB 252.66KiB
No change  Other 95.85KiB 95.85KiB
No change  CSS 35.05KiB 35.05KiB

Bundle analysis reportBranch feat/event-alogProject dashboard


Generated by RelativeCIDocumentationReport issue

@upupming upupming merged commit d2f5bd5 into main Feb 2, 2026
45 of 46 checks passed
@upupming upupming deleted the feat/event-alog branch February 2, 2026 07:55
colinaaa pushed a commit that referenced this pull request Feb 23, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants