Skip to content

fix: some behavior for [hidden DSL] only#2510

Merged
PupilTong merged 2 commits intolynx-family:mainfrom
PupilTong:p/hw/fix-create-component-entry-name
Apr 23, 2026
Merged

fix: some behavior for [hidden DSL] only#2510
PupilTong merged 2 commits intolynx-family:mainfrom
PupilTong:p/hw/fix-create-component-entry-name

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Apr 22, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed Card component attribute handling to prevent unintended entry name assignment
    • Added cardType resolution support for legacy JSON Lynx bundles

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

@PupilTong PupilTong self-assigned this Apr 22, 2026
@PupilTong PupilTong requested a review from Sherry-hue as a code owner April 22, 2026 13:34
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: de4f7ea

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

This PR includes changesets to release 9 packages
Name Type
@lynx-js/web-core Patch
upgrade-rspeedy Patch
@lynx-js/web-rsbuild-server-middleware Patch
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
create-rspeedy Patch
@lynx-js/web-worker-rpc Patch
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/rspeedy 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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

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

Files with missing lines Patch % Lines
...web-core/ts/server/elementAPIs/createElementAPI.ts 66.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

This PR introduces fixes and improvements to the Lynx web-core platform by skipping the lynxEntryNameAttribute assignment for Card components, replacing hardcoded attribute keys with constants throughout client and server element API implementations, and adding cardType resolution for legacy JSON Lynx bundles.

Changes

Cohort / File(s) Summary
Changesets
.changeset/fix-card-entry-name.md, .changeset/solid-boats-lead.md
Documentation entries for patch releases covering the Card entry name fix and legacy JSON Lynx cardType resolution.
Tests
packages/web-platform/web-core/tests/element-apis.spec.ts
Added test case verifying that lynxEntryNameAttribute is null for components with __Card__ entry name.
Client-side Element APIs
packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts, packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts
Updated component creation to skip entry name attribute for Card entries; added cardType fallback resolution chain for legacy bundles.
Server-side Element APIs
packages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts
Replaced hardcoded attribute keys with imported constants (lynxEntryNameAttribute, lynxUniqueIdAttribute, lynxDefaultOverflowVisibleAttribute); updated entry name assignment to exclude Card entries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • lynx-family/lynx-stack#1622: Introduces and defines the lynxEntryNameAttribute constant that this PR depends on and uses throughout client and server element API implementations.

Suggested labels

platform:Web

Suggested reviewers

  • Sherry-hue
  • Yradex

Poem

🐰 A bunny hops with glee today,
Cards skip their names in every way,
Constants replace the hardcoded strings,
Legacy bundles get their wings,
The Web grows stronger, clean and bright! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title is vague and generic, using unclear language like 'some behavior for [hidden DSL] only' that does not convey meaningful information about the actual changes made. Revise the title to be more specific and descriptive of the actual changes, such as 'fix: skip lynxEntryNameAttribute for Card and use constants for element APIs' based on the commit messages and code changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

Caution

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

⚠️ Outside diff range comments (1)
packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts (1)

343-355: ⚠️ Potential issue | 🟡 Minor

Minor: redundant json.pageConfig?.cardType in fallback.

Since config was already spread from json.pageConfig on line 345, config.cardType is effectively json.pageConfig?.cardType at this point. The fallback chain json.cardType ?? json.pageConfig?.cardType ?? 'react' could be simplified to json.cardType ?? config.cardType ?? 'react' (mirroring the pattern used for appType on line 353). Functionally equivalent, just tidier.

Also note that config.cardType is only initialized inside the lepusCode?.root string branch; for JSON bundles that don't match that legacy shape, cardType remains whatever came from pageConfig (possibly undefined). Confirm that's the intended scope given PageConfig.cardType is typed as a required string downstream.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts`
around lines 343 - 355, Replace the redundant fallback expression so cardType
uses the already-spread config: change the assignment config.cardType =
json.cardType ?? json.pageConfig?.cardType ?? 'react' to config.cardType =
json.cardType ?? config.cardType ?? 'react' inside the lepusCode.root branch;
additionally, if PageConfig.cardType must always be present downstream, ensure
config.cardType is initialized outside the lepusCode?.root branch (e.g., set
config.cardType = config.cardType ?? json.cardType ?? 'react' immediately after
spreading json.pageConfig) so non-legacy bundles receive a sensible default.
🧹 Nitpick comments (2)
packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts (1)

227-232: Consistency: __UpdateComponentInfo still sets lynxEntryNameAttribute for __Card__.

__CreateComponent now skips the attribute when entryName === '__Card__', but __UpdateComponentInfo at lines 371-373 still unconditionally sets lynxEntryNameAttribute when entry is truthy. If a caller later updates a component with entry: '__Card__', the sentinel will leak into the DOM, defeating the fix. Consider applying the same guard there (and symmetrically in the server-side API).

♻️ Suggested guard for `__UpdateComponentInfo`
-        if (entry) {
+        if (entry && entry !== '__Card__') {
           element.setAttribute(lynxEntryNameAttribute, entry);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts`
around lines 227 - 232, The update path (__UpdateComponentInfo) currently
unconditionally sets lynxEntryNameAttribute when entry is truthy, which can
reintroduce the '__Card__' sentinel into the DOM; modify the logic in
__UpdateComponentInfo to only call dom.setAttribute(lynxEntryNameAttribute,
entry) when entry is truthy AND entry !== '__Card__' (matching the guard added
to __CreateComponent), and apply the same conditional on the server-side API
counterpart so the '__Card__' sentinel is never written back into DOM
attributes.
packages/web-platform/web-core/tests/element-apis.spec.ts (1)

131-144: Optional: also cover server __CreateComponent and __UpdateComponentInfo.

The new test covers the client __CreateComponent path only. Since the same __Card__-skip rule was mirrored in ts/server/elementAPIs/createElementAPI.ts, adding an analogous assertion under the existing Server Element APIs SSR Propagation describe block (and for __UpdateComponentInfo if the guard is added) would prevent regressions on either side.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/tests/element-apis.spec.ts` around lines 131 -
144, Add tests that exercise the server-side implementations to mirror the
client test for dropping the '__Card__' entry name: in the existing "Server
Element APIs SSR Propagation" describe block add assertions that calling the
server __CreateComponent implementation (from
ts/server/elementAPIs/createElementAPI.ts) returns an element whose
lynxEntryNameAttribute is null when passed '__Card__', and if you add the same
guard to __UpdateComponentInfo also add an analogous assertion for that
function. Locate and call the server-side helpers (the server __CreateComponent
and __UpdateComponentInfo functions) and assert via __GetAttributeByName that
the lynxEntryNameAttribute is null to prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/fix-card-entry-name.md:
- Line 5: Update the changeset summary to remove the stray Markdown bold markers
and use the literal sentinel string __Card__ (or escape the underscores) so it
renders correctly in release notes; locate the line containing "**Card**" in the
changeset and replace it with the literal sentinel string __Card__ (or use
escaped underscores like \_\_Card\_\_) to avoid unintended bold formatting.

---

Outside diff comments:
In `@packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts`:
- Around line 343-355: Replace the redundant fallback expression so cardType
uses the already-spread config: change the assignment config.cardType =
json.cardType ?? json.pageConfig?.cardType ?? 'react' to config.cardType =
json.cardType ?? config.cardType ?? 'react' inside the lepusCode.root branch;
additionally, if PageConfig.cardType must always be present downstream, ensure
config.cardType is initialized outside the lepusCode?.root branch (e.g., set
config.cardType = config.cardType ?? json.cardType ?? 'react' immediately after
spreading json.pageConfig) so non-legacy bundles receive a sensible default.

---

Nitpick comments:
In `@packages/web-platform/web-core/tests/element-apis.spec.ts`:
- Around line 131-144: Add tests that exercise the server-side implementations
to mirror the client test for dropping the '__Card__' entry name: in the
existing "Server Element APIs SSR Propagation" describe block add assertions
that calling the server __CreateComponent implementation (from
ts/server/elementAPIs/createElementAPI.ts) returns an element whose
lynxEntryNameAttribute is null when passed '__Card__', and if you add the same
guard to __UpdateComponentInfo also add an analogous assertion for that
function. Locate and call the server-side helpers (the server __CreateComponent
and __UpdateComponentInfo functions) and assert via __GetAttributeByName that
the lynxEntryNameAttribute is null to prevent regressions.

In
`@packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts`:
- Around line 227-232: The update path (__UpdateComponentInfo) currently
unconditionally sets lynxEntryNameAttribute when entry is truthy, which can
reintroduce the '__Card__' sentinel into the DOM; modify the logic in
__UpdateComponentInfo to only call dom.setAttribute(lynxEntryNameAttribute,
entry) when entry is truthy AND entry !== '__Card__' (matching the guard added
to __CreateComponent), and apply the same conditional on the server-side API
counterpart so the '__Card__' sentinel is never written back into DOM
attributes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11b47273-3189-415f-a8f9-962f7b15f41b

📥 Commits

Reviewing files that changed from the base of the PR and between d8cdd7c and de4f7ea.

📒 Files selected for processing (6)
  • .changeset/fix-card-entry-name.md
  • .changeset/solid-boats-lead.md
  • packages/web-platform/web-core/tests/element-apis.spec.ts
  • packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts
  • packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts
  • packages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts

Comment thread .changeset/fix-card-entry-name.md
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will degrade performance by 7.98%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 80 untouched benchmarks
⏩ 26 skipped benchmarks1

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

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 43.1 ms 46.8 ms -7.98%

Comparing PupilTong:p/hw/fix-create-component-entry-name (de4f7ea) with main (d8cdd7c)

Open in CodSpeed

Footnotes

  1. 26 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 23, 2026

React External

#662 Bundle Size — 679.93KiB (0%).

de4f7ea(current) vs 7f6fc9c main#658(baseline)

Bundle metrics  no changes
                 Current
#662
     Baseline
#658
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 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  no changes
                 Current
#662
     Baseline
#658
No change  Other 679.93KiB 679.93KiB

Bundle analysis reportBranch PupilTong:p/hw/fix-create-compon...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

React Example

#7544 Bundle Size — 225.23KiB (0%).

de4f7ea(current) vs 7f6fc9c main#7540(baseline)

Bundle metrics  no changes
                 Current
#7544
     Baseline
#7540
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
No change  Modules 179 179
No change  Duplicate Modules 69 69
No change  Duplicate Code 44.57% 44.57%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7544
     Baseline
#7540
No change  IMG 145.76KiB 145.76KiB
No change  Other 79.47KiB 79.47KiB

Bundle analysis reportBranch PupilTong:p/hw/fix-create-compon...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

Web Explorer

#9116 Bundle Size — 899.85KiB (-0.02%).

de4f7ea(current) vs 7f6fc9c main#9112(baseline)

Bundle metrics  Change 3 changes
                 Current
#9116
     Baseline
#9112
No change  Initial JS 44.46KiB 44.46KiB
No change  Initial CSS 2.22KiB 2.22KiB
Change  Cache Invalidation 27.9% 0%
No change  Chunks 9 9
No change  Assets 11 11
Change  Modules 229(+0.44%) 228
No change  Duplicate Modules 11 11
Change  Duplicate Code 27.2%(-0.33%) 27.29%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#9116
     Baseline
#9112
Improvement  JS 495.71KiB (-0.04%) 495.9KiB
No change  Other 401.92KiB 401.92KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch PupilTong:p/hw/fix-create-compon...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

React MTF Example

#676 Bundle Size — 196.39KiB (0%).

de4f7ea(current) vs 7f6fc9c main#672(baseline)

Bundle metrics  no changes
                 Current
#676
     Baseline
#672
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 66 66
No change  Duplicate Code 44.07% 44.07%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#676
     Baseline
#672
No change  IMG 111.23KiB 111.23KiB
No change  Other 85.15KiB 85.15KiB

Bundle analysis reportBranch PupilTong:p/hw/fix-create-compon...Project dashboard


Generated by RelativeCIDocumentationReport issue

@PupilTong PupilTong merged commit 30f0277 into lynx-family:main Apr 23, 2026
121 of 128 checks passed
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