Skip to content

BUG: task_id=0 (first task) is never preserved in Context #129

Description

@FernandoCelmer

Description

In context.py lines 70-75, the task_id setter treats 0 as falsy. Since not 0 is True, the setter overwrites a valid task_id=0 with whatever value is passed, including None.

Location

dotflow/core/context.py:70-75

@task_id.setter
def task_id(self, value: int):
    if isinstance(value, int):
        self._task_id = value
    if not self.task_id:       # not 0 == True
        self._task_id = value

Impact

The first task in every workflow (task_id=0) has its ID incorrectly handled. If value=None is passed later, it overwrites the valid 0.

Fix

Change if not self.task_id: to if self._task_id is None:.

Severity

Critical

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.14.0Introduced in v0.14.0bugSomething isn't workingcriticalCritical severity - must fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions