Repository navigation
fix(core): leave the session unchanged on a failed load - #243
Merged
Merged
Conversation
Opening a CSV that passes the file check but fails analysis, for example loops nested deeper than 3, emptied the session: the undo history was cleared, the recipe was replaced by the failed snapshot, the unsaved mark was set and sync was notified, while the grid still showed the old steps. RecipeSession.LoadAsCurrent cleared history and replaced the snapshot before it checked the analysis result. Taking the PLC recipe from the conflict dialog used the same method and skipped the import check that the reconnect path runs. LoadAsCurrent now analyzes first and changes the snapshot, history, unsaved mark and sync notification only on success, so a failed load leaves the session, the file name and the title as they were, and the error reaches the notification panel. The conflict take goes through ApplyRecipeFromPlc, the check the reconnect path uses. Refs #234 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
A CSV that passed the file check but failed analysis, for example loops nested deeper than 3, still changed the session:
RecipeSession.LoadAsCurrentcleared the undo history, stored the failed snapshot, set the unsaved mark and notified sync before it checked the analysis result. The session recipe became empty while the grid still showed the old steps, so a later Save could write an empty file. The PLC conflict take (ResolveConflict(false)) also loaded the PLC recipe without the import check the reconnect path runs.What changed
LoadAsCurrentanalyzes first and changes the snapshot, history, unsaved mark and sync state only on success. On failure the session, grid, undo, file name and title stay as they were, and the error reaches the notification panel.ApplyRecipeFromPlc, so it checks the PLC recipe like reconnect does.RecipeSession.LastValidRecipeis deleted: it had no production reader and now always equalsCurrent.docs/plans/20261130-recipe-replace-save-exit-safety.mdand its UI spec. This PR is its Task 1.After a failed take, sync still stays on until Task 3 of the plan turns it off; that is better than before, when the take wiped the local recipe.
Verification
dotnet format --verify-no-changesclean.Refs #234
🤖 Generated with Claude Code