Skip to content

Add transition scheduling logic for phase-based advancement#661

Open
scazan wants to merge 10 commits intodevfrom
transition-scheduling-core
Open

Add transition scheduling logic for phase-based advancement#661
scazan wants to merge 10 commits intodevfrom
transition-scheduling-core

Conversation

@scazan
Copy link
Collaborator

@scazan scazan commented Feb 24, 2026

Summary

  • 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 (not instance creation)
  • Add ScheduledTransition type and new exports from @op/common

Part 2 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. This PR — Core scheduling logic
  3. transition-scheduling-tests — Test suite

Test plan

  • pnpm typecheck passes
  • pnpm format:check passes
  • Transitions are only created when instance is published (not on DRAFT creation)
  • Date-based phase advancement correctly filters eligible phases
  • Batch processing handles concurrent transitions

@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 Mar 5, 2026 10:25am

Request Review

@scazan scazan marked this pull request as draft February 24, 2026 02:06
@scazan scazan force-pushed the encoder-type-consolidation branch from 726cc62 to 1263207 Compare March 2, 2026 15:01
@scazan scazan force-pushed the transition-scheduling-core branch from ce34f90 to b5a934e Compare March 2, 2026 15:04
Base automatically changed from encoder-type-consolidation to dev March 3, 2026 08:58
scazan added 7 commits March 3, 2026 09:59
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
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.
{
phaseId: 'phase-a',
rules: { advancement: { method: 'date' } },
endDate: '2026-06-01T00:00:00.000Z',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using this at the root level of the phase or in the rules?

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.

2 participants