[2m════════════════════════════════════════════════════════════════════════════════[0m [36m[1mTREE DIFF SHOWCASE[0m[39m [2m- Demonstrating Current Limitations[0m [2m════════════════════════════════════════════════════════════════════════════════[0m
[33m[1mHASH SUPPORT CHECK[0m[39m [2mChecking which SVG types have vtable.hash filled in:[0m
String Hash: [32mYES[39m i32 Hash: [32mYES[39m bool Hash: [32mYES[39m [2m---[0m Svg Hash: [31mNO[39m SvgElement Hash: [31mNO[39m SvgRect Hash: [31mNO[39m SvgCircle Hash: [31mNO[39m SvgGroup Hash: [31mNO[39m Vec [33mConclusion: Custom structs/enums don't have Hash - we need structural hashing![39m [33m[1mSTRUCTURAL HASHING[0m[39m [2mBut with Peek::structural_hash, we can hash any Facet type:[0m svg1 (red rect) hash: e704ac169c8275a1 svg2 (clone) hash: e704ac169c8275a1 svg3 (blue rect) hash: 4e45605b6ceb322b svg1 == svg2: [32mYES[39m (hashes [32mmatch![39m) svg1 == svg3: [31mNO[39m (hashes [33mdiffer![39m) [2mThis showcase demonstrates how facet-diff currently handles tree mutations.[0m [2mThe goal is to identify areas for improvement with Merkle-tree based diffing.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mDeep Attribute Change[0m[39m [2mChange a single attribute (fill: red → green) deep in a nested group.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mGroup[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 1 unchanged field[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mRect[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 4 unchanged fields[39m [38;2;115;218;202mfill[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"red"[39m → [38;2;115;218;202m"green"[39m [38;2;86;95;137m}[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mSwap Two Children[0m[39m [2mSwap the order of rect and circle elements. Ideally shows as a reorder, not delete+insert.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [38;2;247;118;142m- SvgElement::Rect(SvgRect { x: "10", y: "10", width: "30", height: "30", fill: "red", })[39m [1mCircle[0m [38;2;86;95;137m(structurally equal)[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mDelete a Child[0m[39m [2mRemove the middle element (circle) from a list of three elements.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [38;2;247;118;142m- SvgElement::Rect(SvgRect { x: "10", y: "10", width: "30", height: "30", fill: "red", })[39m [38;2;247;118;142m- SvgElement::Circle(SvgCircle { cx: "50", cy: "50", r: "15", fill: "green", })[39m [1mRect[0m [38;2;86;95;137m{[39m [38;2;115;218;202mfill[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"blue"[39m → [38;2;115;218;202m"red"[39m [38;2;115;218;202mheight[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"20"[39m → [38;2;115;218;202m"30"[39m [38;2;115;218;202mwidth[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"20"[39m → [38;2;115;218;202m"30"[39m [38;2;115;218;202mx[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"70"[39m → [38;2;115;218;202m"10"[39m [38;2;115;218;202my[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"70"[39m → [38;2;115;218;202m"10"[39m [38;2;86;95;137m}[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mAdd a Child[0m[39m [2mInsert a new circle element between two existing rect elements.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mRect[0m [38;2;86;95;137m(structurally equal)[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mMove a Child Between Groups[0m[39m [2mMove the circle from the 'left' group to the 'right' group. Ideally detected as a move.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mGroup[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 1 unchanged field[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [38;2;247;118;142m- SvgElement::Circle(SvgCircle { cx: "25", cy: "50", r: "20", fill: "red", })[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m────────────────────────────────────────────────────────────────────────────────[0m [33m[1mSCENARIO:[0m[39m [37m[1mNested Group Modification[0m[39m [2mModify circle attributes (fill, r) three levels deep in nested groups.[0m [2m────────────────────────────────────────────────────────────────────────────────[0m [1mDiff output:[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 2 unchanged fields[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mGroup[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 1 unchanged field[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mGroup[0m [38;2;86;95;137m{[39m [38;2;86;95;137m.. 1 unchanged field[39m [38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m [1mRect[0m [38;2;86;95;137m(structurally equal)[39m [38;2;86;95;137m][39m [38;2;86;95;137m}[39m [2m════════════════════════════════════════════════════════════════════════════════[0m [36m[1mEND OF SHOWCASE[0m[39m [2m════════════════════════════════════════════════════════════════════════════════[0m [1mCircle[0m [38;2;86;95;137m(structurally equal)[39m
[38;2;86;95;137m][39m
[38;2;86;95;137m}[39m
[38;2;115;218;202m+ SvgElement::Rect(SvgRect {
x: "10",
y: "10",
width: "30",
height: "30",
fill: "red",
})[39m
[38;2;115;218;202m+ SvgElement::Rect(SvgRect {
x: "70",
y: "70",
width: "20",
height: "20",
fill: "blue",
})[39m
[38;2;115;218;202m+ SvgElement::Circle(SvgCircle {
cx: "50",
cy: "50",
r: "15",
fill: "green",
})[39m
[1mRect[0m [38;2;86;95;137m(structurally equal)[39m
[1mGroup[0m [38;2;86;95;137m{[39m
[38;2;86;95;137m.. 1 unchanged field[39m
[38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m
[1mRect[0m [38;2;86;95;137m(structurally equal)[39m
[38;2;115;218;202m+ SvgElement::Circle(SvgCircle {
cx: "25",
cy: "50",
r: "20",
fill: "red",
})[39m
[38;2;86;95;137m][39m
[38;2;86;95;137m}[39m
[38;2;86;95;137m][39m
[38;2;86;95;137m}[39m
[1mGroup[0m [38;2;86;95;137m{[39m
[38;2;86;95;137m.. 1 unchanged field[39m
[38;2;115;218;202mchildren[39m[38;2;86;95;137m:[39m [38;2;86;95;137m[[39m
[1mCircle[0m [38;2;86;95;137m{[39m
[38;2;86;95;137m.. 2 unchanged fields[39m
[38;2;115;218;202mfill[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"blue"[39m → [38;2;115;218;202m"yellow"[39m
[38;2;115;218;202mr[39m[38;2;86;95;137m:[39m [38;2;247;118;142m"30"[39m → [38;2;115;218;202m"40"[39m
[38;2;86;95;137m}[39m
[38;2;86;95;137m][39m
[38;2;86;95;137m}[39m
[38;2;86;95;137m][39m
[38;2;86;95;137m}[39m