Two silent bugs surfaced while building an SVG Project.Diagram dashboard:
a bound DataPoint’s value was chopped to a handful of characters with no
ellipsis (a corpus count of 26324 rendered as 2632 — a plausible-looking
but wrong number), and any <text> element in the source SVG never appeared
on screen, even though shapes (<rect>, <line>, fills, strokes) rendered
correctly.
IconManager’s swarm-canvas badge overlays a DOUBLE DataPoint’s value with
meta.snapshot.value.take(4) — a hard truncation with no indication anything
was cut. DataPointStateView, the composable a Diagram tile uses to render a
bound DataPoint at its anchor rect, routed through that same small
fixed-size badge regardless of how much room the author had actually
allocated for the anchor in the diagram editor.
Separately, the SVG is decoded via Coil’s KMP SvgDecoder
(io.coil-kt.coil3:coil-svg), which draws shape primitives only — it has no
text-rendering support at all on this target set, so <text> is dropped
during decode, not degraded. The upload flow already warned about this with
softened language (“may not render correctly in all environments”) but only
ran the check when a file was picked via the Upload button, not when a URL
was pasted or reloaded via “Load Preview” — the more common path for a
diagram the author uploaded once and now just links to.
DataPointView.kt’s DataPointStateView: DOUBLE values now render as a
dedicated Text sized for the tile (ellipsis on overflow) instead of going
through the small icon-badge overlay; other data types keep using the icon.IconManager.kt’s generic swarm-canvas badge: the DOUBLE take(4) display
now ellipsizes when truncated, so a chopped value is never presented as
complete.DiagramScreen.kt: extracted the <text> detection into
svgContainsTextElements() and ran it from every path that loads SVG
content in the editor (auto-load on meta.source change, “Load Preview”,
and file upload), not just upload. Tightened the warning copy to state
definitively that text is not rendered (matching actual decoder behavior)
and to point at the fix (convert to paths). Updated the “SVG Source URL”
field’s help text, since it explicitly points authors at Inkscape.Adding rendering-bandwidth constraints (fixed badge sizes, hard character
caps) needs an explicit overflow indicator from day one — a truncated value
that looks complete is worse than an empty one, because it’s actively
misleading. When a composable already has more layout room available from
its caller (here, the diagram anchor rect the author sized), route the real
value through that room instead of reusing a badge built for a much smaller,
unrelated context. No realistic automated check catches the second bug class
(a third-party decoder silently no-op’ing on a whole element type) beyond
what the extracted svgContainsTextElements() unit test now covers — full
prevention would mean either vendoring a decoder with text support or
rendering a server-side rasterized preview, both bigger changes than this
fix’s scope.