Skip to content

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

Merged
ndcunningham merged 3 commits intomasterfrom
feat/add-stop-cta-for-migrate-ui
Jun 25, 2025
Merged

feat(graph): enhance migration state management and introduce migration stopping functionality.#31626
ndcunningham merged 3 commits intomasterfrom
feat/add-stop-cta-for-migrate-ui

Conversation

@ndcunningham
Copy link
Copy Markdown
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.

@vercel
Copy link
Copy Markdown

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

@nx-cloud
Copy link
Copy Markdown
Contributor

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
Comment thread packages/nx/src/command-line/migrate/migrate-ui-api.ts Outdated
Comment thread graph/migrate/src/lib/components/migration-card.tsx
Comment thread graph/migrate/src/lib/state/automatic/selectors.ts Outdated
Comment thread graph/migrate/src/lib/state/automatic/selectors.ts
@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label Jun 23, 2025
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

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?

Comment thread graph/migrate/src/lib/components/migration-card.tsx
// Check if this migration is in the completed migrations
const completedMigration =
nxConsoleMetadata.completedMigrations?.[migration.id];
const isSkipped = useSelector(
Copy link
Copy Markdown
Contributor

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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 1, 2025

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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