temporalio / temporalio/features

[Feature Request] Feature test confirming unhandled-command update behavior

Open
#451 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
32
Forks
28
Avg merge
1d 9h
Merged PRs (30d)
7

Description

Describe the solution you'd like

Every SDK needs a feature test that confirms that an update is properly processed if it is received while a task that tries to complete the workflow is processing. The test needs to make sure it receives and processes the update before complete (and no cheating like making the workflow function wait on update). This is probably something like:

@workflow.defn
class MyWorkflow:
    def __init__(self) -> None:
        self.result = "done"

    @workflow.run
    async def run(self) -> str:
        # <possibly inject some artificial task hang here on first task attempt>
        return self.result

    @workflow.update
    async def update(self) -> None:
        self.result = "done-from-update"

Then make sure an update is sent while the initial task is processed, causing unhandled command (assert this occurs if possible), and that the workflow result is "done-from-update".

A test like this hopefully helps us confirm that 1) server unhandled-command processing of updates works properly, and 2) coroutine ordering of the update coroutine will make sure it runs before workflow complete.

EDIT: Actually, unhandled command causes full replay. So we probably also need a test that operates on cache. Something like:

@workflow.defn
class MyWorkflow:
    def __init__(self) -> None:
        self.results = []

    @workflow.run
    async def run(self) -> List[str]:
        await workflow.wait_condition(lambda: self.results)
        return self.results

    @workflow.signal
    async def signal(self) -> None:
        self.result.append("got-signal")

    @workflow.update
    async def update(self) -> None:
        self.result.append("got-update")

And make sure that the signal and update are in the same task and in that order (i.e. stop the worker after first task processed before sending signal + update) and that the workflow returns with both values (i.e. signal isn't the only thing processed).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or existing tests are named in the issue. Start by locating the SDK feature-test suites and the workflow, update, signal, and task-processing entry points described here. Done means coverage confirms an update during completion affects the workflow result and that replay or cache handling preserves both the signal and update results.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, python
Domain
distributed-systems, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.