Skip to content

Surprising dataclass changes when passed across a task graph boundary #780

Description

@elinscott

When a dataclass-typed socket crosses a @task.graph boundary, aiida-workgraph routes the value through dataclasses.asdict + cls(**), which preserves the shape but promotes bare Python ints/floats/bools to their orm.Int / orm.Float / orm.Bool equivalents along the way.

cls(**asdict_value) then re-stores those wrapped values, which breaks downstream stdlib arithmetic e.g. (range(orm.Int(...)) raises TypeError because orm.Int doesn't implement__index__).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions