Skip to content

feat(http): size-exceeded error variant#891

Open
ricochet wants to merge 3 commits intomainfrom
wasi-http-p3-size-exceeded
Open

feat(http): size-exceeded error variant#891
ricochet wants to merge 3 commits intomainfrom
wasi-http-p3-size-exceeded

Conversation

@ricochet
Copy link
Contributor

@ricochet ricochet commented Feb 26, 2026

Opting for documenting two floors, one for individual fields and the other for aggregate.

Exceeding implementation defined limits will fail with header-error.size-exceeded.

Specific minimum sizes are intentionally left unspecified. Implementations operate in diverse environments with varying constraints, so limits are implementation-defined.

Making operations fallible with size-exceeded is sufficient to ensure correct error handling without prescribing specific thresholds.

Part of #889

@ricochet ricochet requested a review from a team as a code owner February 26, 2026 18:56
@github-actions github-actions bot added the P-http Proposal: wasi-http label Feb 26, 2026
@pchickey
Copy link
Contributor

pchickey commented Feb 26, 2026

This looks like a good fix to the p3 spec. But, I don't think this fully resolves #889, because we also need to add docs to the p2 spec as well.

@ricochet
Copy link
Contributor Author

This looks like a good fix to the p3 spec. But, I don't think this fully resolves #889, because we also need to add docs to the p2 spec as well.

Ah good call, we should at least add docs to p2. I believe adding to the error variant in p2 would be a breaking change. We could introduce a new type error and mirror existing methods/funcs to fail with the new error type. What do you think?

Opting for documenting two floors, one for individual fields
and the other for aggregate. Exceeding either
will fail with `header-error.size-exceeded`.

Resolves #889
@ricochet ricochet force-pushed the wasi-http-p3-size-exceeded branch from 6b462c1 to 2675aa0 Compare February 26, 2026 20:33
@ricochet ricochet requested a review from a team as a code owner February 26, 2026 20:33
@github-actions github-actions bot added P-cli Proposal: wasi-cli dependencies Pull requests that update a dependency file labels Feb 26, 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these unrelated changes?

@ricochet
Copy link
Contributor Author

ricochet commented Feb 27, 2026 via email

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Feb 27, 2026

If we want to be defensive about the 0.3.x target, we could also consider adding an additional other variant too. In Rust core::io::ErrorKind has an Other variant which is intended to be used for any variants not captured by the existing variants. This has been historically useful because up to Rust 1.40 (November 2019) Rust did not have support for the #[non_exhaustive] attribute, and so ErrorKind could not be extended with more variants.

I checked and we already have other(string) variants for method and scheme. error-code also has a defensive variant (internal-error(option<string>)). Do people have thoughts about applying that more broadly?


edit: went ahead and filed a standalone issue for this: #892

Defensively extend the variants for http, related to #892

I used option<string> to match error-code's internal-error(option<string>)
/// string for an unstructured description of the error. Users should not
/// depend on the string for diagnosing errors, as it's not required to be
/// consistent between implementations.
other(option<string>),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used other(option<string>) to match error-code's internal-error(option<string>)

I could argue for the description being required, but we should aim to keep these two consistent.

@lukewagner
Copy link
Member

Looks good to me too w.r.t #892.

Specific minimum sizes are intentionally left unspecified. Implementations operate in diverse environments with varying constraints, so limits are implementation-defined.

Making operations fallible with size-exceeded is sufficient
to ensure correct error handling without prescribing
specific thresholds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file P-cli Proposal: wasi-cli P-http Proposal: wasi-http

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants