oxidecomputer / oxidecomputer/omicron
Use of `bail_unless!` is highly problematic
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
Throughout trust quorum, and likely in other cases, we return errors when invariants aren't met. The easiest way to do this inside a transaction is to call the bail_unless! macro. Unfortunately this always returns a 500 error that is then likely to be presented to the API. It would be better to not use this, or to build a similar macro that can return better error codes.
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
Search the trust quorum transaction paths and all uses of the bail_unless! macro, starting with how invariant failures are converted into API responses. Determine the intended error codes and identify the affected callers; done means those invariant failures no longer become generic 500 responses and the behavior is covered by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100