Skip to content

refactor: extract mission lifecycle transitions#653

Merged
jayscambler merged 1 commit intorefactor/generation-run-state-modelfrom
refactor/mission-lifecycle-transitions
Apr 9, 2026
Merged

refactor: extract mission lifecycle transitions#653
jayscambler merged 1 commit intorefactor/generation-run-state-modelfrom
refactor/mission-lifecycle-transitions

Conversation

@jayscambler
Copy link
Copy Markdown
Contributor

Summary

  • extract mission lifecycle transition logic out of MissionManager
  • add focused tests for status transitions and verifier-result mapping
  • prepare mission workflows for future state-machine work without changing behavior

TDD / DDD / DRY framing

This is the next stacked architectural PR after #652.

Bounded context extracted:

  • Mission Lifecycle — status transitions and verifier-driven lifecycle outcomes for missions

Test-first work:

  • added lifecycle helper tests first
  • implemented pure mission lifecycle helpers
  • rewired MissionManager to delegate transition and verifier-error/result mapping

Changes

New module

  • ts/src/mission/lifecycle.ts
    • resolveMissionStatusTransition
    • deriveMissionStatusFromVerifierResult
    • buildVerifierErrorResult

New tests

  • ts/tests/mission-lifecycle.test.ts

Manager integration

  • ts/src/mission/manager.ts
    • delegates status transition semantics to lifecycle helpers
    • delegates verifier error/result lifecycle mapping to lifecycle helpers

Validation

  • cd ts && npx vitest run tests/mission-lifecycle.test.ts tests/mission.test.ts tests/mission-execution.test.ts tests/mission-dashboard.test.ts
  • cd ts && npm run lint

Follow-up

At this point, the main remaining code-review recommendation is the larger codegen templating redesign (moving more generator logic away from giant inline strings toward template-backed generation). A future XState-style rewrite can build on the explicit generation and mission state/lifecycle modules introduced in this stack.

@jayscambler jayscambler merged commit 80e81bc into refactor/generation-run-state-model Apr 9, 2026
4 checks passed
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