Skip to content

Expose scheduler builder to ECS World#327

Draft
waynemwashuma wants to merge 5 commits into
wimaengine:devfrom
waynemwashuma:expose-scheduler-builder
Draft

Expose scheduler builder to ECS World#327
waynemwashuma wants to merge 5 commits into
wimaengine:devfrom
waynemwashuma:expose-scheduler-builder

Conversation

@waynemwashuma
Copy link
Copy Markdown
Collaborator

@waynemwashuma waynemwashuma commented May 27, 2026

Objective

Expose the SchedulerBuilder as an application resource to support:

  • schedule inspection/debug tooling
  • future runtime schedule manipulation
  • external schedule analysis systems

Additionally, refactor the scheduling internals to better separate global builder orchestration from per-schedule compilation logic.

Solution

Previously, the SchedulerBuilder existed as a private field inside App:

app.systemBuilder

This made the scheduling pipeline inaccessible to external systems such as:

  • inspectors
  • editor tooling
  • debugging utilities
  • runtime schedule mutation systems

It also tightly coupled schedule compilation state to the builder itself.

Changes made

Exposed SchedulerBuilder as a resource

The builder is now registered through CorePlugin. This allows systems and tooling to access the active scheduling state through the ECS world/resource system. The App now delegates scheduling operations through SchedulerBuilder.Instance instead of maintaining a private instance field.

Refactored schedule compilation into ScheduleContext

As part of exposing the builder globally, the internal scheduling logic was refactored to better isolate per-schedule state.

Introduced ScheduleContext which now owns:

  • system registration
  • group registration
  • parent resolution
  • cycle detection
  • graph expansion
  • topology sorting
  • ordering resolution

SchedulerBuilder now primarily acts as:

  • a registration collector
  • a context factory
  • a scheduler orchestration layer

Why this approach

Exposing the scheduler builder as a resource enables future tooling and runtime features without requiring direct access to the App internals.

Examples include:

  • visual schedule inspectors
  • hot-reloading systems
  • runtime system injection/removal
  • debugging schedule graphs
  • editor integrations

The ScheduleContext refactor supports this by ensuring schedule-local state is isolated and easier to reason about independently.

Showcase

N/A

Migration guide

Notes

  • No public system registration API changes.
  • Existing scheduling semantics are preserved.
  • Scheduler internals are now organized around ScheduleContext.

Checklist

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

@waynemwashuma waynemwashuma self-assigned this May 27, 2026
@waynemwashuma waynemwashuma added the type:enhancement New feature or request label May 27, 2026
@github-actions github-actions Bot added mod:app mod:schedule This PR/issue affects the schedule module labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:app mod:schedule This PR/issue affects the schedule module type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant