Repository navigation
feat(rust): add the udibo-http-error crate - #22
Merged
Merged
Conversation
Add a Cargo workspace in rust/ with the udibo-http-error crate: HttpError with a builder and status shortcuts, ProblemDetails, the default title and detail of every status, parsing of another service's problem response, and IntoResponse behind the axum feature. It passes the shared conformance vectors. CI copies oauth2's Rust gates: fmt, clippy, docs, tests on four platforms, a cargo-hack feature matrix, MSRV 1.88, a wasm32 build, cargo-deny and a 3-day release-age check, behind one Rust CI job. Publishing through release-plz stays off until RUST_RELEASE_ENABLED is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
The workflow policy test let only ci.yml's release job use an environment or mint an OIDC token. Add rust-release.yml's release job, and pin that it uses the crates-io environment and runs only once RUST_RELEASE_ENABLED is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
Member
Author
|
The TypeScript test failures on ff56e6e came from the workflow policy test, which allowed only the npm release job an environment and OIDC token. 6f75b42 adds the crates.io release job to it. Generated by Claude Code |
Add vectors for problem members that differ from a standard member only by case (kept as extensions when parsing and serializing) and for a repeated Set-Cookie response header. A vector header value may now be a list of strings for a field sent more than once. The TypeScript and Rust vector readers build and compare every value of a repeated field instead of keeping the last one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
Add a parse and a serialize vector carrying an empty object, an empty list, an object keyed "0" and "1", nested false/0/null values, a string ID beyond 2^53, and a title and detail of "0". Document that every package exchanges integers in the I-JSON range exactly, that larger IDs travel as decimal strings, and that no package quotes or rounds a number to match another language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
Replace the two rows rebuilt from the spike's description with the candidate rows it published (handoffs/port-spikes/php/candidate-vectors.json in udibo at db369a7). They cover the same shapes; the precision observation stays out of the vectors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
This was referenced Dec 5, 2026
…r contract Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
KyleJune
marked this pull request as ready for review
December 5, 2026 16:36
|
🎉 This PR is included in version 0.13.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Kyle · project thread
Summary
Adds
rust/, a Cargo workspace with theudibo-http-errorcrate, the Rust counterpart of@udibo/http-error. It passes the sharedconformance/vectors/problem-details.json, so both languages produce the same problem details for the same error. Closes #19 apart from publishing, which waits for a crates.io account.API
HttpError::builder()withstatus(au16orhttp::StatusCode),message,title,detail,problem_type,instance,extension(s),header(s),exposeandsource.build()returnsInvalidStatusoutside 400 to 599.HttpError::not_found(msg),bad_request,unauthorized,forbidden,conflict,unprocessable_content,too_many_requests,internal,service_unavailable, plusHttpError::new(status, msg).HttpError::from_error(err)turns an unexpected failure into an unexposed 500 that keeps it as thesource.HttpError::from_problem_body(status, bytes)reads another service's problem response, by the same parse rules as the TypeScript package'sHttpError.from(response).ProblemDetailsserializes with serde and never lets an extension replace a standard member.default_title(status)anddefault_detail(status)give the same table as TypeScript.axum:impl IntoResponse for HttpError.The member rules match TypeScript exactly.
HttpErrorimplementsstd::error::ErrorandClone, and the crate builds forwasm32-unknown-unknown.Shared vectors added
These come from the Go port spike.
StatusandTitlestay extensions and never becomestatusortitle.Set-Cookieheader, and both values must come back in order.Object.fromEntries, which kept only the last value. Restoring it makes the new case fail.IntoResponsekeeps repeated headers.From the PHP spike, one parse case and one serialize case check that extension JSON shapes survive. They cover
{},[], an object keyed"0"/"1", nestedfalse/0/null, a string ID above 2^53, and a title and detail of"0".The conformance README now states the number contract:
The crate README says the same. The TypeScript README is left for a separate
docs:commit, because a change to it inside thisfeatsquash would cut a TypeScript release.No published TypeScript file changes, so this cuts no TypeScript release.
CI and release
.github/workflows/rust.ymlcopies oauth2's gates:Rust CIgate job.rust/.cargo/config.tomlsetsglobal-min-publish-age = "3 days".rust-release.ymlruns release-plz with the tagudibo-http-error-v<version>. It is off untilRUST_RELEASE_ENABLEDis set. Rust-only commits change neither TypeScript CI (path filter) nor TypeScript releases (the release plugin counts onlytypescript/andconformance/).Known red until 2026-12-05 16:29 UTC: the release-age job refuses
pin-project-lite0.2.19, published 2026-12-02.axum-coreneeds it, and every earlier version has been yanked, so cargo-deny refuses those instead. It ages past 3 days tomorrow afternoon, and CI will be re-run then. No exemption was added.Testing
Run locally from
rust/, each passing:cargo fmt --check-D warningscargo docwith-D warningscargo test --all-features: 3 conformance tests over 26 serialize, 22 parse and 200 defaults cases; 14 behavior tests; 3 axum tests; 10 doc tests, including the crate READMEcargo hack --feature-powerset --depth 2cargo +1.88 checkcargo deny checknode --test scripts/*.test.tsMutation checks:
nullmembers as making a body a problem also fails them.Related Issues
Closes #19. Part of udibo/oauth2#275.
https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
Generated by Claude Code