Skip to content

feat(durable-aspnetcore): prototype authorized external activation #805

Open

Description

@akrock

Parent: #793

Blocked by #794, #800, #802, and #804. Stable publication also requires a distinct adopter.

What problem should this solve?

Seven downstream routes repeat the same outer sequence around a bounded pump, but they also contain application-owned materialization, continuation, reconciliation, and deployment policy. AppSurface needs evidence that a thin ASP.NET Core adapter can remove the mechanical repetition without taking ownership of those policies.

Proposed shape

Add an explicitly experimental ForgeTrust.AppSurface.Durable.AspNetCore package. The mapping API must require:

  • an explicit route pattern;
  • an explicit host authorization policy;
  • a bounded transport-neutral activation request or factory;
  • an application response mapper over a transport-neutral activation outcome.

Consume case 6's public-preview IDurableExternalActivationService, request, result, outcome enum, cancellation precedence, and failure mapping unchanged. This case owns no second health-to-outcome or exception-to-code mapping. Only the ASP.NET package and mapping carry the .NET [Experimental] diagnostic until the graduation gate passes.

The ASP.NET mapping is a thin transport layer:

RouteHandlerBuilder MapDurableExternalActivation(
    this IEndpointRouteBuilder endpoints,
    string pattern,
    string authorizationPolicy,
    Func<HttpContext, DurableExternalActivationRequest> requestFactory,
    Func<HttpContext, DurableExternalActivationResult, IResult> responseMapper);

It resolves the pre-composed service, passes HttpContext.RequestAborted, invokes the response mapper, and applies RequireAuthorization(authorizationPolicy). It has no before/after/recovery participant model. Application materialization, continuation, reconciliation, cleanup, outbox acknowledgement, and domain transitions compose outside this call with host-owned tokens and errors.

The mapping returns RouteHandlerBuilder so the host can add metadata and stricter authorization. It must never default to anonymous access.

The canonical result remains payload-free and carries no scope/aggregate identity, provider response, arbitrary exception, HTTP status, or recovery verdict. The host's response mapper decides status codes and body shape. Unexpected request-factory or response-mapper exceptions remain ordinary host exceptions; the adapter does not relabel application failure as Durable state.

Graduation gates

The package remains experimental until:

  1. the reference host and one distinct host/adopter use the same public contract;
  2. the representative downstream lane is first mapped directly over case 6's service, then through the adapter; the measured adapter region shrinks by at least 30% from that same-lane direct baseline and remains at or below 25 nonblank lines, without importing application types;
  3. every row in the normative activation flow, including unavailable health, stale takeover, busy admission, exhausted request budget, pump HasMore, outer cancellation, and cancellation after pump invocation, has deterministic tests;
  4. no required composition point needs a Cloud Tasks, OIDC, lane, outbox, cleanup, or domain-state concept;
  5. security review confirms explicit authorization and bounded diagnostic output;
  6. API review confirms that the transport-neutral result is useful outside HTTP.

If those gates fail, keep the proof code example-internal or remove the package before stable publication.

Acceptance criteria

  • Mapping without a named authorization policy fails during startup with an actionable diagnostic.
  • RequestBudget and pump TimeBudget are validated for positive bounds and documented ownership; pump TimeBudget is never converted into the outer hard deadline.
  • Case 6's service contract tests remain the sole proof of phase order, cancellation precedence, and exception mapping; this package neither copies nor overrides them.
  • Endpoint tests feed each canonical result from a fake service and prove the exact same value reaches the host response mapper without reclassification.
  • Cancellation tests prove HttpContext.RequestAborted is forwarded as the service caller token; request-budget ownership remains in the canonical service.
  • Response mapping cannot access payloads or arbitrary provider exceptions through the activation outcome.
  • Endpoint tests cover authentication/authorization, every outcome kind, request-factory and response-mapper exceptions, cancellation races, concurrent requests, and application response mapping.
  • The reference host is migrated to the adapter and the Case 0 measurement tool records at least a 30% reduction in the external-activation mapping region, with at most 25 nonblank lines and no hidden health/budget facts.
  • A separate host wrapper test demonstrates that application preparation and cleanup remain outside the service and can continue under a host-lifetime token after request cancellation.

Dependencies and coordination

Depends on cases 1, 2, 3, and 6. Stable publication requires the graduation decision; case 9 does not wait and uses direct mapping.

Activity

  1. added
    enhancement
    external blocker
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexternal blocker

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions