@neat.is/core 0.9.2 → 0.9.3-dev.20260823

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-TMHCS4ZY.js";
9
+ } from "./chunk-WJGZYEUG.js";
10
10
  import {
11
11
  buildSearchIndex
12
12
  } from "./chunk-BC53SCT7.js";
@@ -74,7 +74,7 @@ import {
74
74
  startStalenessLoop,
75
75
  upsertConnectorEntry,
76
76
  validateConnectorEntry
77
- } from "./chunk-HD5X5TWY.js";
77
+ } from "./chunk-LRYPKC3B.js";
78
78
  import {
79
79
  startOtelGrpcReceiver
80
80
  } from "./chunk-ERE47MCR.js";
package/dist/index.cjs CHANGED
@@ -9892,12 +9892,12 @@ async function resolveConfigs(literals, keys, serviceDir, looksLike, parse11) {
9892
9892
  const value = await interpolateEnvRefs(raw, serviceDir);
9893
9893
  if (!looksLike(value)) continue;
9894
9894
  const parsed = parse11(value);
9895
- if (parsed) out.push(parsed);
9895
+ if (parsed) out.push({ ...parsed, hostSource: "config" });
9896
9896
  }
9897
9897
  for (const lit of literals) {
9898
9898
  if (!looksLike(lit)) continue;
9899
9899
  const parsed = parse11(lit);
9900
- if (parsed) out.push(parsed);
9900
+ if (parsed) out.push({ ...parsed, hostSource: "literal" });
9901
9901
  }
9902
9902
  return out;
9903
9903
  }
@@ -10166,7 +10166,10 @@ async function addDatabasesAndCompat(graph, services, scanPath) {
10166
10166
  type: import_types23.EdgeType.CONNECTS_TO,
10167
10167
  provenance: import_types23.Provenance.EXTRACTED,
10168
10168
  confidence: (0, import_types23.confidenceForExtracted)("structural"),
10169
- evidence: { file: evidenceFile }
10169
+ // Carry how the host was recovered (ADR-213) so the divergence ranker
10170
+ // can tell a real declared store from a hardcoded fault-injection /
10171
+ // flag-gated probe. Only set when the parser distinguished the two.
10172
+ evidence: config.hostSource ? { file: evidenceFile, hostSource: config.hostSource } : { file: evidenceFile }
10170
10173
  };
10171
10174
  if (!graph.hasEdge(edge.id)) {
10172
10175
  graph.addEdgeWithKey(edge.id, edge.source, edge.target, edge);
@@ -16443,6 +16446,53 @@ function detectColumnDrift(node) {
16443
16446
  function involvesNode(d, nodeId) {
16444
16447
  return d.source === nodeId || d.target === nodeId;
16445
16448
  }
16449
+ function datastoreEverObserved(graph, nodeId) {
16450
+ if (!graph.hasNode(nodeId)) return false;
16451
+ const n = graph.getNodeAttributes(nodeId);
16452
+ if (n.type === import_types58.NodeType.DatabaseNode) {
16453
+ const via = n.discoveredVia;
16454
+ if (via === "otel" || via === "merged") return true;
16455
+ }
16456
+ for (const edgeId of graph.inboundEdges(nodeId)) {
16457
+ const e = graph.getEdgeAttributes(edgeId);
16458
+ if (e.provenance === import_types58.Provenance.OBSERVED || e.provenance === import_types58.Provenance.STALE) return true;
16459
+ }
16460
+ return false;
16461
+ }
16462
+ function serviceHasObservedSameEngineStore(graph, buckets2, serviceId16, engine, excludeTarget) {
16463
+ for (const bucket of buckets2.values()) {
16464
+ if (bucket.type !== import_types58.EdgeType.CONNECTS_TO) continue;
16465
+ if (bucket.source !== serviceId16) continue;
16466
+ if (bucket.target === excludeTarget) continue;
16467
+ if (!graph.hasNode(bucket.target)) continue;
16468
+ const target = graph.getNodeAttributes(bucket.target);
16469
+ if (target.type !== import_types58.NodeType.DatabaseNode) continue;
16470
+ if (target.engine !== engine) continue;
16471
+ if (bucket.observed || datastoreEverObserved(graph, bucket.target)) return true;
16472
+ }
16473
+ return false;
16474
+ }
16475
+ var DEAD_CODE_PROBE_CONFIDENCE = 0.1;
16476
+ function dampenDeadCodeProbes(graph, buckets2, all) {
16477
+ return all.map((d) => {
16478
+ if (d.type !== "missing-observed") return d;
16479
+ if (!d.extracted || d.edgeType !== import_types58.EdgeType.CONNECTS_TO) return d;
16480
+ if (!graph.hasNode(d.target)) return d;
16481
+ const target = graph.getNodeAttributes(d.target);
16482
+ if (target.type !== import_types58.NodeType.DatabaseNode) return d;
16483
+ if (d.extracted.evidence?.hostSource !== "literal") return d;
16484
+ if (datastoreEverObserved(graph, d.target)) return d;
16485
+ const engine = target.engine;
16486
+ if (!serviceHasObservedSameEngineStore(graph, buckets2, d.source, engine, d.target)) return d;
16487
+ const host = target.host ?? target.name;
16488
+ return {
16489
+ ...d,
16490
+ confidence: Math.min(d.confidence, DEAD_CODE_PROBE_CONFIDENCE),
16491
+ reason: `${d.source} declares a ${engine} connection to a hardcoded-literal host (${host}) that production has never observed, while it does observe another ${engine} store \u2014 this reads as a flag-gated or dead-code declaration (e.g. a fault-injection probe), not a real declared-vs-observed gap.`,
16492
+ recommendation: "Confirm this is an intentional dead alternate \u2014 a fault-injection probe or a flag-gated branch. If it is meant to run in production, check the feature flag or conditional that gates it; if not, it can be ignored or removed."
16493
+ };
16494
+ });
16495
+ }
16446
16496
  function suppressHostMismatchHalves(all) {
16447
16497
  const observedHalf = /* @__PURE__ */ new Set();
16448
16498
  const declaredHalf = /* @__PURE__ */ new Set();
@@ -16479,7 +16529,8 @@ function computeDivergences(graph, opts = {}) {
16479
16529
  }
16480
16530
  });
16481
16531
  const reconciled = suppressHostMismatchHalves(all);
16482
- let filtered = reconciled;
16532
+ const dampened = dampenDeadCodeProbes(graph, buckets2, reconciled);
16533
+ let filtered = dampened;
16483
16534
  if (opts.type) {
16484
16535
  const allowed = opts.type;
16485
16536
  filtered = filtered.filter((d) => allowed.has(d.type));