Skip to content

Conversation

@yaythomas
Copy link
Member

@yaythomas yaythomas commented Jan 29, 2026

Description of changes:

execution_context added to DurableContext

Add immutable ExecutionContext dataclass to provide readonly access to
execution-level metadata. The context contains the durable execution ARN
which uniquely identifies the execution instance within AWS.

Changes:

  • Create ExecutionContext frozen dataclass with durable_execution_arn field
  • Add execution_context parameter to DurableContext constructor
  • Update from_lambda_context() to create ExecutionContext from state
  • Update create_child_context() to propagate execution_context
  • Export ExecutionContext in public API
  • Add create_test_context() helper in test files for easier instantiation
  • Update all test files to use new helper function

The ExecutionContext is automatically created in from_lambda_context()
using the state's durable_execution_arn, keeping the API simple while
maintaining immutability and thread safety.
closes 283

BatchResult

Change init.py to import BatchResult from concurrency.models
(concrete implementation) rather than from types (protocol definition).
This provides users with the actual class implementation for better
IDE support and type checking.

The protocol remains in types.py for internal type checking, while
the public API exports the concrete dataclass implementation.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

closes #284

Add immutable ExecutionContext dataclass to provide readonly access to
execution-level metadata. The context contains the durable execution ARN
which uniquely identifies the execution instance within AWS.

Changes:
- Create ExecutionContext frozen dataclass with durable_execution_arn field
- Add execution_context parameter to DurableContext constructor
- Update from_lambda_context() to create ExecutionContext from state
- Update create_child_context() to propagate execution_context
- Export ExecutionContext in public API
- Add create_test_context() helper in test files for easier instantiation
- Update all test files to use new helper function

The ExecutionContext is automatically created in from_lambda_context()
using the state's durable_execution_arn, keeping the API simple while
maintaining immutability and thread safety.

closes #283
Change __init__.py to import BatchResult from concurrency.models
(concrete implementation) rather than from types (protocol definition).
This provides users with the actual class implementation for better
IDE support and type checking.

The protocol remains in types.py for internal type checking, while
the public API exports the concrete dataclass implementation.

closes #284
@yaythomas yaythomas changed the title Execution context feat: Execution context + BatchResult import Jan 29, 2026
@yaythomas yaythomas closed this Jan 29, 2026
@yaythomas yaythomas reopened this Jan 29, 2026
@yaythomas yaythomas merged commit 70792a7 into main Jan 29, 2026
16 of 19 checks passed
@yaythomas yaythomas deleted the execution-context branch January 29, 2026 23:04
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.

[Bug]: BatchResult default import from types

2 participants