@neat.is/core 0.9.8 → 0.9.10-dev.20260830

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16981,6 +16981,32 @@ function locusOf(graph, ev) {
16981
16981
  provenance: Provenance26.OBSERVED
16982
16982
  };
16983
16983
  }
16984
+ function locusFromNode(graph, nodeId) {
16985
+ if (!graph.hasNode(nodeId)) return null;
16986
+ const n = graph.getNodeAttributes(nodeId);
16987
+ const file = n.relPath ?? n.path;
16988
+ if (typeof file !== "string" || file.length === 0) return null;
16989
+ const start = n.span?.startLine;
16990
+ const end = n.span?.endLine;
16991
+ return {
16992
+ file,
16993
+ ...typeof start === "number" ? { lineStart: start } : {},
16994
+ ...typeof end === "number" ? { lineEnd: end } : {},
16995
+ ...n.qualname ? { symbol: shortLabel(graph, nodeId) } : {},
16996
+ ...n.service ? { service: n.service } : {},
16997
+ provenance: Provenance26.INFERRED
16998
+ };
16999
+ }
17000
+ function promoteCauseLocus(graph, causeNode, incidents) {
17001
+ const native = incidents.find(
17002
+ (e) => e.affectedNode === causeNode && typeof e.attributes?.[CODE_FILEPATH_ATTR2] === "string"
17003
+ );
17004
+ if (native) {
17005
+ const l = locusOf(graph, native);
17006
+ if (l) return { ...l, symbol: shortLabel(graph, causeNode), provenance: Provenance26.INFERRED };
17007
+ }
17008
+ return locusFromNode(graph, causeNode);
17009
+ }
16984
17010
  function divergenceSummary(d) {
16985
17011
  const column = "column" in d && d.column ? `.${d.column}` : "";
16986
17012
  const label = "table" in d && d.table ? `${d.table}${column}` : `${d.source} \u2192 ${d.target}`;
@@ -17000,7 +17026,7 @@ function shortLabel(graph, nodeId) {
17000
17026
  }
17001
17027
  function renderHeadline(graph, ev, locus, causeNode) {
17002
17028
  const what = ev.exceptionType ? `raised ${ev.exceptionType}` : ev.errorMessage || "failed";
17003
- const cause = causeNode && causeNode !== ev.affectedNode ? ` \u2192 root cause ${shortLabel(graph, causeNode)}` : "";
17029
+ const causeLabel = causeNode && causeNode !== ev.affectedNode ? shortLabel(graph, causeNode) : "";
17004
17030
  if (locus) {
17005
17031
  const base = baseName(locus.file);
17006
17032
  const lines = locus.lineStart != null ? locus.lineEnd && locus.lineEnd !== locus.lineStart ? `LINES ${locus.lineStart}-${locus.lineEnd}` : `LINE ${locus.lineStart}` : "";
@@ -17008,13 +17034,16 @@ function renderHeadline(graph, ev, locus, causeNode) {
17008
17034
  const subject = symbol ? `SYMBOL ${symbol}` : `FILE ${base}`;
17009
17035
  const at = symbol ? `${lines ? `${lines} in ` : ""}${base}` : lines;
17010
17036
  const where = at ? ` at ${at}` : "";
17011
- return `${subject}${where} (SERVICE ${ev.service}) ${what} at ${ev.timestamp}${cause}`;
17037
+ const svc = locus.service ?? ev.service;
17038
+ const cause2 = causeLabel && causeLabel !== symbol ? ` \u2192 root cause ${causeLabel}` : "";
17039
+ return `${subject}${where} (SERVICE ${svc}) ${what} at ${ev.timestamp}${cause2}`;
17012
17040
  }
17041
+ const cause = causeLabel ? ` \u2192 root cause ${causeLabel}` : "";
17013
17042
  return `SERVICE ${ev.service} ${what} at ${ev.timestamp}${cause}`;
17014
17043
  }
17015
17044
  function buildIncidentCard(graph, errorEvent, incidents, policies) {
17016
17045
  const affected = errorEvent.affectedNode;
17017
- const locus = locusOf(graph, errorEvent);
17046
+ let locus = locusOf(graph, errorEvent);
17018
17047
  const inGraph = graph.hasNode(affected);
17019
17048
  const rc = inGraph ? getRootCause(graph, affected, errorEvent, incidents) : null;
17020
17049
  let rootCause = null;
@@ -17034,6 +17063,9 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
17034
17063
  chain
17035
17064
  };
17036
17065
  }
17066
+ if (locus === null && rootCause) {
17067
+ locus = promoteCauseLocus(graph, rootCause.node, incidents);
17068
+ }
17037
17069
  const blast = inGraph ? getBlastRadius(graph, affected) : { origin: affected, affectedNodes: [], totalAffected: 0 };
17038
17070
  const nearest = [...blast.affectedNodes].sort((a, b) => a.distance - b.distance).slice(0, BLAST_NEAREST_LIMIT).map((n) => ({ node: n.nodeId, distance: n.distance, provenance: n.edgeProvenance }));
17039
17071
  const applicable = inGraph ? selectApplicablePolicies(graph, policies, affected) : [];
@@ -22478,4 +22510,4 @@ export {
22478
22510
  deprovisionConnector,
22479
22511
  buildApi
22480
22512
  };
22481
- //# sourceMappingURL=chunk-G4A6FCKG.js.map
22513
+ //# sourceMappingURL=chunk-B6KJG5KN.js.map