@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.
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  resolveHost,
7
7
  resolveNeatVersion,
8
8
  writeDaemonRecord
9
- } from "./chunk-I2I5MMO5.js";
9
+ } from "./chunk-QETJIA2Q.js";
10
10
  import {
11
11
  buildSearchIndex
12
12
  } from "./chunk-BC53SCT7.js";
@@ -75,7 +75,7 @@ import {
75
75
  startStalenessLoop,
76
76
  upsertConnectorEntry,
77
77
  validateConnectorEntry
78
- } from "./chunk-G4A6FCKG.js";
78
+ } from "./chunk-B6KJG5KN.js";
79
79
  import {
80
80
  startOtelGrpcReceiver
81
81
  } from "./chunk-ERE47MCR.js";
package/dist/index.cjs CHANGED
@@ -17208,6 +17208,32 @@ function locusOf(graph, ev) {
17208
17208
  provenance: import_types59.Provenance.OBSERVED
17209
17209
  };
17210
17210
  }
17211
+ function locusFromNode(graph, nodeId) {
17212
+ if (!graph.hasNode(nodeId)) return null;
17213
+ const n = graph.getNodeAttributes(nodeId);
17214
+ const file = n.relPath ?? n.path;
17215
+ if (typeof file !== "string" || file.length === 0) return null;
17216
+ const start = n.span?.startLine;
17217
+ const end = n.span?.endLine;
17218
+ return {
17219
+ file,
17220
+ ...typeof start === "number" ? { lineStart: start } : {},
17221
+ ...typeof end === "number" ? { lineEnd: end } : {},
17222
+ ...n.qualname ? { symbol: shortLabel(graph, nodeId) } : {},
17223
+ ...n.service ? { service: n.service } : {},
17224
+ provenance: import_types59.Provenance.INFERRED
17225
+ };
17226
+ }
17227
+ function promoteCauseLocus(graph, causeNode, incidents) {
17228
+ const native = incidents.find(
17229
+ (e) => e.affectedNode === causeNode && typeof e.attributes?.[CODE_FILEPATH_ATTR2] === "string"
17230
+ );
17231
+ if (native) {
17232
+ const l = locusOf(graph, native);
17233
+ if (l) return { ...l, symbol: shortLabel(graph, causeNode), provenance: import_types59.Provenance.INFERRED };
17234
+ }
17235
+ return locusFromNode(graph, causeNode);
17236
+ }
17211
17237
  function divergenceSummary(d) {
17212
17238
  const column = "column" in d && d.column ? `.${d.column}` : "";
17213
17239
  const label = "table" in d && d.table ? `${d.table}${column}` : `${d.source} \u2192 ${d.target}`;
@@ -17227,7 +17253,7 @@ function shortLabel(graph, nodeId) {
17227
17253
  }
17228
17254
  function renderHeadline(graph, ev, locus, causeNode) {
17229
17255
  const what = ev.exceptionType ? `raised ${ev.exceptionType}` : ev.errorMessage || "failed";
17230
- const cause = causeNode && causeNode !== ev.affectedNode ? ` \u2192 root cause ${shortLabel(graph, causeNode)}` : "";
17256
+ const causeLabel = causeNode && causeNode !== ev.affectedNode ? shortLabel(graph, causeNode) : "";
17231
17257
  if (locus) {
17232
17258
  const base = baseName(locus.file);
17233
17259
  const lines = locus.lineStart != null ? locus.lineEnd && locus.lineEnd !== locus.lineStart ? `LINES ${locus.lineStart}-${locus.lineEnd}` : `LINE ${locus.lineStart}` : "";
@@ -17235,13 +17261,16 @@ function renderHeadline(graph, ev, locus, causeNode) {
17235
17261
  const subject = symbol ? `SYMBOL ${symbol}` : `FILE ${base}`;
17236
17262
  const at = symbol ? `${lines ? `${lines} in ` : ""}${base}` : lines;
17237
17263
  const where = at ? ` at ${at}` : "";
17238
- return `${subject}${where} (SERVICE ${ev.service}) ${what} at ${ev.timestamp}${cause}`;
17264
+ const svc = locus.service ?? ev.service;
17265
+ const cause2 = causeLabel && causeLabel !== symbol ? ` \u2192 root cause ${causeLabel}` : "";
17266
+ return `${subject}${where} (SERVICE ${svc}) ${what} at ${ev.timestamp}${cause2}`;
17239
17267
  }
17268
+ const cause = causeLabel ? ` \u2192 root cause ${causeLabel}` : "";
17240
17269
  return `SERVICE ${ev.service} ${what} at ${ev.timestamp}${cause}`;
17241
17270
  }
17242
17271
  function buildIncidentCard(graph, errorEvent, incidents, policies) {
17243
17272
  const affected = errorEvent.affectedNode;
17244
- const locus = locusOf(graph, errorEvent);
17273
+ let locus = locusOf(graph, errorEvent);
17245
17274
  const inGraph = graph.hasNode(affected);
17246
17275
  const rc = inGraph ? getRootCause(graph, affected, errorEvent, incidents) : null;
17247
17276
  let rootCause = null;
@@ -17261,6 +17290,9 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
17261
17290
  chain
17262
17291
  };
17263
17292
  }
17293
+ if (locus === null && rootCause) {
17294
+ locus = promoteCauseLocus(graph, rootCause.node, incidents);
17295
+ }
17264
17296
  const blast = inGraph ? getBlastRadius(graph, affected) : { origin: affected, affectedNodes: [], totalAffected: 0 };
17265
17297
  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 }));
17266
17298
  const applicable = inGraph ? selectApplicablePolicies(graph, policies, affected) : [];