Skip to content

Integrate [DurableExecution] with the Annotations source generator#2410

Open
GarrettBeatty wants to merge 2 commits into
devfrom
gcbeatty/durable-annotations
Open

Integrate [DurableExecution] with the Annotations source generator#2410
GarrettBeatty wants to merge 2 commits into
devfrom
gcbeatty/durable-annotations

Conversation

@GarrettBeatty

@GarrettBeatty GarrettBeatty commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add a [DurableExecution] attribute (in Amazon.Lambda.Annotations) and source generator support so a method annotated with [LambdaFunction] + [DurableExecution] generates:

  • a typed-envelope handler wrapper delegating to DurableFunction.WrapAsync<TInput[,TOutput]>
  • a DurableConfig block on the function resource in the generated CFN/SAM template
  • lambda:CheckpointDurableExecution / lambda:GetDurableExecutionState IAM permissions (per-function inline policy; skipped when an explicit Role is set)

Issue #, if available:
#2418
Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Base automatically changed from feature/durablefunction to dev June 11, 2026 17:56
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/durable-annotations branch from ab1af0b to a921009 Compare June 12, 2026 17:13
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/durable-annotations branch from a921009 to 925f3b5 Compare June 22, 2026 20:37
@GarrettBeatty GarrettBeatty changed the base branch from dev to gcbeatty/durabletestupdates June 22, 2026 20:37
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/durable-annotations branch from 45da58d to 35c966c Compare June 23, 2026 16:39
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- src\Function is a separate, self-contained project. Exclude its subtree so this project's
default globs don't pick up its sources or generated obj\AssemblyInfo (which causes CS0579). -->
<DefaultItemExcludes>$(DefaultItemExcludes);src\**</DefaultItemExcludes>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was running into build issue so fixed this too

@GarrettBeatty GarrettBeatty marked this pull request as ready for review June 23, 2026 20:38
@GarrettBeatty GarrettBeatty requested review from a team as code owners June 23, 2026 20:38
@GarrettBeatty GarrettBeatty requested review from normj and philasmar and removed request for a team June 23, 2026 20:38
// the exact entry point the hand-written and executable test functions call, so the
// checkpoint/replay/history behavior is identical.
[LambdaFunction]
[DurableExecution]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i manually deployed this too and also played around with updating the attributes and checking that they reflected in the template too

Base automatically changed from gcbeatty/durabletestupdates to dev June 23, 2026 20:48
Add a [DurableExecution] attribute (in Amazon.Lambda.Annotations) and source
generator support so a method annotated with [LambdaFunction] + [DurableExecution]
generates:
- a typed-envelope handler wrapper delegating to DurableFunction.WrapAsync<TInput[,TOutput]>
- a DurableConfig block on the function resource in the generated CFN/SAM template
- lambda:CheckpointDurableExecution / lambda:GetDurableExecutionState IAM permissions
  (per-function inline policy; skipped when an explicit Role is set)

Validation gates (AWSLambda0140-0143) require durable functions to be executable
(OutputKind), Zip-packaged, and have the (TInput, IDurableContext) -> Task/Task<TOutput>
signature; combining with another event attribute reuses the existing AWSLambda0102.

The generated WrapAsync call emits explicit generic type arguments because method-group
arguments cannot be inferred for the Func<,,> parameter (CS0411).

fiox build

annotations

updates

updates

update docs

pr comments
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/durable-annotations branch from 183524b to 5a5447e Compare June 23, 2026 20:49
// Assembly::Type::Method), which LambdaFunctionModel.Handler already derives from IsExecutable. So no
// OutputKind gate is needed here.

// Image packaging strips Handler/Runtime from the function resource, which the durable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment and why image functions don't work. Especially since that is how we tell customers to test the preview. Maybe a quick sync up between us to help me understand what is causing the issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be AI slop. I also asked Claude about this, I think he mentioned the other annotations have the same limitation. I'll double check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 3bee3f5. claude incorrectly assumed some things

@GarrettBeatty GarrettBeatty requested a review from normj June 24, 2026 12:44
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.

2 participants