@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/neatd.js CHANGED
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  reconcileDaemonRecordSync,
4
4
  startDaemon
5
- } from "./chunk-I2I5MMO5.js";
5
+ } from "./chunk-QETJIA2Q.js";
6
6
  import {
7
7
  listProjects,
8
8
  registryPath
9
- } from "./chunk-G4A6FCKG.js";
9
+ } from "./chunk-B6KJG5KN.js";
10
10
  import {
11
11
  BindAuthorityError,
12
12
  __require
package/dist/server.cjs CHANGED
@@ -16912,6 +16912,32 @@ function locusOf(graph, ev) {
16912
16912
  provenance: import_types58.Provenance.OBSERVED
16913
16913
  };
16914
16914
  }
16915
+ function locusFromNode(graph, nodeId) {
16916
+ if (!graph.hasNode(nodeId)) return null;
16917
+ const n = graph.getNodeAttributes(nodeId);
16918
+ const file = n.relPath ?? n.path;
16919
+ if (typeof file !== "string" || file.length === 0) return null;
16920
+ const start = n.span?.startLine;
16921
+ const end = n.span?.endLine;
16922
+ return {
16923
+ file,
16924
+ ...typeof start === "number" ? { lineStart: start } : {},
16925
+ ...typeof end === "number" ? { lineEnd: end } : {},
16926
+ ...n.qualname ? { symbol: shortLabel(graph, nodeId) } : {},
16927
+ ...n.service ? { service: n.service } : {},
16928
+ provenance: import_types58.Provenance.INFERRED
16929
+ };
16930
+ }
16931
+ function promoteCauseLocus(graph, causeNode, incidents) {
16932
+ const native = incidents.find(
16933
+ (e) => e.affectedNode === causeNode && typeof e.attributes?.[CODE_FILEPATH_ATTR2] === "string"
16934
+ );
16935
+ if (native) {
16936
+ const l = locusOf(graph, native);
16937
+ if (l) return { ...l, symbol: shortLabel(graph, causeNode), provenance: import_types58.Provenance.INFERRED };
16938
+ }
16939
+ return locusFromNode(graph, causeNode);
16940
+ }
16915
16941
  function divergenceSummary(d) {
16916
16942
  const column = "column" in d && d.column ? `.${d.column}` : "";
16917
16943
  const label = "table" in d && d.table ? `${d.table}${column}` : `${d.source} \u2192 ${d.target}`;
@@ -16931,7 +16957,7 @@ function shortLabel(graph, nodeId) {
16931
16957
  }
16932
16958
  function renderHeadline(graph, ev, locus, causeNode) {
16933
16959
  const what = ev.exceptionType ? `raised ${ev.exceptionType}` : ev.errorMessage || "failed";
16934
- const cause = causeNode && causeNode !== ev.affectedNode ? ` \u2192 root cause ${shortLabel(graph, causeNode)}` : "";
16960
+ const causeLabel = causeNode && causeNode !== ev.affectedNode ? shortLabel(graph, causeNode) : "";
16935
16961
  if (locus) {
16936
16962
  const base = baseName(locus.file);
16937
16963
  const lines = locus.lineStart != null ? locus.lineEnd && locus.lineEnd !== locus.lineStart ? `LINES ${locus.lineStart}-${locus.lineEnd}` : `LINE ${locus.lineStart}` : "";
@@ -16939,13 +16965,16 @@ function renderHeadline(graph, ev, locus, causeNode) {
16939
16965
  const subject = symbol ? `SYMBOL ${symbol}` : `FILE ${base}`;
16940
16966
  const at = symbol ? `${lines ? `${lines} in ` : ""}${base}` : lines;
16941
16967
  const where = at ? ` at ${at}` : "";
16942
- return `${subject}${where} (SERVICE ${ev.service}) ${what} at ${ev.timestamp}${cause}`;
16968
+ const svc = locus.service ?? ev.service;
16969
+ const cause2 = causeLabel && causeLabel !== symbol ? ` \u2192 root cause ${causeLabel}` : "";
16970
+ return `${subject}${where} (SERVICE ${svc}) ${what} at ${ev.timestamp}${cause2}`;
16943
16971
  }
16972
+ const cause = causeLabel ? ` \u2192 root cause ${causeLabel}` : "";
16944
16973
  return `SERVICE ${ev.service} ${what} at ${ev.timestamp}${cause}`;
16945
16974
  }
16946
16975
  function buildIncidentCard(graph, errorEvent, incidents, policies) {
16947
16976
  const affected = errorEvent.affectedNode;
16948
- const locus = locusOf(graph, errorEvent);
16977
+ let locus = locusOf(graph, errorEvent);
16949
16978
  const inGraph = graph.hasNode(affected);
16950
16979
  const rc = inGraph ? getRootCause(graph, affected, errorEvent, incidents) : null;
16951
16980
  let rootCause = null;
@@ -16965,6 +16994,9 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
16965
16994
  chain
16966
16995
  };
16967
16996
  }
16997
+ if (locus === null && rootCause) {
16998
+ locus = promoteCauseLocus(graph, rootCause.node, incidents);
16999
+ }
16968
17000
  const blast = inGraph ? getBlastRadius(graph, affected) : { origin: affected, affectedNodes: [], totalAffected: 0 };
16969
17001
  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 }));
16970
17002
  const applicable = inGraph ? selectApplicablePolicies(graph, policies, affected) : [];