Skip to content

feat(graph): enhance migration state management and introduce migration stopping functionality. #31626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

ndcunningham
Copy link
Contributor

@ndcunningham ndcunningham commented Jun 17, 2025

Overview

This PR enhances the Migrate UI by adding a "Stop" button that allows users to halt in-progress migrations at any point during execution.
It works in tandem with nrwl/nx-console#2567

Currently

When a migration is running and needs to be stopped for any reason:

  • User accidentally triggered the migration
  • Migration is taking longer than expected
  • Changes are needed before completion

Users must wait for the migration to complete before using the available "Undo" or "Skip" options.

Expected

Users should be able to stop a currently running migration at any time before it completes, providing immediate control over the migration process.

Key Features:

  • Refactor guards to improve migration state checks and add conditions for running and completing migrations.
  • Update the state machine to handle new states for running, stopped, and evaluating migrations.
  • Implement logic to track running migrations and allow for stopping them gracefully.
  • Introduce a new process for running migrations in a separate child process to support cancellation.
  • Enhance metadata management to include stopped migrations and update UI accordingly. (The UI is completely driven by the backend now aka Nx Console)
  • Add tests to cover new migration states and behaviours.

Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 19, 2025 6:20am

Copy link

nx-cloud bot commented Jun 17, 2025

View your CI Pipeline Execution ↗ for commit 6ac7d83.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 33m 9s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 17s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 5s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 3s View ↗
nx documentation ✅ Succeeded 1m 21s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-19 06:48:21 UTC

…on stopping functionality.

- Refactor guards to improve migration state checks and add conditions for running and completing migrations.
- Update the state machine to handle new states for running, stopped, and evaluating migrations.
- Implement logic to track running migrations and allow for stopping them gracefully.
- Introduce a new process for running migrations in a separate child process to support cancellation.
- Enhance metadata management to include stopped migrations and update UI accordingly.
- Add tests to cover new migration states and behaviors, ensuring robust migration handling.
@ndcunningham ndcunningham force-pushed the feat/add-stop-cta-for-migrate-ui branch from 12278c6 to f77e1a1 Compare June 17, 2025 21:01
@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label Jun 23, 2025
Copy link
Collaborator

@MaxKless MaxKless left a comment

Choose a reason for hiding this comment

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

some small stuff but I'm okay if it goes in like this

);

const currentMigrationFailed = useSelector(props.actor, (state) =>
currentMigrationHasFailed(state.context)
const isCurrentMigrationStopped = useSelector(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit but why does this one start with is... when the others don't?

// Check if this migration is in the completed migrations
const completedMigration =
nxConsoleMetadata.completedMigrations?.[migration.id];
const isSkipped = useSelector(
Copy link
Collaborator

Choose a reason for hiding this comment

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

again, maybe we can find a way to reuse these selectors somehow?

@ndcunningham ndcunningham merged commit 92e9133 into master Jun 25, 2025
15 checks passed
@ndcunningham ndcunningham deleted the feat/add-stop-cta-for-migrate-ui branch June 25, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority (not high, not low priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants