Skip to content

Fix example bugs, improve docs, and add copilot instructions#107

Open
cgillum wants to merge 1 commit intomainfrom
cgillum/example-bugs-and-docs
Open

Fix example bugs, improve docs, and add copilot instructions#107
cgillum wants to merge 1 commit intomainfrom
cgillum/example-bugs-and-docs

Conversation

@cgillum
Copy link
Member

@cgillum cgillum commented Feb 7, 2026

Summary

While testing the examples against the local DTS emulator, several bugs were found and fixed.

Bug Fixes

Framework fix in durabletask/worker.py:

  • The entity method dispatcher always passed entity_input as an argument to class-based entity methods, even when no input was provided. Methods like def get(self): that don't accept input would fail with TypeError: Counter.get() takes 1 positional argument but 2 were given. Fixed by using inspect.signature() to check whether the method accepts parameters before passing the argument.

Example fixes:

  • function_based_entity.py: Changed if to elif for the set operation — it was falling through to the else branch and raising ValueError
  • function_based_entity_actions.py: Added missing add operation handler
  • sub-orchestrations-with-fan-out-fan-in/worker.py and orchestrator.py: Changed hardcoded secure_channel=True to dynamic detection based on endpoint, so these examples work with the local emulator

Documentation Improvements

  • Rewrote examples/README.md with proper markdown formatting, added virtual environment setup instructions, local dev install steps, and PowerShell equivalents for multiline commands
  • Added .github/copilot-instructions.md with project conventions
  • Added .pymarkdown.json config and pymarkdownlnt to dev-requirements.txt for markdown linting

Testing

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.

Copy link
Contributor

Copilot AI left a 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 _EntityExecutor to only pass entity_input to 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.md formatting/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 (ifelif) 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.

@cgillum cgillum force-pushed the cgillum/example-bugs-and-docs branch from 5fbfbf8 to 9182094 Compare February 8, 2026 04:22
- 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
@cgillum cgillum force-pushed the cgillum/example-bugs-and-docs branch from 9182094 to 009f2ea Compare February 8, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant