docs: align examples with actual Future/Result implementation patterns - #84
Merged
Conversation
- Update Getting Started guide with correct activity implementation patterns - Fix Activity Handlers guide to show Future/Result pattern - Update Worker Implementation guide with proper error handling examples - Correct Result Pattern guide to clarify activities vs workflows - Fix Client Usage guide to show Future/Result pattern correctly - Update package READMEs with consistent examples - Fix main README with proper example Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
- Remove references to non-existent createWorker function - Update to use standard Worker.create from @temporalio/worker - Fix child workflow examples to show Result pattern - Update sample READMEs to reflect actual samples - Remove references to non-existent worker-boxed sample Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
- Update index.md with correct Worker.create usage - Fix client example to show Future/Result pattern - Add proper Connection setup in client example - Ensure all worker examples use standard Temporal Worker API Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review website and README files for code consistency
docs: align examples with actual Future/Result implementation patterns
Dec 21, 2025
btravers
requested changes
Dec 21, 2025
Changed all workflow implementations from:
implementation: async (context, input) => {}
to:
implementation: async ({ activities, executeChildWorkflow, ... }, input) => {}
This follows the codebase convention of destructuring the context parameter directly.
Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
btravers
requested changes
Dec 21, 2025
btravers
requested changes
Dec 21, 2025
Copilot stopped work on behalf of
btravers due to an error
December 21, 2025 17:12
Collaborator
|
@copilot format because CI is KO |
Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
Copilot stopped work on behalf of
btravers due to an error
December 21, 2025 17:14
Copilot stopped work on behalf of
btravers due to an error
December 21, 2025 17:16
Collaborator
|
@copilot retry |
Run oxfmt to fix CI formatting issues. Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
Contributor
Author
Updated packages/worker/README.md to use destructured context parameter pattern:
- Changed from: implementation: async (context, input) => {}
- Changed to: implementation: async ({ activities }, input) => {}
This ensures consistency across all documentation examples.
Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
btravers
approved these changes
Dec 21, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates all documentation and README files to accurately reflect the current codebase implementation, specifically around the Result/Future pattern usage, worker creation, and context destructuring.
Key Changes:
- Updated all activity examples to show the
Future.fromPromise()pattern withActivityErrorwrapping - Fixed worker creation examples to use standard
Worker.create()instead of the non-existentcreateWorkerfunction - Updated workflow implementations to destructure context parameters
- Clarified that workflows receive plain values from activities (Result unwrapped by framework) while child workflows use the Result pattern
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/index.md | Updated client and worker examples to show Result/Future pattern and correct Worker.create usage |
| website/docs/guide/worker-usage.md | Removed createWorker references, updated child workflow examples to show Result pattern |
| website/docs/guide/worker-implementation.md | Added Future/Result pattern to activities, clarified workflow receives plain values, destructured context |
| website/docs/guide/result-pattern.md | Clarified activities use Future/Result internally while workflows use try/catch for activity calls |
| website/docs/guide/getting-started.md | Fixed worker setup and client examples to show Result/Future pattern |
| website/docs/guide/entry-points.md | Destructured context in workflow examples |
| website/docs/guide/client-usage.md | Updated to show Future/Result pattern from client perspective |
| website/docs/guide/activity-handlers.md | Updated all activity examples to show Future/Result pattern with ActivityError |
| samples/order-processing-worker/README.md | Updated description to reflect Result/Future pattern usage |
| samples/order-processing-client/README.md | Fixed references to non-existent worker-boxed sample, updated to worker-nestjs |
| packages/worker/README.md | Added Future/Result pattern to activities, removed createWorker, destructured context |
| packages/client/README.md | Fixed client creation to include Client instance |
| README.md | Updated quick example to show Future/Result pattern for activities |
Comments suppressed due to low confidence (1)
website/docs/guide/worker-usage.md:1
- The variable name 'handleResult' is confusing as it suggests a result when it actually contains a Result wrapping a workflow handle. Consider naming it 'handleOrError' or 'startResult' to better reflect that it's the result of starting (not the workflow result).
# Worker Usage
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Changed variable name from 'resultFuture' to 'future' across all documentation to avoid redundancy since it's already clear from context that it's a Future. Updated files: - website/docs/index.md (2 instances) - website/docs/guide/getting-started.md - website/docs/guide/client-usage.md Co-authored-by: btravers <3476441+btravers@users.noreply.github.com>
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.
Documentation and Examples Review - Complete ✅
All Completed Tasks:
Getting Started Guide (
website/docs/guide/getting-started.md)Activity Handlers Guide (
website/docs/guide/activity-handlers.md)Worker Implementation Guide (
website/docs/guide/worker-implementation.md)Worker Usage Guide (
website/docs/guide/worker-usage.md)Result Pattern Guide (
website/docs/guide/result-pattern.md)Entry Points Guide (
website/docs/guide/entry-points.md)Client Usage Guide (
website/docs/guide/client-usage.md)Client README (
packages/client/README.md)Worker README (
packages/worker/README.md)createWorkerfunctionMain README (
README.md)Sample READMEs
Homepage (
website/docs/index.md)Formatting
Summary of Changes
All documentation and README files have been reviewed and updated to reflect the actual code implementation:
Future.fromPromise()with.mapError()and.mapOk()({ activities }, input) => {}- ALL instances fixedFuture<Result>from workflow execution methodsWorker.create()from@temporalio/workerOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.