Fix Do not mark a pipeline or workflow dirty when a dialog is OK without edits - #8247
Fix Do not mark a pipeline or workflow dirty when a dialog is OK without edits#8247leehaut wants to merge 1 commit into
Conversation
…edits Signed-off-by: lance <leehaut@gmail.com>
|
Hi @leehaut, Thank you for investigating this issue! You did great detective work identifying the two root causes behind why pipelines and workflows were getting marked dirty after simply clicking OK:
The fixes to However, I have some strong reservations regarding the additions to 1. Performance Impact on the UI ThreadIn Calling
For large pipelines (dozens or hundreds of transforms, hops, notes, and connections), running full DOM tree builds and recursive comparisons on the UI thread whenever a dialog closes introduces significant latency and heavy GC churn. The snapshot undo system was specifically designed to use fast, single-pass string comparison: 2. Edge Cases and Potential Data Loss in the XML ComparatorImplementing a custom XML equivalence crawler introduces subtle bugs:
3. Suggested Alternative ApproachThe core reason
In Hop, empty strings and Rather than parsing DOM trees after the fact to paper over this difference:
What do you think about separating the copy-factory fixes from the XML comparison, and handling the empty-string serialization at the source instead? |
mattcasters
left a comment
There was a problem hiding this comment.
See the previous comment with details of the requested changes.
|
Thanks @mattcasters — I agree with the split, and with keeping the copy-factory / live On On treating empty strings like On #8173 the first attempt omitted empty tags the same as @hansva, would you be OK with skipping empty string tags at serialization time, or should we keep In the meantime I can land the copy-factory / |
Opening a transform or action, changing nothing, and clicking OK used to mark the pipeline or workflow as needing save. Cancel or closing the dialog without OK did not. This was easy to hit on every component, because it came from the shared OK path rather than from one plugin.
How it works
Two separate false positives were stacked:
SWT widgets turn
nullinto"".XmlMetadataUtilomits anullfield and writes<tag/>for an empty string. DialoggetInfo()/ok()always writes widget text back, so OK without edits produced XML that failed a string equals. Comparison now usesXmlHandler.sameContentIgnoringEmptyValues, which treats an omitted element as the same as an empty one. Undo snapshot compare uses the same helper. Disk format is unchanged:nullis still omitted,""is still a tag.The dirty flag was restored from a clone. After OK, the delegate did
setChanged(before.hasChanged())when XML matched. Copying a transform or action goes throughsetLocation/setRowDistribution, and those setters flipwrapperChanged. A clone of a clean object therefore looked dirty, so OK without edits still marked the file changed. The livehasChanged()flag from before the dialog is used instead. Copy factories also clear that induced flag when the source is unchanged.Workflow actions had no XML compare at all. Several dialogs call
setChanged()unconditionally on OK (Start is the obvious case). They now use the same omitted-vs-empty comparison, then restore the live flag when content did not change.Entry points:
HopGuiPipelineTransformDelegate(transform dialog, partitioning, error handling)HopGuiWorkflowActionDelegateDefaultTransformMetaCopyFactory/DefaultActionCopyFactoryTests
XmlHandlerUnitTest(omitted vs<tag/>/<tag></tag>, nested empty shells, real text still detected, trailing empty list item)XmlMetadataUtilTest.nullAndEmptyStringSerializeDifferentlyButCompareEqualForChangeDetectionXmlSnapshotUndoTest.sameXmlContentTreatsOmittedAndEmptyElementsAsEqualDefaultTransformMetaCopyFactoryTest.copyOfUnchangedTransformIsNotMarkedChangedDefaultActionCopyFactoryTest.copyOfUnchangedActionMetaIsNotMarkedChanged