Skip to content

Fix empty group ordering#322

Merged
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:fix-empty-group-ordering
May 25, 2026
Merged

Fix empty group ordering#322
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:fix-empty-group-ordering

Conversation

@waynemwashuma
Copy link
Copy Markdown
Collaborator

Objective

Fix scheduling behavior for empty system groups by treating them as explicit ordering barriers during graph expansion. This ensures ordering constraints remain valid even when intermediary groups contain no systems.

Solution

Previously, group ordering constraints were expanded directly into system-to-system edges. This worked when groups contained systems, but failed for empty groups because they produced no graph nodes during expansion.

As a result, ordering relationships that depended on empty intermediary phases could silently disappear. This introduces explicit graph nodes for system groups and uses them as ordering barriers when a group has no systems.The new approach preserves ordering semantics regardless of whether a group currently contains systems.Instead of collapsing groups prematurely into systems, the scheduler now treats groups as first-class ordering nodes. This allows:

  • empty groups to participate in ordering
  • future extensibility for other barriers
  • consistent graph semantics across systems and groups

Showcase

Before

builder.addGroup({
  label: StartPhase,
  schedule: 'update',
  before: [MiddlePhase]
})

builder.addGroup({
  label: MiddlePhase,
  schedule: 'update',
  before: [EndPhase]
})

builder.addGroup({
  label: EndPhase,
  schedule: 'update'
})

If MiddlePhase contained no systems, the ordering relationship could collapse during graph expansion.

After

builder.addGroup({
  label: StartPhase,
  schedule: 'update',
  before: [MiddlePhase]
})

builder.addGroup({
  label: MiddlePhase,
  schedule: 'update',
  before: [EndPhase]
})

builder.addGroup({
  label: EndPhase,
  schedule: 'update'
})

MiddlePhase now acts as a stable ordering barrier even without systems.

Migration guide

No migration required.

Notes

  • Empty system groups now participate in scheduling order resolution
  • Existing schedules continue to work unchanged
  • Topological sorting still outputs executable systems only

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this May 25, 2026
@github-actions github-actions Bot added the mod:schedule This PR/issue affects the schedule module label May 25, 2026
@waynemwashuma waynemwashuma added type:bug Something isn't working mod:schedule This PR/issue affects the schedule module and removed mod:schedule This PR/issue affects the schedule module labels May 25, 2026
@waynemwashuma waynemwashuma merged commit 25eb742 into wimaengine:dev May 25, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the fix-empty-group-ordering branch May 25, 2026 23:37
@waynemwashuma waynemwashuma restored the fix-empty-group-ordering branch May 26, 2026 11:58
@waynemwashuma waynemwashuma deleted the fix-empty-group-ordering branch May 26, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:schedule This PR/issue affects the schedule module type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant