Skip to content

refactor: execution context and messaging options#5

Merged
abdebek merged 1 commit intodevfrom
feat/stable-release-foundations
Mar 7, 2026
Merged

refactor: execution context and messaging options#5
abdebek merged 1 commit intodevfrom
feat/stable-release-foundations

Conversation

@abdebek
Copy link
Copy Markdown
Owner

@abdebek abdebek commented Mar 7, 2026

Summary

  • add shared execution-context support across the core, extensions, messaging, audit, data-access, sample, and templates
  • make template validation deterministic against local preview packages and Docker-backed durable scenarios
  • PostgreSQL durable template apps no longer fail on SQL Server-specific identity index filters during startup
  • move global error handling to the correct position in ApplicationBuilderExtensions.
  • introduce MessagingExecutionContext for handling message-specific execution context.
  • update MessagingOptions to include local queue name, queue prefix, and dead-letter expiration settings.
  • enhance IRepository interface with default implementations for AnyAsync, SingleOrDefaultAsync, and CountAsync methods.
  • add tests for ExecutionContext and MessagingOptions to ensure correct behavior and configuration.
  • update AppDbContext to support execution context.

Why

A few problems in the current library surface:

  • there was no shared execution-context abstraction for user, tenant, and correlation data
  • audit, data access, HTTP flows, and Wolverine handlers were drifting toward separate context models
  • some new public-surface changes on dev were source-breaking or under-documented
  • generated template validation could be polluted by stale local package cache state
  • provider-specific SQL leaked into shared identity data-access code

Changes

  • add IExecutionContext, NullExecutionContext, and configurable ExecutionContextOptions
  • add HTTP-backed and Wolverine-backed execution-context implementations
  • align audit defaults to bridge from IExecutionContext while keeping IAuditContextProvider compatible
  • add non-breaking execution-context constructor overloads to DbContextBase and IdentityDbContextBase
  • add GetCurrentTenantId() alongside GetCurrentUserId() in data-access base contexts
  • make IdentityDbContextBase provider-aware so SQL Server filtered-index syntax is not applied to PostgreSQL or SQLite
  • reduce IRepository implementor breakage with default interface members and document them as compatibility fallbacks
  • expand messaging options for queue naming, dead-letter expiration, and policy hooks
  • make messaging execution-context registration explicit and configurable
  • fix API middleware ordering in UseMinimalCleanArchApiDefaults
  • update sample app, templates, and docs to use the newer defaults
  • harden template validation by clearing stale local MCA package cache before scaffold validation

Behavioral fixes

  • UserName resolution now prefers name claims over email claims
  • built-in tenant resolution no longer assumes app-specific claim names such as business_id or organization_id
  • execution metadata is cached per scoped execution-context instance instead of reallocating on each access
  • messaging explicitly replaces the default execution-context registration instead of silently overriding it via duplicate scoped registrations

This batch fixes those issues while keeping the public API evolution additive and focused.

- Moved global error handling to the correct position in ApplicationBuilderExtensions.
- Added ExecutionContextOptions for customizable claim mapping.
- Introduced MessagingExecutionContext for handling message-specific execution context.
- Updated MessagingOptions to include local queue name, queue prefix, and dead-letter expiration settings.
- Enhanced IRepository interface with default implementations for AnyAsync, SingleOrDefaultAsync, and CountAsync methods.
- Added tests for ExecutionContext and MessagingOptions to ensure correct behavior and configuration.
- Updated AppDbContext to support execution context.
@abdebek abdebek marked this pull request as ready for review March 7, 2026 22:18
@abdebek abdebek merged commit ddb4a50 into dev Mar 7, 2026
5 checks passed
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