[Feature]: [Testing] Emulator should generate real-shaped durable execution ARNs (embed execution name)

未關閉
#686 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
aws, python
領域
backend, testing

研究方向

從 packages/aws-durable-execution-sdk-python-testing/src/aws_durable_execution_sdk_python_testing/execution.py 中的 Execution.new() 開始,接著檢查 executor.py 的 GetDurableExecution 回應和 Route.from_string。更新斷言 placeholder ARN 形狀的測試,並驗證產生的 ARN 包含必要的 function、qualifier、execution name 和新的 execution ID,同時一致地處理缺少的名稱。

由索引模型根據 Issue 內容生成。

描述

enhancement pkg:testing
What would you like?
Context

Reported downstream in aws/aws-sam-cli#9200: a user who starts a local durable execution with sam local invoke --durable-execution-name test cannot correlate that name with anything afterwards — sam local execution history/get take an ARN, and the emulator's ARN contains no trace of the name.

Current behavior

The emulator generates a placeholder ARN in Execution.new() (execution.py):

# make a nicer arn
# Pattern: arn:(aws[a-zA-Z-]*)?:lambda:...:durable-execution:...
return Execution(
    durable_execution_arn=str(uuid4()) + "/" + (input.invocation_id or str(uuid4())),
    ...
)

Two problems:

  1. It doesn't match the real service ARN shape, so the execution name (and function name) appear nowhere in the identifier. Locally, DurableExecutionName is effectively write-only.
  2. It conflates the second path segment with the invocation ID; the real ARN's last segment is a distinct execution ID.

(The comment's intended pattern is also stale — it predates the current public API shape.)

Expected behavior

Generate ARNs matching the public DurableExecutionArn pattern from the Lambda service model:

arn:{partition}:lambda:{region}:{account}:function:{name}:{qualifier}/durable-execution/{execution-name}/{execution-id}

Everything needed is already on StartDurableExecutionInput (account_id, function_name, function_qualifier, execution_name are required fields). Region can be fixed to us-east-1, consistent with the hardcoded FunctionArn in executor.py's GetDurableExecution response.

Possible Implementation
  • Null/omitted execution name: callers (e.g. SAM CLI) may send "ExecutionName": null. Generate a name (uuid) when absent — matches cloud behavior and also fixes DurableExecutionName being null in GetDurableExecution responses.
  • Execution ID: use a fresh uuid4(), not invocation_id.
  • Routing is already safe: Route.from_string splits on / before URL-decoding, so a percent-encoded ARN stays one segment — the same mechanism that handles today's one-slash placeholder. botocore percent-encodes / in non-greedy URI params.
  • Downstream (sam-cli) is already shape-agnostic after aws/aws-sam-cli#9038 and aws/aws-sam-cli#9040 (\S+ ARN regex, Flask <path:> routes).
  • Store/runner treat the ARN as an opaque key; only tests asserting the placeholder shape need updating.

Questions to resolve:

  • Execution-name idempotency: mimic cloud idempotency behaviour — in the service, starting a durable execution with an ExecutionName that matches an existing execution for the same function is an idempotent start (the existing execution/ARN is returned rather than a new one created). The emulator currently creates a duplicate with a distinct ARN sharing the same name segment. Confirm the exact service semantics (idempotency window, retention, input-mismatch handling) and implement to match.
  • Function name fidelity: SAM CLI hardcodes "FunctionName": "function" in its start payload, so local ARNs would read function:function:$LATEST/.... Decide whether to pair this with a sam-cli change to pass the real logical ID so the ARN is actually informative.
Blocked by

A new emulator image release is required for this to reach SAM CLI users (:latest on ECR is still v1.2.1, built 2026-05-20 from the pre-migration repo) — see #487.

主要語言
Python
星號
58
分支
32
平均合併
1 天 6 小時
30 天內合併 PR
80

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

aws/aws-durable-execution-sdk-python 的其他 Issue

查看 aws/aws-durable-execution-sdk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。