oxidecomputer / oxidecomputer/progenitor

Responses that aren't `()` should maybe be `#[must_use]`?

Open
#429 4 comments 0 reactions 0 assignees View on GitHub

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_ok in 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 the Ok type 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.