@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.
@@ -20,7 +20,7 @@ import {
20
20
  startStalenessLoop,
21
21
  touchLastSeen,
22
22
  writeAtomically
23
- } from "./chunk-G4A6FCKG.js";
23
+ } from "./chunk-B6KJG5KN.js";
24
24
  import {
25
25
  assertBindAuthority,
26
26
  buildOtelReceiver,
@@ -901,4 +901,4 @@ export {
901
901
  resolveHost,
902
902
  startDaemon
903
903
  };
904
- //# sourceMappingURL=chunk-I2I5MMO5.js.map
904
+ //# sourceMappingURL=chunk-QETJIA2Q.js.map
package/dist/cli.cjs CHANGED
@@ -17379,6 +17379,32 @@ function locusOf(graph, ev) {
17379
17379
  provenance: import_types60.Provenance.OBSERVED
17380
17380
  };
17381
17381
  }
17382
+ function locusFromNode(graph, nodeId) {
17383
+ if (!graph.hasNode(nodeId)) return null;
17384
+ const n = graph.getNodeAttributes(nodeId);
17385
+ const file = n.relPath ?? n.path;
17386
+ if (typeof file !== "string" || file.length === 0) return null;
17387
+ const start = n.span?.startLine;
17388
+ const end = n.span?.endLine;
17389
+ return {
17390
+ file,
17391
+ ...typeof start === "number" ? { lineStart: start } : {},
17392
+ ...typeof end === "number" ? { lineEnd: end } : {},
17393
+ ...n.qualname ? { symbol: shortLabel(graph, nodeId) } : {},
17394
+ ...n.service ? { service: n.service } : {},
17395
+ provenance: import_types60.Provenance.INFERRED
17396
+ };
17397
+ }
17398
+ function promoteCauseLocus(graph, causeNode, incidents) {
17399
+ const native = incidents.find(
17400
+ (e) => e.affectedNode === causeNode && typeof e.attributes?.[CODE_FILEPATH_ATTR2] === "string"
17401
+ );
17402
+ if (native) {
17403
+ const l = locusOf(graph, native);
17404
+ if (l) return { ...l, symbol: shortLabel(graph, causeNode), provenance: import_types60.Provenance.INFERRED };
17405
+ }
17406
+ return locusFromNode(graph, causeNode);
17407
+ }
17382
17408
  function divergenceSummary(d) {
17383
17409
  const column = "column" in d && d.column ? `.${d.column}` : "";
17384
17410
  const label = "table" in d && d.table ? `${d.table}${column}` : `${d.source} \u2192 ${d.target}`;
@@ -17398,7 +17424,7 @@ function shortLabel(graph, nodeId) {
17398
17424
  }
17399
17425
  function renderHeadline(graph, ev, locus, causeNode) {
17400
17426
  const what = ev.exceptionType ? `raised ${ev.exceptionType}` : ev.errorMessage || "failed";
17401
- const cause = causeNode && causeNode !== ev.affectedNode ? ` \u2192 root cause ${shortLabel(graph, causeNode)}` : "";
17427
+ const causeLabel = causeNode && causeNode !== ev.affectedNode ? shortLabel(graph, causeNode) : "";
17402
17428
  if (locus) {
17403
17429
  const base = baseName(locus.file);
17404
17430
  const lines = locus.lineStart != null ? locus.lineEnd && locus.lineEnd !== locus.lineStart ? `LINES ${locus.lineStart}-${locus.lineEnd}` : `LINE ${locus.lineStart}` : "";
@@ -17406,13 +17432,16 @@ function renderHeadline(graph, ev, locus, causeNode) {
17406
17432
  const subject = symbol ? `SYMBOL ${symbol}` : `FILE ${base}`;
17407
17433
  const at = symbol ? `${lines ? `${lines} in ` : ""}${base}` : lines;
17408
17434
  const where = at ? ` at ${at}` : "";
17409
- return `${subject}${where} (SERVICE ${ev.service}) ${what} at ${ev.timestamp}${cause}`;
17435
+ const svc = locus.service ?? ev.service;
17436
+ const cause2 = causeLabel && causeLabel !== symbol ? ` \u2192 root cause ${causeLabel}` : "";
17437
+ return `${subject}${where} (SERVICE ${svc}) ${what} at ${ev.timestamp}${cause2}`;
17410
17438
  }
17439
+ const cause = causeLabel ? ` \u2192 root cause ${causeLabel}` : "";
17411
17440
  return `SERVICE ${ev.service} ${what} at ${ev.timestamp}${cause}`;
17412
17441
  }
17413
17442
  function buildIncidentCard(graph, errorEvent, incidents, policies) {
17414
17443
  const affected = errorEvent.affectedNode;
17415
- const locus = locusOf(graph, errorEvent);
17444
+ let locus = locusOf(graph, errorEvent);
17416
17445
  const inGraph = graph.hasNode(affected);
17417
17446
  const rc = inGraph ? getRootCause(graph, affected, errorEvent, incidents) : null;
17418
17447
  let rootCause = null;
@@ -17432,6 +17461,9 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
17432
17461
  chain
17433
17462
  };
17434
17463
  }
17464
+ if (locus === null && rootCause) {
17465
+ locus = promoteCauseLocus(graph, rootCause.node, incidents);
17466
+ }
17435
17467
  const blast = inGraph ? getBlastRadius(graph, affected) : { origin: affected, affectedNodes: [], totalAffected: 0 };
17436
17468
  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 }));
17437
17469
  const applicable = inGraph ? selectApplicablePolicies(graph, policies, affected) : [];