Repository navigation
feat: expose activity request name and version in context - #370
Merged
Merged
Conversation
Preserve request identity through versioned dispatch and legacy fallback while retaining two-argument ActivityContext construction. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds request-level activity name and version metadata to ActivityContext while preserving compatibility and version casing.
Changes:
- Adds readonly
nameandversiongetters with empty defaults. - Populates metadata from activity requests.
- Adds unit, executor, gRPC, and changelog coverage.
| File | Description |
|---|---|
packages/durabletask-js/test/versioned-dispatch-grpc.spec.ts |
Verifies metadata propagation over gRPC. |
packages/durabletask-js/test/activity_executor.spec.ts |
Tests compatibility and metadata behavior. |
packages/durabletask-js/src/worker/activity-executor.ts |
Populates context from activity requests. |
packages/durabletask-js/src/task/context/activity-context.ts |
Adds activity metadata getters and defaults. |
CHANGELOG.md |
Documents the new API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kaibocai (kaibocai)
approved these changes
Sep 23, 2026
wangbill (YunchuWang)
deleted the
yunchuwang-activity-context-metadata
branch
September 23, 2026 22:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What changed?
ctx.nameandctx.version, populated from the actual activity request. Logical aliases and version casing are preserved, including when an unversioned registration handles a versioned request.new ActivityContext(orchestrationId, taskId)compatible by adding optional trailing name/version arguments. Missing metadata defaults to""; a null version from JavaScript also becomes"". Existing IDs are unchanged.Why is this change needed?
ctx.nameandctx.versionwithout depending on the implementation function name, registration version, or worker default.TaskActivityContext.Name/Versionand theTaskActivityShimrequest mapping.Issues / work items
Project checklist
CHANGELOG.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
npm test -w @microsoft/durabletask-js -- --runTestsByPath test\activity_executor.spec.ts test\versioned-dispatch-grpc.spec.ts test\versioned-dispatch.spec.ts test\versioned-in-memory.spec.ts test\worker-activity-response.spec.tsnpm run build:coreandnpm run build -w @microsoft/durabletask-js-export-historypassed; the latter checks an existing ActivityContext-typed consumer.git diff --checkpassed. The executor test file retains existing CRLF and pre-existing formatting outside the new test region.Manual validation (only if runtime/behavior changed)
Notes for reviewers