oxidecomputer / oxidecomputer/progenitor
Responses that aren't `()` should maybe be `#[must_use]`?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 136
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 14
Description
Here's a situation that I found myself in:
Before
- Crucible used to return
Result<HttpResponseOk<()>, HttpError>from a server endpoint (job_result_okin https://github.com/oxidecomputer/crucible/pull/654/files ) - This generated a client API which returned a
Result<(), _>type. The callsites all used?to check the error, but didn't bother assigning theOktype to a variable, because why bother?
After
- After that PR (crucible#654), the endpoint returned a structure --
JobResultOkResponse - However, all the callsites continued to ignore that result type, with no warning.
I think it's fair to say this isn't a "bug", but it's a pain-in-the-butt -- it requires all the callsites to be manually updated to not drop useful information on the floor. In our case, the #[must_use] declaration would have made it very clear what would need to change in the caller, and would be easy to dismiss if it wasn't relevant.
Contributor guide
No contributing guide indexed for this repository
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 comparing the generated client behavior described for Crucible’s job_result_ok endpoint before and after crucible#654, then trace how Progenitor represents non-() response types. Check the relevant generator tests and add coverage showing that ignored useful responses produce the intended #[must_use] guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100