Control Plane: Link types chart never shows causal (caused_by) links
Bug Description
The "Link types" chart on the bank stats page only renders temporal, semantic and entity links. Causal links (caused_by) are never shown, even though GET /v1/default/banks/{bank_id}/stats returns them in links_by_link_type.
The chart is hardcoded to three keys in hindsight-control-plane/src/components/bank-stats-view.tsx (checked on main today, around lines 841-857):
{ name: t("temporal"), value: stats.links_by_link_type?.temporal || 0, ... },
{ name: t("semantic"), value: stats.links_by_link_type?.semantic || 0, ... },
{ name: t("entity"), value: stats.links_by_link_type?.entity || 0, ... },
The BankStats type in the same file also only declares temporal, semantic and entity under links_by_link_type.
The graph view is fine. It already maps caused_by / causes / enables / prevents to "causal" and colors those edges #8b5cf6 (label constellation.linkTypeCausal). Only the stats chart is missing the row.
Steps to Reproduce
- Run 0.10.1 with the default
retain_extract_causal_links=true. - Retain some content with cause/effect statements until the bank has causal links.
curl -H "Authorization: Bearer $KEY" http://localhost:8888/v1/default/banks/<bank>/stats- Open the bank page in the Control Plane.
Expected Behavior
The Link types chart shows a causal row (for example 397), and its percentages add up against the same total as the Links counter above it.
Actual Behavior
The API response on my bank:
"total_links": 39576,
"links_by_link_type": {"entity": 2269, "semantic": 8411, "temporal": 28499, "caused_by": 397}
The chart shows only Temporal / Semantic / Entity. The causal links are invisible, and the three percentages are computed over 39,179 links instead of 39,576.
Suggested fix
Add a fourth item that sums the causal types, reusing the existing color and label from the graph view:
{
name: t("causal"),
value:
(stats.links_by_link_type?.caused_by || 0) +
(stats.links_by_link_type?.causes || 0) +
(stats.links_by_link_type?.enables || 0) +
(stats.links_by_link_type?.prevents || 0),
color: "#8b5cf6",
},
plus a bankStats.causal string in src/messages/*.json (only temporal, semantic and entity exist there today) and the matching optional keys on the links_by_link_type type. The legacy names are included because transfer import can still bring them in (LEGACY_CAUSAL_LINK_TYPE_NAMES in engine/causal_links.py).
Version
hindsight-api-slim 0.10.1, @vectorize-io/hindsight-control-plane 0.10.1 (same code on main at f00ad1fe9)