aws / aws/aws-durable-execution-sdk-python

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

オープン
#686 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement needs-triage pkg:testing
主要言語
Python
スター
53
フォーク
25
平均マージ
1日 19時間
マージ済み PR(30日)
40

説明

### What would you like?

### Context

Reported downstream in [aws/aws-sam-cli#9200](https://github.com/aws/aws-sam-cli/issues/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](https://github.com/aws/aws-durable-execution-sdk-python/blob/main/packages/aws-durable-execution-sdk-python-testing/src/aws_durable_execution_sdk_python_testing/execution.py#L185)):

```python
# 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 `` 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

packages/aws-durable-execution-sdk-python-testing/src/aws_durable_execution_sdk_python_testing/execution.py の Execution.new() から始め、続いて executor.py の GetDurableExecution レスポンスと Route.from_string を調べます。プレースホルダー ARN の形式を検証するテストを更新し、生成された ARN に必要な function、qualifier、execution name、新しい execution ID が含まれていること、および名前がない場合も一貫して処理されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, python
領域
backend, testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。