Skip to content

Centralize CHASM scheduler lifecycle transitions - #38

Draft
chaptersix wants to merge 4 commits into
sch-readable-action-capacityfrom
sch-readable-lifecycle
Draft

chaptersix wants to merge 4 commits into
sch-readable-action-capacityfrom
sch-readable-lifecycle

Conversation

@chaptersix

@chaptersix chaptersix commented Aug 19, 2026

Copy link
Copy Markdown
Owner

What changed?

  • Add a total BufferedStart lifecycle classifier with an explicit invalid state over Attempt, RunId, Completed, BackoffTime, and the retry evaluation time.
  • Co-locate the classifier and named transitions in the scheduler-private internal package, shared directly by scheduler runtime and migration code without forwarding wrappers.
  • Route lifecycle mutations through those transitions for unprocessed, deferred, ready, retrying, started, and completed starts.
  • Add direct classifier and transition tests plus focused chasmtest.Engine coverage for the unprocessed-to-ready and ready-to-retrying persisted transitions.
  • Pin V1 migration normalization and the existing completion-before-start and backoff-equality behavior.

Production behavior is unchanged. Retry handling advances Attempt exactly once and preserves its existing backoff deadline. A late start result still fills RunId and StartTime without erasing an earlier completion, and a backoff deadline equal to the evaluation time remains ready.

Why?

This is PR 2 of the CHASM scheduler readability stack. It gives the compound BufferedStart tuple one vocabulary and one production mutation boundary without introducing the buffer planner, execution-phase split, property generators, or unrelated test migrations planned for later PRs.

Stack

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)
go test -tags test_dep ./chasm/lib/scheduler/internal -run 'TestClassifyBufferedStart|TestBufferedStartTransitions' -count=1
go test -tags test_dep ./chasm/lib/scheduler -run 'TestBufferedStartLifecycleTransitionsEngine|TestExecuteTask_Validate_BackoffEqualToLPTIsEligible|TestExecuteTask_EngineCharacterizesCurrentWorkValidity|TestHandleNexusCompletion_ReenablesDeferredStarts|TestHandleNexusCompletion_CompletionBeforeStart' -count=1
go test -tags test_dep ./chasm/lib/scheduler/migration -run 'TestLegacyToCreateFromMigrationStateRequest|TestConvertRunningWorkflowsToBufferedStarts_UniqueRequestIDs' -count=1
go test -tags test_dep ./chasm/lib/scheduler/... -count=1
GOLANGCI_LINT_BASE_REV=sch-readable-action-capacity GOLANGCI_LINT_FIX=false make lint-code
git diff --check

Potential risks

The main risk is changing a compound lifecycle tuple while centralizing its writes. Direct classifier tests cover every named state, invalid tuples, and retry-time boundaries; engine and existing race tests protect persisted transition behavior. The migration assertions pin pending normalization and running/completed tuple construction.

@chaptersix
chaptersix force-pushed the sch-readable-lifecycle branch from 8fc058c to 5fd33f5 Compare August 19, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant