chore: user office experiment workflow - #1391
Conversation
…ect/user-office-core into SWAP-5222-user-office-experiment-workflow-improvement
…oject/user-office-core into SWAP-5222-user-office-experiment-workflow-improvement
Co-authored-by: Copilot <copilot@github.com>
…of github.com:UserOfficeProject/user-office-core into SWAP-5222-user-office-experiment-workflow-improvement
…re into SWAP-5222-user-office-experiment-workflow-improvement
…oject/user-office-core into SWAP-5222-user-office-experiment-workflow-improvement
|
@copilot please resolve the merge conflicts. resolve those that you are confident of |
Resolved the merge conflicts and committed the merge resolution in |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 70 out of 70 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
apps/backend/src/eventHandlers/workflowEntities/proposal/statusActionEngine.ts:33
groupByPropertiesis set to['workflowId', 'statusId'], but the items being grouped are{ proposal, workflowStatusConnectionId }and neither the wrapper nor theProposalmodel definesworkflowId/statusId. In practice this groups everything together (all keys becomeundefined), so if multiple differentworkflowStatusConnectionIds are present you may execute the wrong status actions for some proposals.
apps/backend/src/eventHandlers/workflowEntities/proposal/statusActionEngine.ts:35- The outer
Promise.all(...)is not returned/awaited, so callers cannot reliably await completion of status actions, and any rejection inside can become unhandled. Eitherreturn/awaitthePromise.allresult (and consider also awaiting/returning the async handlers inside the innerstatusActions.map).
…hance experiment status change tests
… experiment and proposal status engines
| // NOTE: We need to group the proposals by 'workflow' and 'status' because proposals coming in here can be from different workflows/calls. | ||
| const groupByProperties = ['workflowId', 'statusId']; | ||
| // NOTE: Here the result is something like: [[proposalsWithWorkflowStatusIdCombination1], [proposalsWithWorkflowStatusIdCombination2]...] | ||
| const groupByProperties = ['workflowStatusConnectionId']; |
jekabs-karklins
left a comment
There was a problem hiding this comment.
LGTM. I tested also with the staging database and migrations runs well.
|
@copilot resolve the merge conflicts in this pull request |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Resolved the merge conflicts from |
Description
This PR implements comprehensive workflow improvements for experiment safety management and integrates the new workflow data structures across the application. It includes support for manual status changes, enhanced workflow engine with guards, and updates to frontend components for better workflow status handling.
Motivation and Context
The experiment safety workflow needs to support more sophisticated status transitions and manual interventions similar to the proposal workflow. This requires integrating the new workflow data structures (from SWAP-4949) into the experiment safety module and implementing proper authorization checks, event handling, and UI components for managing experiment safety workflow statuses.
Related Issue: SWAP-5222
How Has This Been Tested
Changes
Backend Changes
Database Migrations:
0208_MigrateOldWorkflowsToNewDataStructures.sql- Migrates existing workflows to new data structures0211_ExperimentSafetyWorkflowStatusNotNull.sql- Makes experiment_safety.workflow_status_id non-nullable with AWAITING_ESF backfillWorkflow Engine & Guards:
src/workflowEngine/experiment.ts)Data Sources:
ExperimentDataSourceto support workflow status managementWorkflowDataSourcefor experiment safety workflowsEvent Handlers:
Authorization:
ExperimentSafetyAuthorizationfor workflow-based access controlMutations:
ChangeExperimentsSafetyStatusMutationfor manual status changesFrontend Changes
Experiment Safety Components:
ChangeExperimentSafetyStatus.tsx- New component for manual status changesExperimentSafety.tsx,ExperimentSafetyPage.tsx,ExperimentSafetyReview.tsx- Updated for new workflow status handlingExperimentSafetyNotification.tsx- Enhanced notifications for workflow changesWorkflow Management:
WorkflowEditor.tsx,WorkflowView.tsx- Enhanced workflow visualizationStatusEventsAndActionsDialog.tsx- Updated for workflow actionsworkflowUtils.ts- Utility functions for workflow status handlingUI Updates:
E2E Tests
Depends on
This PR builds upon the workflow overhaul from SWAP-4949. The new workflow data structures and state machine implementation are integrated into the experiment safety module.
Tests included/Docs Updated?