spinframework / spinframework/spin
Replace pervasive use of WASIp2 `ErrorCode` type with something more flexible
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 310
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 24
Description
As of this writing, the spin-factor-outbound-http, spin-http, and spin-trigger-http all use the wasmtime_wasi_http::p2::bindings::http::types::ErrorCode type pervasively, either directly or via the wasmtime_wasi_http::body::Hyper{Outgoing, Incoming}Body type aliases. Those types are used to model each combination of incoming and outgoing requests and responses. This kind of made sense given that WASIp2 was our focus, and we could adapt the deprecated spin:http implementation to use the same types.
Now that we're adding WASIp3 support, though, using WASIp2 types everywhere makes less sense, so I took a stab at changing that. Specifically, I started switching from using BoxBody<Bytes, ErrorCode> to hyper::body::Incoming for incoming bodies and BoxBody<Bytes, Box<dyn std::error::Error>> for outgoing ones. However, that broke certain assumptions about the same types being used for incoming and outgoing bodies, and it greatly expanded the scope of that PR.
Consequently, I'm doing the "easy" thing for that PR, which is to make the WASIp3 implementations use the p2 types, converting as necessary. That's not a great long term approach, though, hence this issue.
Open questions:
- What type(s) do we want to use to represent HTTP errors in Spin?
- Do we want to use the same error type for both incoming and outgoing bodies?
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
Start by reviewing the ErrorCode usages in spin-factor-outbound-http, spin-http, and spin-trigger-http, including the HyperOutgoingBody and HyperIncomingBody aliases. Compare those assumptions with the WASIp3 work referenced in the issue; done means agreeing on flexible incoming and outgoing HTTP error representations and replacing the pervasive WASIp2-specific types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- backend-api-design, networking
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100