Skip to content

refactor: code structure of runtime#2436

Merged
HuJean merged 1 commit intomainfrom
p/code-structure
Apr 8, 2026
Merged

refactor: code structure of runtime#2436
HuJean merged 1 commit intomainfrom
p/code-structure

Conversation

@HuJean
Copy link
Copy Markdown
Collaborator

@HuJean HuJean commented Apr 7, 2026

Summary by CodeRabbit

Release Notes

  • Chores
    • Internal module reorganization to improve code structure and maintainability across the React runtime package. Import paths updated to reflect new module organization.

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

@HuJean HuJean requested review from Yradex and hzy as code owners April 7, 2026 11:21
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 7, 2026

🦋 Changeset detected

Latest commit: c7d9721

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

This PR includes changesets to release 0 packages

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

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 Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d40cbd3b-c32e-4870-9013-c3e1b2904e5f

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3d9b0 and c7d9721.

📒 Files selected for processing (28)
  • .changeset/bumpy-lizards-wear.md
  • packages/react/runtime/__test__/lifecycle.test.jsx
  • packages/react/runtime/__test__/list.test.jsx
  • packages/react/runtime/__test__/snapshot/ref.test.jsx
  • packages/react/runtime/__test__/utils/envManager.ts
  • packages/react/runtime/src/debug/profile.ts
  • packages/react/runtime/src/lifecycle/constant.ts
  • packages/react/runtime/src/lifecycle/event/delayLifecycleEvents.ts
  • packages/react/runtime/src/lifecycle/event/jsReady.ts
  • packages/react/runtime/src/lifecycle/patch/commit.ts
  • packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
  • packages/react/runtime/src/lifecycle/reload.ts
  • packages/react/runtime/src/list/list.ts
  • packages/react/runtime/src/list/listUpdateInfo.ts
  • packages/react/runtime/src/list/pendingListUpdates.ts
  • packages/react/runtime/src/lynx-api.ts
  • packages/react/runtime/src/lynx/calledByNative.ts
  • packages/react/runtime/src/lynx/tt.ts
  • packages/react/runtime/src/renderToOpcodes/hydrate.ts
  • packages/react/runtime/src/renderToOpcodes/opcodes.ts
  • packages/react/runtime/src/snapshot/backgroundSnapshot.ts
  • packages/react/runtime/src/snapshot/list.ts
  • packages/react/runtime/src/snapshot/platformInfo.ts
  • packages/react/runtime/src/snapshot/snapshot.ts
  • packages/react/runtime/src/snapshot/spread.ts
  • packages/react/runtime/src/worklet/ref/updateInitValue.ts
  • packages/react/runtime/types/types.d.ts
  • packages/react/testing-library/src/__tests__/list.test.jsx
✅ Files skipped from review due to trivial changes (23)
  • .changeset/bumpy-lizards-wear.md
  • packages/react/runtime/src/lifecycle/patch/commit.ts
  • packages/react/runtime/test/utils/envManager.ts
  • packages/react/runtime/src/lifecycle/patch/updateMainThread.ts
  • packages/react/runtime/types/types.d.ts
  • packages/react/runtime/src/lifecycle/reload.ts
  • packages/react/testing-library/src/tests/list.test.jsx
  • packages/react/runtime/src/snapshot/platformInfo.ts
  • packages/react/runtime/src/snapshot/list.ts
  • packages/react/runtime/src/list/listUpdateInfo.ts
  • packages/react/runtime/src/renderToOpcodes/opcodes.ts
  • packages/react/runtime/src/lifecycle/event/delayLifecycleEvents.ts
  • packages/react/runtime/test/lifecycle.test.jsx
  • packages/react/runtime/src/snapshot/backgroundSnapshot.ts
  • packages/react/runtime/src/renderToOpcodes/hydrate.ts
  • packages/react/runtime/src/list/list.ts
  • packages/react/runtime/src/lynx-api.ts
  • packages/react/runtime/src/worklet/ref/updateInitValue.ts
  • packages/react/runtime/src/lynx/calledByNative.ts
  • packages/react/runtime/test/list.test.jsx
  • packages/react/runtime/src/lifecycle/event/jsReady.ts
  • packages/react/runtime/test/snapshot/ref.test.jsx
  • packages/react/runtime/src/lynx/tt.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/react/runtime/src/snapshot/spread.ts
  • packages/react/runtime/src/snapshot/snapshot.ts
  • packages/react/runtime/src/debug/profile.ts

📝 Walkthrough

Walkthrough

This PR reorganizes module paths across the React runtime package by moving constants and utilities into more specific subdirectories (e.g., lifecycleConstant.jslifecycle/constant.js, hydrate.jsrenderToOpcodes/hydrate.js). No functional logic or exported API signatures change.

Changes

Cohort / File(s) Summary
Lifecycle constant imports
packages/react/runtime/__test__/lifecycle.test.jsx, packages/react/runtime/src/lifecycle/event/delayLifecycleEvents.ts, packages/react/runtime/src/lifecycle/event/jsReady.ts, packages/react/runtime/src/lifecycle/patch/commit.ts, packages/react/runtime/src/lifecycle/patch/updateMainThread.ts, packages/react/runtime/src/lifecycle/reload.ts, packages/react/runtime/src/list/list.ts, packages/react/runtime/src/lynx-api.ts, packages/react/runtime/src/lynx/calledByNative.ts, packages/react/runtime/src/lynx/tt.ts, packages/react/runtime/src/worklet/ref/updateInitValue.ts, packages/react/runtime/types/types.d.ts
Updated LifecycleConstant import source from lifecycleConstant.js to lifecycle/constant.js across multiple files.
Hydrate module relocation
packages/react/runtime/__test__/list.test.jsx, packages/react/runtime/src/lifecycle/reload.ts, packages/react/runtime/src/list/listUpdateInfo.ts, packages/react/runtime/src/lynx/calledByNative.ts, packages/react/runtime/src/renderToOpcodes/hydrate.ts, packages/react/runtime/src/renderToOpcodes/opcodes.ts, packages/react/runtime/src/snapshot/backgroundSnapshot.ts, packages/react/runtime/src/snapshot/list.ts
Redirected hydrate and related hydration utilities from hydrate.js to renderToOpcodes/hydrate.js.
Pending list updates relocation
packages/react/runtime/__test__/list.test.jsx, packages/react/runtime/__test__/snapshot/ref.test.jsx, packages/react/runtime/__test__/utils/envManager.ts, packages/react/runtime/src/lifecycle/patch/updateMainThread.ts, packages/react/runtime/src/lifecycle/reload.ts, packages/react/runtime/src/lynx/calledByNative.ts, packages/react/runtime/src/snapshot/platformInfo.ts, packages/react/runtime/src/snapshot/snapshot.ts, packages/react/runtime/src/snapshot/spread.ts, packages/react/testing-library/src/__tests__/list.test.jsx
Updated __pendingListUpdates and related list update imports from top-level to list/pendingListUpdates.js and list/listUpdateInfo.js.
Debug profiling refinement
packages/react/runtime/src/debug/profile.ts
Replaced locally defined noop function with imported noop from utils.js; fallback behavior for missing profiling methods now uses the shared utility.
Metadata
.changeset/bumpy-lizards-wear.md
Added new empty changeset metadata file with YAML frontmatter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • Yradex
  • hzy

Poem

🐰 Through module paths we hop and skip,
Constants grouped in organized clips,
Hydrate flows where it should dwell,
Pending lists in their own shell,
The runtime's structure, cleaner still! ✨

🚥 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 'refactor: code structure of runtime' accurately reflects the main changeset, which consists of reorganizing import paths across the runtime module structure to reflect a new directory hierarchy (e.g., moving lifecycle-related files into a lifecycle/ subdirectory, list utilities into list/, and render opcodes into renderToOpcodes/).

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch p/code-structure

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

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!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 7, 2026

Merging this PR will degrade performance by 25.46%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 70 untouched benchmarks
⏩ 21 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 40.3 ms +17.02%
basic-performance-div-1000 26.3 ms 35.3 ms -25.46%

Comparing p/code-structure (c7d9721) with main (5f2cea3)

Open in CodSpeed

Footnotes

  1. 21 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 Apr 7, 2026

React Example

#7133 Bundle Size — 236.8KiB (-0.02%).

c7d9721(current) vs 5f2cea3 main#7111(baseline)

Bundle metrics  Change 1 change
                 Current
#7133
     Baseline
#7111
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 38.46% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 179 179
No change  Duplicate Modules 70 70
No change  Duplicate Code 46.11% 46.11%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#7133
     Baseline
#7111
No change  IMG 145.76KiB 145.76KiB
Improvement  Other 91.05KiB (-0.05%) 91.09KiB

Bundle analysis reportBranch p/code-structureProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 7, 2026

React MTF Example

#266 Bundle Size — 206.05KiB (0%).

c7d9721(current) vs 5f2cea3 main#244(baseline)

Bundle metrics  no changes
                 Current
#266
     Baseline
#244
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 3 3
No change  Modules 173 173
No change  Duplicate Modules 67 67
No change  Duplicate Code 45.77% 45.77%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#266
     Baseline
#244
No change  IMG 111.23KiB 111.23KiB
No change  Other 94.81KiB 94.81KiB

Bundle analysis reportBranch p/code-structureProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 7, 2026

Web Explorer

#8708 Bundle Size — 728.84KiB (0%).

c7d9721(current) vs 5f2cea3 main#8686(baseline)

Bundle metrics  Change 2 changes
                 Current
#8708
     Baseline
#8686
No change  Initial JS 43.31KiB 43.31KiB
No change  Initial CSS 2.16KiB 2.16KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 10 10
Change  Modules 149(-0.67%) 150
No change  Duplicate Modules 11 11
Change  Duplicate Code 34.69%(+0.03%) 34.68%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#8708
     Baseline
#8686
No change  Other 384.62KiB 384.62KiB
No change  JS 342.07KiB 342.07KiB
No change  CSS 2.16KiB 2.16KiB

Bundle analysis reportBranch p/code-structureProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 7, 2026

React External

#252 Bundle Size — 590.6KiB (~+0.01%).

c7d9721(current) vs 5f2cea3 main#230(baseline)

Bundle metrics  Change 1 change
                 Current
#252
     Baseline
#230
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 30.93% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#252
     Baseline
#230
Regression  Other 590.6KiB (~+0.01%) 590.59KiB

Bundle analysis reportBranch p/code-structureProject dashboard


Generated by RelativeCIDocumentationReport issue

@HuJean HuJean force-pushed the p/code-structure branch from 3c3d9b0 to c7d9721 Compare April 7, 2026 12:31
@HuJean HuJean merged commit 338dc1c into main Apr 8, 2026
49 of 50 checks passed
@HuJean HuJean deleted the p/code-structure branch April 8, 2026 02:42
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