@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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  routeSpanToProject,
3
3
  startDaemon
4
- } from "./chunk-I2I5MMO5.js";
4
+ } from "./chunk-QETJIA2Q.js";
5
5
  import {
6
6
  ProjectNameCollisionError,
7
7
  addProject,
@@ -37,7 +37,7 @@ import {
37
37
  thresholdForEdgeType,
38
38
  touchLastSeen,
39
39
  writeAtomically
40
- } from "./chunk-G4A6FCKG.js";
40
+ } from "./chunk-B6KJG5KN.js";
41
41
  import {
42
42
  startOtelGrpcReceiver
43
43
  } from "./chunk-ERE47MCR.js";
package/dist/neatd.cjs CHANGED
@@ -17220,6 +17220,32 @@ function locusOf(graph, ev) {
17220
17220
  provenance: import_types59.Provenance.OBSERVED
17221
17221
  };
17222
17222
  }
17223
+ function locusFromNode(graph, nodeId) {
17224
+ if (!graph.hasNode(nodeId)) return null;
17225
+ const n = graph.getNodeAttributes(nodeId);
17226
+ const file = n.relPath ?? n.path;
17227
+ if (typeof file !== "string" || file.length === 0) return null;
17228
+ const start = n.span?.startLine;
17229
+ const end = n.span?.endLine;
17230
+ return {
17231
+ file,
17232
+ ...typeof start === "number" ? { lineStart: start } : {},
17233
+ ...typeof end === "number" ? { lineEnd: end } : {},
17234
+ ...n.qualname ? { symbol: shortLabel(graph, nodeId) } : {},
17235
+ ...n.service ? { service: n.service } : {},
17236
+ provenance: import_types59.Provenance.INFERRED
17237
+ };
17238
+ }
17239
+ function promoteCauseLocus(graph, causeNode, incidents) {
17240
+ const native = incidents.find(
17241
+ (e) => e.affectedNode === causeNode && typeof e.attributes?.[CODE_FILEPATH_ATTR2] === "string"
17242
+ );
17243
+ if (native) {
17244
+ const l = locusOf(graph, native);
17245
+ if (l) return { ...l, symbol: shortLabel(graph, causeNode), provenance: import_types59.Provenance.INFERRED };
17246
+ }
17247
+ return locusFromNode(graph, causeNode);
17248
+ }
17223
17249
  function divergenceSummary(d) {
17224
17250
  const column = "column" in d && d.column ? `.${d.column}` : "";
17225
17251
  const label = "table" in d && d.table ? `${d.table}${column}` : `${d.source} \u2192 ${d.target}`;
@@ -17239,7 +17265,7 @@ function shortLabel(graph, nodeId) {
17239
17265
  }
17240
17266
  function renderHeadline(graph, ev, locus, causeNode) {
17241
17267
  const what = ev.exceptionType ? `raised ${ev.exceptionType}` : ev.errorMessage || "failed";
17242
- const cause = causeNode && causeNode !== ev.affectedNode ? ` \u2192 root cause ${shortLabel(graph, causeNode)}` : "";
17268
+ const causeLabel = causeNode && causeNode !== ev.affectedNode ? shortLabel(graph, causeNode) : "";
17243
17269
  if (locus) {
17244
17270
  const base = baseName(locus.file);
17245
17271
  const lines = locus.lineStart != null ? locus.lineEnd && locus.lineEnd !== locus.lineStart ? `LINES ${locus.lineStart}-${locus.lineEnd}` : `LINE ${locus.lineStart}` : "";
@@ -17247,13 +17273,16 @@ function renderHeadline(graph, ev, locus, causeNode) {
17247
17273
  const subject = symbol ? `SYMBOL ${symbol}` : `FILE ${base}`;
17248
17274
  const at = symbol ? `${lines ? `${lines} in ` : ""}${base}` : lines;
17249
17275
  const where = at ? ` at ${at}` : "";
17250
- return `${subject}${where} (SERVICE ${ev.service}) ${what} at ${ev.timestamp}${cause}`;
17276
+ const svc = locus.service ?? ev.service;
17277
+ const cause2 = causeLabel && causeLabel !== symbol ? ` \u2192 root cause ${causeLabel}` : "";
17278
+ return `${subject}${where} (SERVICE ${svc}) ${what} at ${ev.timestamp}${cause2}`;
17251
17279
  }
17280
+ const cause = causeLabel ? ` \u2192 root cause ${causeLabel}` : "";
17252
17281
  return `SERVICE ${ev.service} ${what} at ${ev.timestamp}${cause}`;
17253
17282
  }
17254
17283
  function buildIncidentCard(graph, errorEvent, incidents, policies) {
17255
17284
  const affected = errorEvent.affectedNode;
17256
- const locus = locusOf(graph, errorEvent);
17285
+ let locus = locusOf(graph, errorEvent);
17257
17286
  const inGraph = graph.hasNode(affected);
17258
17287
  const rc = inGraph ? getRootCause(graph, affected, errorEvent, incidents) : null;
17259
17288
  let rootCause = null;
@@ -17273,6 +17302,9 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
17273
17302
  chain
17274
17303
  };
17275
17304
  }
17305
+ if (locus === null && rootCause) {
17306
+ locus = promoteCauseLocus(graph, rootCause.node, incidents);
17307
+ }
17276
17308
  const blast = inGraph ? getBlastRadius(graph, affected) : { origin: affected, affectedNodes: [], totalAffected: 0 };
17277
17309
  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 }));
17278
17310
  const applicable = inGraph ? selectApplicablePolicies(graph, policies, affected) : [];