This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
feat: detect "old" bots and migrate them to new runtime #6526
Merged
Merged
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
d68993e
introduce a migration system for updating legacy projcts to the 2.0 r…
benbrown 460453c
updated
benbrown a5c8bfc
ensure root dialog gets updated appropriately
benbrown 000b342
adjust method for updating root dialog
benbrown 4f9808e
remove comments
benbrown 024868d
fire migration warning when loading bot
benbrown b27254e
use original project name for new project
benbrown 7843021
close modal on submit
benbrown b8addeb
Merge branch 'main' into benbrown/migrate
benbrown 7e26b4a
Merge branch 'main' into benbrown/migrate
benbrown 3658147
address feedback
benbrown 1a9cb5a
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown 47fae76
add confirm modal
benbrown fe8b9b2
Merge branch 'main' into benbrown/migrate
benbrown bb59d34
Rename azureFunctionsPublish publish targets to azurePublish (new sha…
benbrown 68dc4fc
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown b5abb69
Delete a.en-us.lu
benbrown 2479d54
Delete a.en-us.qna
benbrown e8169cc
Delete b.en-us.lu
benbrown d9e71f5
Delete b.en-us.qna
benbrown 093811e
Delete bot1.en-us.lu
benbrown f5a89e0
Delete bot1.en-us.qna
benbrown f600dd6
do not require pva to migrate
benbrown d3f4e9e
Merge branch 'benbrown/migrate' of https://github.com/microsoft/BotFr…
benbrown 414b47c
Add missing parameters
benbrown f187daf
Merge branch 'main' into benbrown/migrate
benbrown 42540e5
Merge branch 'main' into benbrown/migrate
benbrown db140f0
clarify types
benbrown 11dbdb2
Merge branch 'benbrown/migrate' of https://github.com/microsoft/BotFr…
benbrown f3d0ced
Merge branch 'main' into benbrown/migrate
benbrown 9bf1a4f
Merge branch 'main' into benbrown/migrate
benbrown 2d0b8ad
Merge branch 'main' into benbrown/migrate
benbrown e347d8a
Fix tests
benbrown 1cf91c1
Merge branch 'main' into benbrown/migrate
benbrown 37294ae
Fixes #6844: migrate appinsights key to new location
benbrown b64606f
Merge branch 'main' into benbrown/migrate
boydc2014 f8a6765
fix migrate lint issue
lei9444 962d5de
Merge branch 'main' into benbrown/migrate
zhixzhan 9a64f2b
Merge branch 'main' into benbrown/migrate
benbrown 75b562b
Merge branch 'main' into benbrown/migrate
boydc2014 92ae67f
plumb through the yeomanOptions parameter, required to set the locati…
benbrown 6284c35
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown a4c1ff1
feat: new validation pipeline - schema existence validation (#7001)
yeze322 efb2418
Merge branch 'main' into benbrown/migrate
cwhitten ae55b50
Merge branch 'main' into benbrown/migrate
cwhitten 66751eb
Merge branch 'main' into benbrown/migrate
cwhitten 00deeef
Merge branch 'main' into benbrown/migrate
benbrown 4aef551
Merge branch 'main' into benbrown/migrate
cwhitten 000eca2
Merge branch 'main' into benbrown/migrate
cwhitten 541c45c
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown 0ae895e
Merge branch 'main' into benbrown/migrate
benbrown a114bd3
fix mapping of schema files during migration
benbrown fe68602
Merge branch 'benbrown/migrate' of https://github.com/microsoft/BotFr…
benbrown cd36b16
fix lint
benbrown 21db3d7
fix default name of migrated project
benbrown f8d699f
run schema merge as part of the migration
benbrown be877bb
do we need to migrate teh schema? or not?
benbrown f342b87
do not migrate schema
benbrown 23f938a
- Adding field for runtime language
pavolum f9f3f86
Passing runtime lang and type down to yeoman calls
pavolum a5c1f45
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown 35f6696
Merge branch 'main' into benbrown/migrate
benbrown 0d26615
Fixing adaptive runtime name
pavolum 6e97e42
Hardcoding runtime version and fixing settings page generation on mig…
pavolum 8549d11
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown ad59967
Fixing check for 'inBotMigration' to be based on CreationStatusState …
pavolum 6278bab
Fix default naming
pavolum 88bc8a8
revert preload.js
benbrown 3aad038
Merging latest and resolving conflict
pavolum 0b340bb
Resolving PR comments and fixing errors from merge
pavolum c836d9d
Merge branch 'pavolum/migrateUiFix' of https://github.com/microsoft/B…
benbrown 6e6ea91
Change schema diagnostics severity to 'Error'
yeze322 e15fde5
Merge branch 'main' into benbrown/migrate
benbrown c4a87d6
Fetch @latest version from npm before migration
benbrown cfb39a2
Merge branch 'main' into benbrown/migrate
benbrown 8399207
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown 4b940d9
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
cwhitten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ import { | |
| userSettingsState, | ||
| templateProjectsState, | ||
| } from '../../../recoilModel'; | ||
| import { localBotsDataSelector } from '../../../recoilModel/selectors/project'; | ||
| import Home from '../../../pages/home/Home'; | ||
| import { useProjectIdCache } from '../../../utils/hooks'; | ||
| import { ImportModal } from '../../ImportModal/ImportModal'; | ||
|
|
@@ -43,6 +44,7 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => { | |
| fetchFeed, | ||
| openProject, | ||
| saveProjectAs, | ||
| migrateProjectTo, | ||
| fetchProjectById, | ||
| createNewBotV2, | ||
| fetchReadMe, | ||
|
|
@@ -52,6 +54,8 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => { | |
| const creationFlowStatus = useRecoilValue(creationFlowStatusState); | ||
| const projectId = useRecoilValue(currentProjectIdState); | ||
| const storages = useRecoilValue(storagesState); | ||
| const botProjects = useRecoilValue(localBotsDataSelector); | ||
| const botProject = botProjects.find((b) => b.projectId === projectId); | ||
| const focusedStorageFolder = useRecoilValue(focusedStorageFolderState); | ||
| const { appLocale } = useRecoilValue(userSettingsState); | ||
| const cachedProjectId = useProjectIdCache(); | ||
|
|
@@ -150,13 +154,28 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => { | |
| saveProjectAs(projectId, formData.name, formData.description, formData.location); | ||
| }; | ||
|
|
||
| const handleMigrate = (formData) => { | ||
| handleDismiss(); | ||
| setCreationFlowStatus(CreationFlowStatus.MIGRATE); | ||
| migrateProjectTo( | ||
| projectId, | ||
| formData.name, | ||
| formData.description, | ||
| formData.location, | ||
| formData.runtimeLanguage, | ||
| formData.runtimeType | ||
| ); | ||
| }; | ||
|
|
||
| const handleSubmit = async (formData, templateId: string) => { | ||
| handleDismiss(); | ||
| switch (creationFlowStatus) { | ||
| case CreationFlowStatus.SAVEAS: | ||
| handleSaveAs(formData); | ||
| break; | ||
|
|
||
| case CreationFlowStatus.MIGRATE: | ||
| handleMigrate(formData); | ||
| break; | ||
| default: | ||
| saveTemplateId(templateId); | ||
| await handleCreateNew(formData, templateId); | ||
|
|
@@ -226,6 +245,16 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => { | |
| onDismiss={handleDismiss} | ||
| onOpen={openBot} | ||
| /> | ||
| <DefineConversationV2 | ||
| createFolder={createFolder} | ||
| focusedStorageFolder={focusedStorageFolder} | ||
| path="migrate/:projectId" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what the path is for but do you need to add a route to router.tsx for migration?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is is inside the creation flow I think this would take the creation route as prefix followed by migrate/:projectId as a sub routes |
||
| templateId={botProject?.name || 'migrated_project'} // templateId is used for default project name | ||
| updateFolder={updateFolder} | ||
| onCurrentPathUpdate={updateCurrentPath} | ||
| onDismiss={handleDismiss} | ||
| onSubmit={handleMigrate} | ||
| /> | ||
| <ImportModal path="import" /> | ||
| </Router> | ||
| </Fragment> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...er/packages/client/src/pages/design/DebugPanel/TabExtensions/DiagnosticsTab/useAutoFix.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import get from 'lodash/get'; | ||
| import set from 'lodash/set'; | ||
| import cloneDeep from 'lodash/cloneDeep'; | ||
| import { useRecoilValue } from 'recoil'; | ||
| import { useEffect } from 'react'; | ||
|
|
||
| import { DiagnosticType, SchemaDiagnostic } from '../../../../diagnostics/types'; | ||
| import { botProjectSpaceSelector, dispatcherState } from '../../../../../recoilModel'; | ||
|
|
||
| import { useDiagnosticsData } from './useDiagnostics'; | ||
|
|
||
| export const useAutoFix = () => { | ||
| const diagnostics = useDiagnosticsData(); | ||
| const botProjectSpace = useRecoilValue(botProjectSpaceSelector); | ||
| const { updateDialog } = useRecoilValue(dispatcherState); | ||
|
|
||
| // Auto fix schema absence by setting 'disabled' to true. | ||
| useEffect(() => { | ||
| const schemaDiagnostics = diagnostics.filter((d) => d.type === DiagnosticType.SCHEMA) as SchemaDiagnostic[]; | ||
| /** | ||
| * Aggregated diagnostic paths where contains schema problem | ||
| * | ||
| * Example: | ||
| * { | ||
| * // projectId | ||
| * '2096.637': { | ||
| * // dialogId | ||
| * 'dialog-1': [ | ||
| * 'triggers[0].actions[1]', // diagnostics.dialogPath | ||
| * 'triggers[2].actions[3]' | ||
| * ] | ||
| * } | ||
| * } | ||
| */ | ||
| const aggregatedPaths: { [projectId: string]: { [dialogId: string]: string[] } } = {}; | ||
|
|
||
| // Aggregates schema diagnostics by projectId, dialogId | ||
| schemaDiagnostics.forEach((d) => { | ||
| const { projectId, id: dialogId, dialogPath } = d; | ||
| if (!dialogPath) return; | ||
| const currentPaths = get(aggregatedPaths, [projectId, dialogId]); | ||
| if (currentPaths) { | ||
| currentPaths.push(dialogPath); | ||
| } else { | ||
| set(aggregatedPaths, [projectId, dialogId], [dialogPath]); | ||
| } | ||
| }); | ||
|
|
||
| // Consumes aggregatedPaths to update dialogs in recoil store | ||
| for (const [projectId, pathsByDialogId] of Object.entries(aggregatedPaths)) { | ||
| // Locates dialogs in current project | ||
| const dialogsInProject = botProjectSpace.find((bot) => bot.projectId === projectId)?.dialogs; | ||
| if (!Array.isArray(dialogsInProject)) continue; | ||
|
|
||
| for (const [dialogId, paths] of Object.entries(pathsByDialogId)) { | ||
| // Queries out current dialog data | ||
| const dialogData = dialogsInProject.find((dialog) => dialog.id === dialogId)?.content; | ||
| if (!dialogData) continue; | ||
|
|
||
| // Filters out those paths where action exists and action.disabled !== true | ||
| const pathsToUpdate = paths.filter((p) => { | ||
| const data = get(dialogData, p); | ||
| return data && !get(data, 'disabled'); | ||
| }); | ||
| if (!pathsToUpdate.length) continue; | ||
|
|
||
| // Manipulates the 'disabled' property and then submit to Recoil store. | ||
| const copy = cloneDeep(dialogData); | ||
| for (const p of pathsToUpdate) { | ||
| set(copy, `${p}.disabled`, true); | ||
| } | ||
| updateDialog({ id: dialogId, projectId, content: copy }); | ||
| } | ||
| } | ||
| }, [diagnostics]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleDismiss sets the creation flow to CLOSE and then navigates home. Is that all synchronous? This then sets the status to MIGRATE. Do you want to only set the status to one state or does this need to go through the CLOSE state?