Skip to content

Change schedule labels to constructor types#326

Merged
waynemwashuma merged 2 commits into
wimaengine:devfrom
waynemwashuma:change-schedule-labels
May 27, 2026
Merged

Change schedule labels to constructor types#326
waynemwashuma merged 2 commits into
wimaengine:devfrom
waynemwashuma:change-schedule-labels

Conversation

@waynemwashuma
Copy link
Copy Markdown
Collaborator

Objective

Refactor schedule identification to use constructor-based schedule labels instead of string labels. Previously, schedules were identified using raw strings such as 'startup' and 'update' This introduces typed constructor-based schedule labels, improving schedule isolation, type safety, internal consistency and integration with the engine’s existing type identity system.

Solution

The scheduling system previously relied on string identifiers. This has several possible problems:

  • string collisions across unrelated schedules
  • weak type safety
  • inconsistent identity handling compared to system groups/types
  • fragile internal lookups
  • harder refactoring and tooling support
  • runtime ambiguity when labels changed

The engine already uses constructor/type-based identity extensively elsewhere through typeid(), but schedules remained string-based.

Why this approach

Alternative approaches considered:

  • namespaced string constants
  • symbols
  • UUID-based schedule labels

Constructor-based labels integrate best with the existing ECS/type architecture because:

  • schedules already behave like engine types
  • type infrastructure already exists
  • constructors provide readable names
  • APIs become more self-documenting
  • tooling/autocomplete improves significantly
  • accidental collisions become much harder

This also creates consistency between:

  • schedules
  • system groups
  • components
  • resources
  • assets

all of which already use constructor identity semantics.

Showcase

Before

scheduler.set(new Executable({
  label: 'update'
}))

scheduler.get('update')

After

class Update {}

scheduler.set(new Executable({
  label: Update
}))

scheduler.get(Update)

Migration guide

String schedule labels are no longer supported. All schedule registration and lookup now relies on constructor identity.

Checklist

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

@github-actions github-actions Bot added mod:app mod:schedule This PR/issue affects the schedule module labels May 27, 2026
@waynemwashuma waynemwashuma self-assigned this May 27, 2026
@waynemwashuma waynemwashuma merged commit 399bd52 into wimaengine:dev May 27, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the change-schedule-labels branch May 27, 2026 15:21
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 rep:breaking type:change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant