Skip to content

Async operations P0: work engine (WorkOrchestrator, IWorkProvider) - #198

Draft
chullybun wants to merge 9 commits into
mainfrom
async-webapi-publishing
Draft

chullybun wants to merge 9 commits into
mainfrom
async-webapi-publishing

Conversation

@chullybun

Copy link
Copy Markdown
Collaborator

First phase (P0) of the async operations design (docs/design/async-operations-design.md). Breaking changes to the CoreEx.Hosting.Work surface are intentional.

What's included

  • WorkOrchestrator: create, start (lease), renew, progress, complete, fail, cancel and fence transitions; StartBy/expiry enforcement; TTL = deadline + retention while running, Retention from finish (extended to StartBy + Retention) once finished.
  • IWorkProvider: independent of the outbox, with InMemoryWorkProvider and a best-effort RedisWorkProvider (Lua compare-and-set scripts; WAIT deliberately removed, so async-replication loss on failover is an accepted, documented risk). Durable tracking needs a different provider.
  • Ambiguity: WorkOutcomeUnknownException on writes that time out; the orchestrator reads back to resolve them. Caller cancellation still surfaces as OperationCanceledException.
  • Errors: WorkTransitionErrorCodes set on WorkTransitionResult.ToResult() errors.
  • Docs: hosting/Redis READMEs, AGENTS, CHANGELOG, and the design doc (best-effort tracking, i.e. fail open, recorded for the subscriber phase).

Validation

  • Hosting.Work unit tests (24) and Redis provider tests (9), including a real-Redis CLIENT PAUSE ... WRITE timeout test and a TTL test.
  • Opened as a draft for CI to run the full multi-target build and tests.

Not included

Publishing (WebApi.PublishAsync), subscriber behaviours and the ASP.NET status endpoints are later phases.

chullybun and others added 9 commits November 19, 2026 10:41
- WorkOrchestrator transition engine with leases, fencing, StartBy/expiry and retention-based TTL.
- IWorkProvider with InMemory and best-effort Redis implementations (Lua CAS scripts, no WAIT).
- WorkOutcomeUnknownException for ambiguous provider writes; WorkTransitionErrorCodes on ToResult errors.
- Tests for lifecycle, concurrency, ambiguity read-back, TTL, and Redis write-pause timeout.
- Async operations design doc; best-effort tracking (fail open) recorded for subscriber phase.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Remove the callback overload of ServiceBusMessageActions.FunctionReceiveAsync
and FunctionsServiceBusReceiveArgs. Functions Service Bus triggers now always
receive through a CoreEx ServiceBusSubscriberBase (MessageRepresentation.Native
for non-CloudEvent payloads) via the subscriber overload, so subscriber-level
pipelines apply uniformly. Baggage is configured through
EventSubscriberBase.PropagateBaggage.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Wrap subscriber processing with ordered behaviors and notify participants after the final settlement. Track in-process attempts and reset their error metadata on retries.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Adds WebApi.PublishAsync with publish-only default and opt-in tracked publishing via [PublishTracking]/.WithPublishTracking(), MapCoreExOperations status/result/cancel endpoints, idempotency-attempt release for fenced failures, and tracked/untracked OpenAPI metadata. Moves OperationKey/OperationKeyScope to CoreEx.Operations and OperationStatus/OperationError to CoreEx.AspNetCore.Operations.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Add operation-state contracts and the in-memory lifecycle, simplify identities and coordination, and constrain tracked publishing.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Add SQL Server and PostgreSQL operation stores, DbEx migration templates, transaction coverage, and provider documentation.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Eric Sibly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant