registrystack / registrystack/registry-stack
Casework: emit a signed event when a work item changes state
- Dominant language
- Rust
- Stars
- 2
- Forks
- 0
- Avg merge
- 2h 57m
- Merged PRs (30d)
- 128
Description
## What Happened
Registry Casework receives a signed event from Registry BReg when a change request moves (`POST /events/sources/{sourceId}`), treats it as an invalidation hint, and reconciles with an authoritative read. Nothing flows the other way. When a work item changes state (offered, claimed, released, decided, applied, superseded) no event leaves Casework; the only outbox is the hash-chained audit journal.
Every programmatic consumer therefore polls:
- the public tutorial "Review BReg changes in Casework" loops on the inbox with a two second sleep and explains why;
- the OpenFn adaptor (`registrystack/openfn-language-registry-stack`, `packages/registry-casework`) ships a `pollCaseworkResults` job driven by an external schedule;
- a downstream acceptance harness polls `listWorkItems` every 100 ms for up to 15 s.
## Expected Behavior
One outbound event type, "work item state changed", delivered with the same destination configuration and `X-Registry-Signature` v1 contract BReg already uses from `registry-platform-httputil` (`EventDestinationRequestTemplate::event_delivery`). Payload: work item id, state, revision, source id, subject kind and id, occurrence id. No payload values, no decision text.
## Scope
- Reuse the BReg outbox and delivery worker pattern (five attempts, backoff, operator list and replay through `caseworkctl`).
- Runtime configuration binds logical destination ids to receivers exactly as `eventDestinations` does for BReg.
- No generic subscription API, no long-poll endpoint, no change-feed cursor. Webhooks are the one extension point; keep it that way.
- Document the event in `products/casework/README.md` and the public API reference, and make `caseworkctl dev` bind a loopback receiver the way `bregctl dev` does.
## Environment
0.30.0 and the `caseworkctl dev --source-project` branch.
Triage: next release after the tutorial ships. Related: #936, #1002 (dev-time delivery to an external receiver).
Contributor guide
Research direction
Start by tracing the existing BReg outbox and delivery worker, including EventDestinationRequestTemplate::event_delivery, then inspect the eventDestinations configuration and caseworkctl dev path. Done means state-change events use the stated payload and delivery behavior, replay and loopback development flows work, and products/casework/README.md plus the public API reference document the event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend, devtools, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100