spinframework / spinframework/spin
Host interface forward compatibility
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 310
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 24
Description
For language (toolchains) without reliable dead code elimination, Spin SDKs are faced with a forward-compatibility problem when adding new interface imports: if a host is missing any imported functions - even if they aren't actually used by the guest - linking will fail.
There are two related situations where this comes up:
- Adding a new interface:
outbound-mysql - Adding a method to an existing interface:
outbound-redis::del(the actual motivating example here)
Several approaches to address this:
-
Set a policy that all features must be released in Spin before being released for SDKs. To minimize confusion we probably wouldn't even want to merge features to SDKs before Spin.
-
Split major features into separate SDK packages and have users opt-in to each feature. Each package would have a minimum required Spin version. This doesn't solve forward-compatibility for additions within an interface (e.g.
outbound-redis::del), but could be combined with a function stubbing approach like below. -
Create a feature detection system for Spin imports. For example, each Spin feature interface could have a "dummy"
spin-feature-detection: func(). For any import module with this function, Spin would set a trapping stub function for any unknown import functions. This is roughly whatLinker::define_unknown_imports_as_trapsdoes, but would be scoped to these individual import modules.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by comparing the two compatibility scenarios and the three proposed approaches, including Wasmtime's define_unknown_imports_as_traps behavior. Done means selecting and documenting an approach for handling new interfaces and methods without breaking older hosts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- backend-api-design, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100