test: cover OTel replay and user callback contexts - #758
zhongkechen wants to merge 17 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| # Invocation-start hooks can establish tracing and other contextvars. | ||
| # Context.run restores worker bindings on both return and failure. | ||
| user_future = executor.submit( | ||
| contextvars.copy_context().run, |
There was a problem hiding this comment.
Codex AI review · Finding arf_v1_gsfvltuzgmu4uorf6z45pzdluf
[P2] Preserve the no-plugin worker-context behavior here. This unconditionally copies the Lambda caller's context into the user worker, even when no plugins are registered; previously that fresh worker used its default context. Uninstrumented handlers can therefore newly observe caller ContextVar values and active OTel spans. Submit func directly when the plugin list is empty (or add a conditional dispatch helper), and add a worker-level no-plugin regression test.
Codex AI reviewFound one P2 compatibility regression in handler dispatch: the no-plugin worker-context behavior is unintentionally changed. Reviewed commit |
Add Python handlers and SAM mappings for OTel cases 21–24: completed-step replay, active context in user functions and callbacks, and invocation retry status. Ordinary user spans inherit their active parent; handlers never attach replacement context or copy execution identity into probe spans.
Shared requirements: aws/aws-durable-execution-conformance-tests#131, pinned to
743dc5080145160dc1932c88f858ca6fe90d91ebin the reusable workflow and both test-ref defaults. This PR targets main and includes focused handler-context #756 and status-mapping #752. Merge those runtime prerequisites and the shared requirements first. Python #737 and its factory migration are excluded.The handlers exercise public APIs across initial execution, wait/resume, failures, concurrent parallel/map branches, polling, callback submitters, retry helpers and virtual contexts. Tests verify canonical trace/parent IDs, exact raw probe counts, completed-body suppression and caller-context restoration. The shared coverage matrix documents initialization, policy, serialization and application-created thread boundaries that lack an active SDK-operation-span contract.
The #756 follow-up also isolates invocation-local plugin context from the host, fixing Execution-view teardown with a later baggage plugin. It preserves public APIs, hook order/thread, return/exception identity, dependency floors and checkpoint/replay state; the no-plugin path is unchanged. Older cores retain their existing behavior and documented limitations.
Validation:
The previously observed invocation-21 duplicate wait continuation in the local tester reproduces on unchanged main; its deployed case passes. No assertions were weakened. No IAM or workflow trust changes are included.