Skip to content

ci(benchmark/react): background setAttribute BatchedValues#1655

Merged
hzy merged 1 commit intolynx-family:mainfrom
hzy:p/hzy/bench_6
Sep 8, 2025
Merged

ci(benchmark/react): background setAttribute BatchedValues#1655
hzy merged 1 commit intolynx-family:mainfrom
hzy:p/hzy/bench_6

Conversation

@hzy
Copy link
Copy Markdown
Collaborator

@hzy hzy commented Sep 4, 2025

Summary by CodeRabbit

  • New Features

    • Added background benchmarking hooks and instrumentation for batched attribute updates; runtime now records executed benchmarks when triggered.
  • Bug Fixes

    • Instrumentation is gated so it only runs when the benchmarking environment is present, avoiding unintended overhead.
  • Chores

    • Simplified thread-detection logic and expanded runtime surface to include background snapshot handling.

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).

Copilot AI review requested due to automatic review settings September 4, 2025 08:12
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 4, 2025

⚠️ No Changeset found

Latest commit: e9caf02

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Exports BackgroundSnapshotInstance from runtime internals, instruments BackgroundSnapshotInstance.prototype.setAttribute (and main-thread SnapshotInstance) to start/stop Codspeed benchmarks on a batched 'stop-benchmark-true' sentinel, and simplifies main-thread detection in the benchmark hook.

Changes

Cohort / File(s) Summary
Benchmark instrumentation + demo data
benchmark/react/cases/004-various-update/index.tsx
Imports BackgroundSnapshotInstance; guards main-thread instrumentation with Codspeed && __MAIN_THREAD__; adds background instrumentation guarded by Codspeed && __BACKGROUND__ that wraps BackgroundSnapshotInstance.prototype.setAttribute, detects key === 'values' and last element 'stop-benchmark-true', calls Codspeed.startBenchmark()/stopBenchmark(), invokes original setter, and reports Codspeed.setExecutedBenchmark(..., 'BatchedValues'). Also updates attribute-index/name mapping and demo indices.
Runtime internals export
packages/react/runtime/lazy/internal.js, packages/react/runtime/src/internal.ts
Adds BackgroundSnapshotInstance to the destructured export in lazy/internal.js and to the exported public API in src/internal.ts alongside SnapshotInstance and snapshot utilities.
Benchmark hook thread detection
benchmark/react/src/hook.ts
Removes @ts-expect-error and collapses isMainThread initialization to a single-line export const isMainThread = typeof __CreatePage === 'function';.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • upupming
  • colinaaa

Poem

I nibble bytes beneath the screen's soft light, 🥕
Codspeed hums as benchmarks take flight. ⏱️
Background hops, main-thread gives a cheer,
Batched values counted, the finishline near.
A rabbit claps — the code runs bright.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds background thread support for benchmarking setAttribute operations on BatchedValues in the React runtime. The changes enable performance testing of attribute updates that occur in background workers, complementing existing main thread benchmarking.

  • Exports BackgroundSnapshotInstance from the React runtime internal module
  • Adds background thread benchmarking hooks for setAttribute operations
  • Cleans up TypeScript comment formatting in hook utility

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/react/runtime/src/internal.ts Adds import and export of BackgroundSnapshotInstance to expose it for benchmarking
packages/react/runtime/lazy/internal.js Exports BackgroundSnapshotInstance in the lazy loading module
benchmark/react/src/hook.ts Removes unnecessary TypeScript error suppression comment
benchmark/react/cases/004-various-update/index.tsx Adds background thread benchmarking hooks and updates main thread condition check

Comment thread benchmark/react/cases/004-various-update/index.tsx Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
benchmark/react/cases/004-various-update/index.tsx (1)

78-85: Always stop the benchmark via finally.

If old.call throws, Codspeed.stopBenchmark() and setExecutedBenchmark() won’t run, leaving the harness in a bad state.

Apply:

-      Codspeed.startBenchmark();
-      const ret = old!.call(this, key, value);
-      Codspeed.stopBenchmark();
-      Codspeed.setExecutedBenchmark(
-        `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
-      );
-
-      return ret;
+      Codspeed.startBenchmark();
+      try {
+        return old!.call(this, key, value);
+      } finally {
+        Codspeed.stopBenchmark();
+        Codspeed.setExecutedBenchmark(
+          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
+        );
+      }
🧹 Nitpick comments (3)
benchmark/react/src/hook.ts (1)

20-20: Avoid TS error by accessing the injected global via globalThis.

Directly referencing __CreatePage without an ambient declaration can fail type-checking after removing @ts-expect-error. Use globalThis (or add a .d.ts ambient) to keep this safe.

Apply:

-export const isMainThread = typeof __CreatePage === 'function';
+export const isMainThread = typeof (globalThis as any).__CreatePage === 'function';

Optionally, add an ambient in a globals.d.ts:

declare const __CreatePage: unknown;
packages/react/runtime/src/internal.ts (1)

21-21: Public surface area expanded — add a changeset entry.

Exporting BackgroundSnapshotInstance alters the package API. Please include a changeset (likely minor) and note in internal docs.

benchmark/react/cases/004-various-update/index.tsx (1)

105-106: Optional: de-stringify the sentinel.

Using a boolean sentinel (or a dedicated prop) is less brittle than matching 'stop-benchmark-true'.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9e2c497 and 2a37aa3.

📒 Files selected for processing (4)
  • benchmark/react/cases/004-various-update/index.tsx (2 hunks)
  • benchmark/react/src/hook.ts (1 hunks)
  • packages/react/runtime/lazy/internal.js (1 hunks)
  • packages/react/runtime/src/internal.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#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/runtime/src/internal.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • packages/react/runtime/src/internal.ts
  • benchmark/react/cases/004-various-update/index.tsx
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/react/runtime/src/internal.ts
🧬 Code graph analysis (1)
benchmark/react/cases/004-various-update/index.tsx (2)
benchmark/react/src/hook.ts (1)
  • hook (5-16)
packages/react/runtime/src/internal.ts (1)
  • BackgroundSnapshotInstance (21-21)
🔇 Additional comments (5)
packages/react/runtime/lazy/internal.js (1)

8-8: Verify BackgroundSnapshotInstance exists on all targets.

This re-export assumes target[sExportsReactInternal].BackgroundSnapshotInstance is present across all runtimes. Please confirm the symbol is wired in every build variant; otherwise downstream imports may get undefined.

packages/react/runtime/src/internal.ts (1)

10-10: Ensure the source module actually exports BackgroundSnapshotInstance.

Double-check ./backgroundSnapshot.js named-exports BackgroundSnapshotInstance and that tree-shaking/cycles won’t elide it.

benchmark/react/cases/004-various-update/index.tsx (3)

6-9: Import looks correct; confirm type availability.

Good to import alongside SnapshotInstance. Ensure @lynx-js/react/internal types include BackgroundSnapshotInstance in all distributions.


14-14: Guard on compile-time macros may throw if not defined in non-Lynx envs.

Using __MAIN_THREAD__ directly relies on compile-time replacement. If this file runs outside the Lynx bundling context (e.g., plain Node/Vitest), it can ReferenceError. Confirm benchmarks always build with these macros.


94-94: Correct this typing for background hook.

Typing this: BackgroundSnapshotInstance matches the hooked prototype. Looks good.

Comment thread benchmark/react/cases/004-various-update/index.tsx
Comment thread benchmark/react/cases/004-various-update/index.tsx
@relativeci
Copy link
Copy Markdown

relativeci Bot commented Sep 4, 2025

Web Explorer

#4847 Bundle Size — 367.43KiB (0%).

e9caf02(current) vs 14d9475 main#4845(baseline)

Bundle metrics  Change 1 change
                 Current
#4847
     Baseline
#4845
No change  Initial JS 144.23KiB 144.23KiB
No change  Initial CSS 31.84KiB 31.84KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 219(-0.45%) 220
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.32% 3.32%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#4847
     Baseline
#4845
No change  JS 235.43KiB 235.43KiB
No change  Other 100.16KiB 100.16KiB
No change  CSS 31.84KiB 31.84KiB

Bundle analysis reportBranch hzy:p/hzy/bench_6Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Sep 4, 2025

React Example

#4856 Bundle Size — 237.5KiB (0%).

e9caf02(current) vs 14d9475 main#4854(baseline)

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#4856
     Baseline
#4854
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 163(+1.88%) 160
Regression  Duplicate Modules 68(+4.62%) 65
Change  Duplicate Code 46.97%(+2.49%) 45.83%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#4856
     Baseline
#4854
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.74KiB 91.74KiB

Bundle analysis reportBranch hzy:p/hzy/bench_6Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 4, 2025

CodSpeed Performance Report

Merging #1655 will not alter performance

Comparing hzy:p/hzy/bench_6 (e9caf02) with main (9e2c497)

🎉 Hooray! codspeed-cpp just leveled up to 1.2.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 42 untouched benchmarks
🆕 1 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 004-various-update-setAttribute__BatchedValues N/A 317.2 µs N/A

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: 1

♻️ Duplicate comments (1)
benchmark/react/cases/004-various-update/index.tsx (1)

87-110: Guard non-array values and use finally in the background path as well.

Same reliability concern: ensure stop/label even if the call throws, and avoid .length on non-arrays.

-    function(this: BackgroundSnapshotInstance, old, key, value) {
-      const values = value as unknown[];
-      if (
-        key === 'values' && values[values.length - 1] === 'stop-benchmark-true'
-      ) {
+    function(this: BackgroundSnapshotInstance, old, key, value) {
+      const v = value as unknown;
+      if (
+        key === 'values' &&
+        Array.isArray(v) &&
+        v.length > 0 &&
+        v[v.length - 1] === 'stop-benchmark-true'
+      ) {
         // we only care about the update that stops the benchmark
-
-        Codspeed.startBenchmark();
-        const ret = old!.call(this, key, value);
-        Codspeed.stopBenchmark();
-        Codspeed.setExecutedBenchmark(
-          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__BatchedValues`,
-        );
-        return ret;
+        Codspeed.startBenchmark();
+        try {
+          return old!.call(this, key, value);
+        } finally {
+          Codspeed.stopBenchmark();
+          Codspeed.setExecutedBenchmark(
+            `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__BatchedValues`,
+          );
+        }
       }
 
       return old!.call(this, key, value);
     },
🧹 Nitpick comments (2)
benchmark/react/cases/004-various-update/index.tsx (2)

14-14: Unify main-thread detection or declare macro types.

Prefer using the already-computed isMainThread for consistency, or ensure __MAIN_THREAD__ has an ambient type.

-if (typeof Codspeed !== 'undefined' && __MAIN_THREAD__) {
+if (typeof Codspeed !== 'undefined' && isMainThread) {

75-83: Always stop/label benchmarks even on throw.

Wrap with try/finally to avoid leaking an active benchmark and missing labels if the underlying setter throws.

-      Codspeed.startBenchmark();
-      const ret = old!.call(this, key, value);
-      Codspeed.stopBenchmark();
-      Codspeed.setExecutedBenchmark(
-        `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
-      );
-
-      return ret;
+      Codspeed.startBenchmark();
+      try {
+        return old!.call(this, key, value);
+      } finally {
+        Codspeed.stopBenchmark();
+        Codspeed.setExecutedBenchmark(
+          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
+        );
+      }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a37aa3 and 8df0da4.

📒 Files selected for processing (4)
  • benchmark/react/cases/004-various-update/index.tsx (6 hunks)
  • benchmark/react/src/hook.ts (1 hunks)
  • packages/react/runtime/lazy/internal.js (1 hunks)
  • packages/react/runtime/src/internal.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react/runtime/lazy/internal.js
  • packages/react/runtime/src/internal.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#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:

  • benchmark/react/cases/004-various-update/index.tsx
🧬 Code graph analysis (1)
benchmark/react/cases/004-various-update/index.tsx (2)
benchmark/react/src/hook.ts (1)
  • hook (5-16)
packages/react/runtime/src/internal.ts (1)
  • BackgroundSnapshotInstance (21-21)
🔇 Additional comments (3)
benchmark/react/cases/004-various-update/index.tsx (3)

6-9: Confirm BackgroundSnapshotInstance availability across build targets.

This import assumes @lynx-js/react/internal now exports BackgroundSnapshotInstance. Please verify the runtime/lazy and src internal exports are published in all bundles used by benchmarks.


56-64: Reindexing looks correct; verify enum alignment with runtime.

Mapping 10→ListItemPlatformInfo, 11→ListItemPlatformInfoSpread, 12→Spread matches the described reindex. Please confirm the producer side emits these exact indices.


178-178: Prop reindexing in JSX matches the updated attribute map.

Usage shifts (main-thread:ref → index 9; item-key → index 10; spread comments updated) are consistent with the new mapping.

Also applies to: 180-180, 190-190, 213-213, 215-215

Comment thread benchmark/react/src/hook.ts
Comment thread benchmark/react/cases/004-various-update/index.tsx
Comment thread benchmark/react/cases/004-various-update/index.tsx
upupming
upupming previously approved these changes Sep 4, 2025
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
benchmark/react/cases/004-various-update/index.tsx (1)

78-86: Always stop/label benchmark via finally in main-thread path.

If setAttribute throws, stopBenchmark and the label won’t run.

Apply:

-      Codspeed.startBenchmark();
-      const ret = old!.call(this, key, value);
-      Codspeed.stopBenchmark();
-      Codspeed.setExecutedBenchmark(
-        `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
-      );
-
-      return ret;
+      Codspeed.startBenchmark();
+      try {
+        return old!.call(this, key, value);
+      } finally {
+        Codspeed.stopBenchmark();
+        Codspeed.setExecutedBenchmark(
+          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__${name}`,
+        );
+      }
♻️ Duplicate comments (3)
benchmark/react/cases/004-various-update/index.tsx (2)

95-98: Guard against non-array value before accessing .length.

Prevents runtime errors when value isn’t an array.

Apply:

-      const values = value as unknown[];
-      if (
-        key === 'values' && values[values.length - 1] === 'stop-benchmark-true'
-      ) {
+      if (
+        key === 'values' &&
+        Array.isArray(value) &&
+        value.length > 0 &&
+        value[value.length - 1] === 'stop-benchmark-true'
+      ) {

101-107: Use try/finally in background path as well.

Ensure stop/label even if old!.call throws.

Apply:

-        Codspeed.startBenchmark();
-        const ret = old!.call(this, key, value);
-        Codspeed.stopBenchmark();
-        Codspeed.setExecutedBenchmark(
-          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__BatchedValues`,
-        );
-        return ret;
+        Codspeed.startBenchmark();
+        try {
+          return old!.call(this, key, value);
+        } finally {
+          Codspeed.stopBenchmark();
+          Codspeed.setExecutedBenchmark(
+            `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__BatchedValues`,
+          );
+        }
benchmark/react/src/hook.ts (1)

20-20: Fix TS global typing for __CreatePage (or access via globalThis).

Removing @ts-expect-error reintroduces “Cannot find name '__CreatePage'” without an ambient.

Apply one:

-export const isMainThread = typeof __CreatePage === 'function';
+export const isMainThread = typeof (globalThis as any).__CreatePage === 'function';

Or add an ambient (recommended):

// benchmark/react/globals.d.ts
declare const __CreatePage: unknown;
declare const __MAIN_THREAD__: boolean;
declare const __BACKGROUND__: boolean;
declare const __REPO_FILEPATH__: string;
declare const __webpack_chunkname__: string;
declare const Codspeed:
  | { startBenchmark(): void; stopBenchmark(): void; setExecutedBenchmark(name: string): void }
  | undefined;

Ensure tsconfig includes this d.ts.

🧹 Nitpick comments (1)
benchmark/react/cases/004-various-update/index.tsx (1)

105-105: Disambiguate background vs main labels.

Optional: prefix background labels to avoid future name collisions in reports.

Apply:

-          `${__REPO_FILEPATH__}::${__webpack_chunkname__}-setAttribute__BatchedValues`,
+          `${__REPO_FILEPATH__}::BTS::${__webpack_chunkname__}-setAttribute__BatchedValues`,
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8df0da4 and e9caf02.

📒 Files selected for processing (4)
  • benchmark/react/cases/004-various-update/index.tsx (2 hunks)
  • benchmark/react/src/hook.ts (1 hunks)
  • packages/react/runtime/lazy/internal.js (1 hunks)
  • packages/react/runtime/src/internal.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react/runtime/src/internal.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#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:

  • benchmark/react/cases/004-various-update/index.tsx
🧬 Code graph analysis (1)
benchmark/react/cases/004-various-update/index.tsx (2)
benchmark/react/src/hook.ts (1)
  • hook (5-16)
packages/react/runtime/src/internal.ts (1)
  • BackgroundSnapshotInstance (21-21)
🔇 Additional comments (3)
packages/react/runtime/lazy/internal.js (1)

7-9: BackgroundSnapshotInstance export verified
BackgroundSnapshotInstance is exported from packages/react/runtime/src/internal.ts, implemented in backgroundSnapshot.ts, and present in packages/react/runtime/lazy/internal.js.

benchmark/react/cases/004-various-update/index.tsx (2)

6-9: LGTM: internal import added for background hooks.

Importing BackgroundSnapshotInstance here aligns with the new runtime export.


90-113: Drop the numeric‐enum concern: ‘values’ is explicitly used as a string key in setAttribute and the implementation accepts string keys.

Likely an incorrect or invalid review comment.

@hzy hzy enabled auto-merge (squash) September 5, 2025 06:38
@hzy hzy merged commit e38dd13 into lynx-family:main Sep 8, 2025
70 of 72 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 27, 2026
3 tasks
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.

3 participants