registrystack / registrystack/registry-stack
Casework collapses every first-attempt BReg refusal into work-item.not-offered
- Dominant language
- Rust
- Stars
- 2
- Forks
- 0
- Avg merge
- 2h 55m
- Merged PRs (30d)
- 130
Description
## What Happened
When a decision reaches BReg for the first time and BReg answers with any validated 4xx (400, 401, 403, 404, 409, 412, 422), the source adapter in `registry-casework-breg` maps it to `SourceAdapterError::DefinitiveRefusal`, and Casework answers `409 work-item.not-offered` with the detail "The registry did not offer this action to you. Refresh to check again."
That advice is right for a stale action and wrong for everything else in that set: a 422 on action input, a 404 on a record that moved, a 403 on a reviewer claim mismatch. The caller reloads and gets the same answer.
A reason on `approve` or `apply` used to fall into the same bucket as 502 `source.bad-gateway`; that case is now decided before the durable attempt as `request.reason-unsupported`, so this issue covers the remaining classes.
## Expected Behavior
Casework preserves the BReg status class in the mapping and gives each its own problem code, for example:
- precondition and conflict (409, 412) stay `work-item.not-offered` or `work-item.superseded`;
- invalid input (400, 422) becomes a 4xx Casework code that says the request, not the item, is wrong;
- not found (404) becomes a code that says the source record is no longer where the binding says;
- authorization (401, 403) becomes a code that points at the reviewer binding.
Detail text stays static and value-free, as every Casework problem is today.
## Reproduction
With the `caseworkctl dev --source-project` session from the tutorial, send a decision whose body BReg rejects as unprocessable (for example a malformed stage) and observe `409 work-item.not-offered`.
## Environment
0.30.0 and the `caseworkctl dev --source-project` branch.
Triage: next release. Mapping change plus tests in `crates/registry-casework/src/http.rs` and `crates/registry-casework-breg/src/lib.rs`; no new surface.
Contributor guide
Research direction
Start with the mapping in crates/registry-casework/src/http.rs and the source adapter in crates/registry-casework-breg/src/lib.rs; use the caseworkctl dev --source-project reproduction with an unprocessable decision body. Add tests covering the validated BReg status classes, and consider the work done when each class produces its intended static Casework problem code without collapsing into work-item.not-offered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100