Diagram work items always differ
ewuerger opened this issue · 4 comments
The SVGs on diagram work items are not stable. The content didn't change but symbols and other decoration or style elements have new IDs. This causes a different checksum than found on the Polarion project.
In the end diagram work items are always patched during a Pipeline.
Proposed solution:
Extend api_helper.patch_work_item
with :
if _type == "diagram" and has_visual_changes(new.description, old.description):
return
has_visual_changes
tries to check if there were real changes on the SVG inside the description of the diagram work items. Changed IDs of symbols or any other style elements are false-positives. Changes to paths or any content elements (rect, path, polygon,...) are real changes. has_visual_changes
returns a boolean.
This would mean that we have to get the description for all diagram workitems, right? In addition it is not ready for the future when we move the SVGs to the attachments.
I would highly prefer to find another solution for that. We could for example try to sanitize SVGs somehow so that the IDs are the same for symbols. Or we could include for SVG attachments (in the future) a special hashing algorithm which hashes a rendered representation instead of the SVGs content.
We want to try out both ways and compare them. In the end we'll need PNG files.
So the CairoSVG.svg2png
function will be introduced and we should test if it's enough to compare the checksum of the PNG bytes against each other or if we really need the pixel compare, which @huyenngn implements.
Also this will ultimately land in the rest-api-client repository.
Implemented in release v0.4.1