Skip to content

test: cover OTel replay and user callback contexts - #758

Open
zhongkechen wants to merge 17 commits into
mainfrom
test/otel-conformance-feasibility
Open

zhongkechen wants to merge 17 commits into
mainfrom
test/otel-conformance-feasibility

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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 743dc5080145160dc1932c88f858ca6fe90d91eb in 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:

  • All 65 conformance-package tests pass. Case 22 uses the real local runner in both views, with absent/unrelated ambient context; barriers force parallel/map sibling overlap without supplying tracing context.
  • The combined OTel suite passes 354 tests on current core and 342 applicable tests on actual installed minimum core 2.0.0; type checks cover 30 files. Actual Execution/Invocation views plus baggage are tested in both registration orders, with same/unrelated/absent ambient parents, resume and failure.
  • All 83 tracked core-package files match fix: propagate context into handler workers #756's tested revision: 1,737 core tests pass, including invocation outcome/order/hook-failure isolation and real wait/resume regressions.
  • CI verifies core 2.0.0 is imported from site-packages and lacks the new optional handler hook, then runs compatibility tests on Python 3.11–3.14. No dependency floor is raised.
  • Four installed core/plugin layer combinations pass 24 lifecycle cases, including old core with the new plugin and new core with released OTel 1.0.0.
  • Normal PR CI runs all 24 cases in both views through ADOT/X-Ray and S3 against the exact SDK commit and pinned requirements. The failed-plus-uncovered gate remains enabled. Cloud results and AI review are checked per current revision.

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.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 00:14 — with GitHub Actions Active
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 00:19 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen zhongkechen changed the title test(otel): cover replay and callback contexts test: add OTel conformance handlers 21–24 Oct 3, 2026
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 00:57 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen zhongkechen changed the title test: add OTel conformance handlers 21–24 test: add otel context and replay conformance Oct 3, 2026
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 02:08 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen zhongkechen changed the title test: add otel context and replay conformance test: cover OTel replay and user callback contexts Oct 3, 2026
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 02:26 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen changed the base branch from fix/otel-handler-context-428 to main October 3, 2026 02:37
@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 02:38 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 03:02 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 03:14 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 05:20 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 3, 2026 05:26 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen deployed to ai-pr-review-runtime October 4, 2026 01:39 — with GitHub Actions Active
# 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex AI review

Found one P2 compatibility regression in handler dispatch: the no-plugin worker-context behavior is unintentionally changed.

Reviewed commit 146f2313801b8bce2f8402d5e8c8f1cd064e4279. Workflow run

This branch was successfully deployed

1 active deployment
ai-pr-review-runtime — 146f2313 Deployed Oct 4, 2026 by zhongkechen via ai-pr-review / Codex review / Generate Codex review #1214
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