-
Notifications
You must be signed in to change notification settings - Fork 636
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
Guard against parser errors detected while migrating python code #11080
Conversation
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.
Just one comment.
On a general note, I don't think letting the user continue with the migration is a good idea in this case. We would create a backup with the invalid code, which is probably not useful.
Well, I guess the same could be said when there are no code changes needed between python2 and python3. |
@aparajit-pratap In my mind it's a different case. When there are no changes for the current node, you can still say things are "in order" and other nodes can still present changes, so the backup is still useful. Also, remember you are changing the engine, so the backup should happen at this point. However, if the syntax is incorrect then most likely things are not "in order". Maybe the user typed something by mistake before launching the migrator? Backing up the graph with that syntax error is what I believe is not useful. If the user needs to restore the backup, the graph will be invalid, which is probably not expected. |
@mmisol I wanted to show a message to the user saying there is an error in the code when he/she clicked the 2-3 migration icon. If we simply don't do anything then the user could be confused in the absence of any feedback. Perhaps I can continue to show the message in the migration assistant but disable the file backup? |
@aparajit-pratap I'm not saying we should not give feedback to the user, I'm just saying we shouldn't let them proceed. For this purpose we could, for instance, disable the accept button. Beyond the backup, we should also avoid changing the engine. Otherwise, when we do backup we start from invalid content anyway. Preventing the migration seems the safest approach in this situation. |
@Amoursol do you have any feedback on the expected behaviour when there is a parser error in the code and the migration cannot proceed. Do we simply want to disable the migration assistant UI (not do anything), or show a message like the one above, or show some other message popup? |
@aparajit-pratap - This is in the use case where users have non-compliant IronPython2 code they wish to migrate? i.e adding in a single line of If so, I agree that we should not allow them to run the |
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.
Some minor comments. The message one is just a suggestion, you might want to confirm with @Amoursol on the final wording.
src/PythonMigrationViewExtension/MigrationAssistant/PythonMigrationAssistantViewModel.cs
Outdated
Show resolved
Hide resolved
src/PythonMigrationViewExtension/MigrationAssistant/PythonMigrationAssistantViewModel.cs
Show resolved
Hide resolved
<value>There is an error in your code!</value> | ||
</data> | ||
<data name="MigrationAssistantErrorStateMessage" xml:space="preserve"> | ||
<value>Fix all errors before attempting code migration. Clicking cancel will switch back to the Python 2 engine without any code changes.</value> |
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.
Technically, the engine will not be switched back. It should simply remain the same. Even though it doesn't make much sense, you could also launch the migrator with the CPython3
engine set.
How about something more on the lines of: The code migration cannot continue. Please click cancel and fix all errors before re-attempting it.
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.
I'll file a new task - but we should disable the 2->3
button when you have the CPython3 engine set. It's confusing otherwise!
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.
If the engine is already CPython, I'm not doing anything special currently like switching it back to IronPython. So I'm removing the second sentence altogether and leaving it at that.
…amoDS#11080) * guard against parser errors detected while migrating python code * transfer Error state between side-by-side and inline diff views * revert whitespace in unchanged file * disable accept button for error state * update migration message * address review comments
* [DYN-2988] Add custom fixer for instance.None (#11022) * add custom fixer for instance.None * cleanup * cleanup * add post build step to copy custom fixers to output directory * add unit test * review comments * edit fixer code comments * turn on anti-aliasing (#11068) * update base images for image comparison tests after anti-aliasing fix * Guard against parser errors detected while migrating python code (#11080) * guard against parser errors detected while migrating python code * transfer Error state between side-by-side and inline diff views * revert whitespace in unchanged file * disable accept button for error state * update migration message * address review comments
Purpose
https://jira.autodesk.com/browse/DYN-3102
Guard against crash due to parser errors detected while migrating python code. The following message is shown in the migration assistant in such a case:
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@Amoursol - any inputs on the error message (see screenshot).
@mmisol