Skip to content

Maintain similar ordering of elements between DefaultStateTransitionComparator and FlowJobBuilder #4527

Closed
@robertmcnees

Description

@robertmcnees

When provided with multiple paths, the reference documentation states that:

The framework automatically orders transitions from most specific to least specific.

This flow is decided by FlowJobBuilder which then delegates to DefaultStateTransitionComparator. The problem is that the ordering returned by DefaultStateTransitionComparator is reversed before it is used by FlowJobBuilder.

This problem is discussed in a PR comment in more detail:

This is important because as a Batch user, if I want to provide a custom comparator, I would not have to do this mental effort to think backward in the comparator's implementation.

Expected Behavior

FlowJobBuilder should prioritize foo > fo? > ??? > foo* > * (no change to existing functionality)

DefaultStateTransitionComparator should return foo > fo? > ??? > foo* > *

Current Behavior

FlowJobBuilder should prioritize foo > fo? > ??? > foo* > * (no change to existing functionality)

DefaultStateTransitionComparator returns * > foo* > ??? > fo? > foo

Context

I propose reversing the order of DefaultStateTransitionComparator so it matches the logical execution of FlowJobBuilder.

The user interacts with FlowJobBuilder directly so I do not expect the change to break existing functionality. The change is primarily to avoid confusion to users if they choose to implement their own custom comparator.

This was identified while investigating issue #3996 and submitting PR #4509

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions