Skip to content

Conversation

@DylanPiercey
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2025

🦋 Changeset detected

Latest commit: 8b11f5e

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

This PR includes changesets to release 2 packages
Name Type
marko Patch
@marko/runtime-tags 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

coderabbitai bot commented Dec 16, 2025

Walkthrough

This pull request implements serialization behavior for input passed between Marko's tags API and class API components. A changeset declares patch versions for "marko" and "@marko/runtime-tags". The changes introduce a deserialization hook in the DOM runtime that remaps numeric identifiers using runtime state. The HTML runtime is updated to extract and serialize component input, stripping the toJSON property before passing it through a modified component scope function. The writeSetScopeForComponent function signature is expanded to accept an additional parameter for the serialized input, ensuring consistent handling of component data across both runtime paths.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether the description relates to the changeset. Add a pull request description that explains the purpose, context, and impact of these serialization changes for better code review understanding.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the changeset: serializing input passed from tags API to class API component, which is the primary purpose of the changes across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 interop-fixes-12-16-25

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d57d705 and 8b11f5e.

⛔ Files ignored due to path filters (12)
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-basic-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-basic-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-class-in-components-in-tags-dir/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-class-in-components-in-tags-dir/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-events-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-events-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-nested-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-nested-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-tag-params-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-tag-params-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (4)
  • .changeset/wide-pigs-enjoy.md (1 hunks)
  • packages/runtime-class/src/runtime/helpers/tags-compat/runtime-dom.js (2 hunks)
  • packages/runtime-class/src/runtime/helpers/tags-compat/runtime-html.js (2 hunks)
  • packages/runtime-tags/src/html/compat.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: rturnq
Repo: marko-js/marko PR: 2937
File: packages/runtime-tags/src/html/writer.ts:294-310
Timestamp: 2025-11-07T18:14:15.964Z
Learning: In the Marko runtime serializer (packages/runtime-tags/src/html/writer.ts and related serialization code), undefined property values are not serialized to the output. This means patterns like `{ [key]: condition ? value : undefined }` will omit the property entirely when the condition is false, which is the intended behavior for optional properties.
📚 Learning: 2025-11-07T18:14:15.964Z
Learnt from: rturnq
Repo: marko-js/marko PR: 2937
File: packages/runtime-tags/src/html/writer.ts:294-310
Timestamp: 2025-11-07T18:14:15.964Z
Learning: In the Marko runtime serializer (packages/runtime-tags/src/html/writer.ts and related serialization code), undefined property values are not serialized to the output. This means patterns like `{ [key]: condition ? value : undefined }` will omit the property entirely when the condition is false, which is the intended behavior for optional properties.

Applied to files:

  • .changeset/wide-pigs-enjoy.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test: node@24
  • GitHub Check: test: node@22
  • GitHub Check: test: node@20
🔇 Additional comments (5)
packages/runtime-tags/src/html/compat.ts (1)

70-72: Clean API extension for serialized input.

The function signature is properly extended to accept the serialized input (m5i). Based on learnings from this codebase, if m5i is undefined, it will be omitted from the serialized output, which is the intended behavior for optional properties.

packages/runtime-class/src/runtime/helpers/tags-compat/runtime-dom.js (1)

50-56: Verify the assumption that the runtime state path always exists when o[2] is numeric.

The nested property access self[global.runtimeId][global.renderId].s[o[2]].m5i assumes all intermediate properties exist. If any property in this chain is undefined or missing, this will throw a runtime error.

Is this an internal contract where the presence of a numeric o[2] guarantees the path exists? If not, consider adding defensive checks:

-  if (typeof o[2] === "number") {
-    o[2] = self[global.runtimeId][global.renderId].s[o[2]].m5i;
-  }
+  if (typeof o[2] === "number") {
+    const renderState = self[global.runtimeId]?.[global.renderId];
+    o[2] = renderState?.s?.[o[2]]?.m5i;
+  }
packages/runtime-class/src/runtime/helpers/tags-compat/runtime-html.js (2)

46-46: Good defensive change to use optional chaining.

Using componentDefs?.length properly handles both undefined/null and empty array cases.


201-209: Well-structured serialization flow.

The implementation correctly:

  1. Extracts the raw input from the component
  2. Strips the toJSON property to create serializeInput (avoiding circular serialization)
  3. Overrides rawInput.toJSON to return branchId for scope reference
  4. Passes the clean serializeInput to writeSetScopeForComponent

This ensures the input is properly serialized without including the toJSON method itself.

.changeset/wide-pigs-enjoy.md (1)

1-6: Changeset looks good.

Patch version bumps are appropriate for this serialization fix, and the description accurately summarizes the change.


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

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.06%. Comparing base (d57d705) to head (8b11f5e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3009   +/-   ##
=======================================
  Coverage   89.05%   89.06%           
=======================================
  Files         375      375           
  Lines       46634    46647   +13     
  Branches     3939     3938    -1     
=======================================
+ Hits        41532    41545   +13     
  Misses       5052     5052           
  Partials       50       50           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DylanPiercey DylanPiercey merged commit e7a0b33 into main Dec 16, 2025
11 checks passed
@DylanPiercey DylanPiercey deleted the interop-fixes-12-16-25 branch December 16, 2025 22:12
@github-actions github-actions bot mentioned this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants