Skip to content

Predicates don't gate link execution in linear chains #48

Description

@JoshuaWink

We discovered that Chain.connect() predicates do NOT prevent link execution in linear pipelines. All links execute regardless of predicate evaluation.

Expected Behavior:
When a predicate returns False, the target link should be skipped.

Actual Behavior:
All links run regardless of predicate conditions.

Solution Pattern:
Conditional logic must be implemented INSIDE Links using return statements:

class MyLink(Link):
    async def call(self, ctx):
        if skip_condition:
            return ctx  # Skip operation
        # ... proceed with logic ...
        return ctx

Questions:

  1. Is this intentional design (predicates are metadata/documentation only)?
  2. Are predicates intended only for DAG routing, not linear chain gating?
  3. Should this be documented more clearly?

Context:
We discovered this pattern while building a multi-calendar scheduling system with CodeUChain. We initially tried using predicates to gate event creation when availability slots are empty, but found that predicates don't actually prevent link execution in linear chains.

Reference Implementation:
https://github.com/JoshuaWink/random-research-journal/blob/main/implementations/calendar-workflow/FIX_AVAILABILITY_GATING.md

Environment:

  • CodeUChain: 1.0.0+
  • Python: 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions