Symptom

Kraken’s nightly architectural scan flagged DiagramScreen.kt, claiming parseAnchors(content) (regex-based SVG anchor parsing) runs unbounded on every recomposition of DiagramScreen/MiniDiagram — implying O(N*M) CPU spikes during drag/zoom/layout interaction across “all diagram views.” The lead also cited parseAnchors as “not defined in the file” and flagged setSingletonImageLoaderFactory being called inside @Composable bodies as a reconfiguration hotspot.

Root cause

Mostly a false positive, but it pointed at a real, narrower issue nearby.

Fix

Prevention

When a Kraken lead cites a function as “not defined in the file” as supporting evidence, treat that as a strong signal the review is stale/inaccurate — verify the claim by grepping the file directly before trusting the rest of the hypothesis. For Compose recomposition hotspot leads generally: check whether the flagged computation is already gated behind LaunchedEffect/remember with stable keys before assuming it runs on every recomposition — but don’t stop there; scan sibling code paths in the same file for the same pattern without the gating, since a plausible-sounding lead can be wrong about its cited location while still pointing at a real issue one composable over.