Skip to content

Add comprehensive test suite for transition scheduling#662

Draft
scazan wants to merge 6 commits intotransition-scheduling-corefrom
transition-scheduling-tests
Draft

Add comprehensive test suite for transition scheduling#662
scazan wants to merge 6 commits intotransition-scheduling-corefrom
transition-scheduling-tests

Conversation

@scazan
Copy link
Collaborator

@scazan scazan commented Feb 24, 2026

Summary

  • Add 23 integration tests covering transition processing in processTransitions.test.ts (2,020 lines)
  • Add helper methods to TestDecisionsDataManager for test setup
  • Update createInstanceFromTemplate.test.ts for new transition behavior
  • Add test setup utilities in packages/common/src/test/setup.ts

Part 3 of 3 in the transition scheduling logic stack:

  1. encoder-type-consolidation (Consolidate ProcessPhase type and modernize process schema encoder #660) — Encoder/UI type consolidation
  2. transition-scheduling-core (Add transition scheduling logic for phase-based advancement #661) — Core scheduling logic
  3. This PR — Test suite

Test plan

  • pnpm typecheck passes
  • pnpm format:check passes
  • All 23 tests pass: pnpm w:api test -- --run src/routers/decision/transitions/processTransitions.test.ts

Move ProcessPhase type from scattered UI component definitions to a single
export from the encoder. Replace legacy processSchemaEncoder with a
phase-based format that uses passthrough for flexibility.
Implement date-based transition creation, update, and processing for
decision process phases. Key changes:
- Rewrite createTransitionsForProcess with date-based advancement filtering
- Rewrite updateTransitionsForProcess with parallel operations
- Refactor transitionMonitor for batch processing and deferred state updates
- Move transition creation to publish time instead of instance creation
- Add ScheduledTransition type and new exports
@vercel
Copy link
Contributor

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview Feb 24, 2026 3:06am

Request Review

Transitions are no longer created on instance creation (DRAFT status).
They are created when the instance is published.
Use v2 relational query API in createInstanceFromTemplate and
updateDecisionInstance. transitionEngine and transitionMonitor
remain on db._query as their relations are not yet in v2.
Instance data phases always contain rules (copied from template at
creation time), so the extra process schema fetch is unnecessary.
Removes the schema lookup and reads advancement rules directly from
instanceData.phases[].rules.
Add 23 integration tests covering transition processing including:
- Phase transition creation and updates
- Batch processing and concurrent execution
- Edge cases for date-based advancement
- Test helper infrastructure for decisions data management
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