Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm plugins are not backward compatible #5060

Open
kwonoj opened this issue Jun 28, 2022 · 2 comments
Open

Wasm plugins are not backward compatible #5060

kwonoj opened this issue Jun 28, 2022 · 2 comments
Assignees
Milestone

Comments

@kwonoj
Copy link
Member

kwonoj commented Jun 28, 2022

Describe the feature

This is by far the biggest blocker for the official release for the plugin feature. (I thought I filed this already somehow).

The main issue in here is reducing chances of breaking changes for the plugin. There are 3 possible cases which causes diverge between plugins to the host for serialization / deserialization, namely

  • adding a new property into an existing ast struct
  • removing a new property from an existing ast struct
  • rename existing property from an ast struct

Each time this happens, the plugin will not be able to run on the newer versions of swc include those changes. These kind of breaking change itself is unavoidable unfortunately, but also we may be able to reduce the chances of it or at least avoid it happening unexpectedly.

We'll attempt to follow versioned struct approach suggested by underlying serialization mechanism (https://github.com/rkyv/rkyv/blob/master/examples/backwards_compat/src/main.rs) with compiler flags. When we need a possible breaking changes it'll be guarded by flags, providing backward compatibility as much as it can. Still worth mentioning this only applies to adding part - removing, or renaming is a clear breaking change we can't avoid to request plugin bumps up with the latest changes. At least, we hope those kind of operation won't happen that frequently.

Babel plugin or link to the feature description

No response

Additional context

#3540

@kwonoj kwonoj self-assigned this Jun 28, 2022
@kwonoj kwonoj added this to the Planned milestone Jun 28, 2022
@kdy1 kdy1 pinned this issue Jan 23, 2024
@kdy1 kdy1 changed the title Versioned struct for the plugin-host serialization Wasm plugins are not backward compatible Jan 24, 2024
@thesayyn
Copy link

FWIW, capn solves this is really good way, there's not really a good way to solve this problem other than inventing a clever encoding mechanism like this.

@RobinClowers
Copy link

I'm just trying out SWC and this issue is pretty painful for my team. I was excited to find https://github.com/pmndrs/swc-jotai, but then discovered they are pretty far behind on the core version, so to get everything working, I would have to manually downgrade things until I find a set of versions that work together.

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

No branches or pull requests

3 participants