Skip to content

fix(encoding): Fix incorrect fields count#11905

Open
quininer wants to merge 1 commit into
swc-project:mainfrom
quininer:x/fix-encoding-count
Open

fix(encoding): Fix incorrect fields count#11905
quininer wants to merge 1 commit into
swc-project:mainfrom
quininer:x/fix-encoding-count

Conversation

@quininer

Copy link
Copy Markdown
Contributor

Description:

Currently, our encoding mod does not correctly handle the ignore attr when get fields count.

BREAKING CHANGE:

This doesn't cause a problem now because both encode and decode use wrong count. However, it's important to note that this fix will result in a breaking change.

Related issue (if exists):

@quininer quininer requested a review from a team as a code owner May 28, 2026 08:01
@changeset-bot

changeset-bot Bot commented May 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 013d364

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.

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

@quininer quininer force-pushed the x/fix-encoding-count branch from 7769d2c to 013d364 Compare May 28, 2026 08:10
@codspeed-hq

codspeed-hq Bot commented May 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 189 untouched benchmarks
⏩ 120 skipped benchmarks1


Comparing quininer:x/fix-encoding-count (013d364) with main (4e2e9fc)2

Open in CodSpeed

Footnotes

  1. 120 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.

  2. No successful run was found on main (bcfff7d) during the generation of this report, so 4e2e9fc was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 013d364fda

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

let count = data.fields.len();
})
.collect::<Vec<_>>();
let count = fields.len();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add a changeset for the breaking encoding format

When this is released, this line changes the wire format for any derived struct with #[encoding(ignore)] fields, for example a struct with one serialized field now emits the field bare instead of an array. The commit also marks this as a breaking change, but there is no .changeset entry; tools/swc-releaser returns without bumping anything when the changeset is empty, so ast_node/exposed downstream crates could ship incompatible Encode/Decode behavior under the old versions.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant