-
Notifications
You must be signed in to change notification settings - Fork 24
Fix example bugs, improve docs, and add copilot instructions #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a class-based entity dispatch bug in the core worker, updates several examples to run correctly against the local DTS emulator, and improves repository documentation and Markdown linting support.
Changes:
- Fix
_EntityExecutorto only passentity_inputto class-based entity methods when the method accepts an input parameter. - Correct example entity handlers and update sub-orchestration examples to avoid hardcoded TLS configuration.
- Refresh
examples/README.mdformatting/instructions and add Copilot + Markdown linting configuration.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
durabletask/worker.py |
Adjusts class-based entity method invocation to avoid passing input to no-arg operations. |
tests/durabletask/test_entity_executor.py |
Adds unit tests for class-based entity dispatch behavior (and function-based coverage). |
examples/entities/function_based_entity.py |
Fixes control-flow bug (if → elif) in the entity operation handler. |
examples/entities/function_based_entity_actions.py |
Adds missing "add" operation handler in the entity example. |
examples/sub-orchestrations-with-fan-out-fan-in/worker.py |
Makes secure_channel selection configurable based on endpoint. |
examples/sub-orchestrations-with-fan-out-fan-in/orchestrator.py |
Makes client secure_channel selection configurable based on endpoint. |
examples/README.md |
Rewrites example documentation with improved Markdown and setup/run instructions. |
dev-requirements.txt |
Adds pymarkdownlnt to dev dependencies. |
.pymarkdown.json |
Adds Markdown lint configuration. |
.github/copilot-instructions.md |
Adds repository conventions and guidance for Copilot usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/sub-orchestrations-with-fan-out-fan-in/orchestrator.py
Outdated
Show resolved
Hide resolved
009f2ea to
569572c
Compare
- Fix entity method dispatch in worker.py to inspect method signature before passing entity_input, so class-based entity methods that take no input (e.g. get()) work without requiring a dummy parameter - Fix function_based_entity.py: if -> elif for set operation - Fix function_based_entity_actions.py: add missing 'add' operation - Fix sub-orchestration examples: use dynamic secure_channel based on endpoint instead of hardcoded True - Rewrite examples/README.md with proper formatting, virtual env setup instructions, and local dev install steps - Add .github/copilot-instructions.md with project conventions - Add .pymarkdown.json config and pymarkdownlnt to dev-requirements.txt - Add unit tests for entity executor method dispatch
569572c to
3fee237
Compare
Summary
While testing the examples against the local DTS emulator, several bugs were found and fixed.
Bug Fixes
Framework fix in
durabletask/worker.py:entity_inputas an argument to class-based entity methods, even when no input was provided. Methods likedef get(self):that don't accept input would fail withTypeError: Counter.get() takes 1 positional argument but 2 were given. Fixed by usinginspect.signature()to check whether the method accepts parameters before passing the argument.Example fixes:
function_based_entity.py: Changediftoeliffor the set operation — it was falling through to the else branch and raisingValueErrorfunction_based_entity_actions.py: Added missing add operation handlersub-orchestrations-with-fan-out-fan-in/worker.pyandorchestrator.py: Changed hardcodedsecure_channel=Trueto dynamic detection based on endpoint, so these examples work with the local emulatorDocumentation Improvements
examples/README.mdwith proper markdown formatting, added virtual environment setup instructions, local dev install steps, and PowerShell equivalents for multiline commands.github/copilot-instructions.mdwith project conventions.pymarkdown.jsonconfig andpymarkdownlnttodev-requirements.txtfor markdown lintingTesting
All 10 examples verified passing against the local DTS emulator. All 13 unit tests pass. Also added 5 new unit tests for entities, which are passing.