@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.
@@ -20,7 +20,7 @@ import {
20
20
  startStalenessLoop,
21
21
  touchLastSeen,
22
22
  writeAtomically
23
- } from "./chunk-HD5X5TWY.js";
23
+ } from "./chunk-LRYPKC3B.js";
24
24
  import {
25
25
  assertBindAuthority,
26
26
  buildOtelReceiver,
@@ -891,4 +891,4 @@ export {
891
891
  resolveHost,
892
892
  startDaemon
893
893
  };
894
- //# sourceMappingURL=chunk-TMHCS4ZY.js.map
894
+ //# sourceMappingURL=chunk-WJGZYEUG.js.map
package/dist/cli.cjs CHANGED
@@ -9912,12 +9912,12 @@ async function resolveConfigs(literals, keys, serviceDir, looksLike, parse12) {
9912
9912
  const value = await interpolateEnvRefs(raw, serviceDir);
9913
9913
  if (!looksLike(value)) continue;
9914
9914
  const parsed = parse12(value);
9915
- if (parsed) out.push(parsed);
9915
+ if (parsed) out.push({ ...parsed, hostSource: "config" });
9916
9916
  }
9917
9917
  for (const lit of literals) {
9918
9918
  if (!looksLike(lit)) continue;
9919
9919
  const parsed = parse12(lit);
9920
- if (parsed) out.push(parsed);
9920
+ if (parsed) out.push({ ...parsed, hostSource: "literal" });
9921
9921
  }
9922
9922
  return out;
9923
9923
  }
@@ -10186,7 +10186,10 @@ async function addDatabasesAndCompat(graph, services, scanPath) {
10186
10186
  type: import_types23.EdgeType.CONNECTS_TO,
10187
10187
  provenance: import_types23.Provenance.EXTRACTED,
10188
10188
  confidence: (0, import_types23.confidenceForExtracted)("structural"),
10189
- evidence: { file: evidenceFile }
10189
+ // Carry how the host was recovered (ADR-213) so the divergence ranker
10190
+ // can tell a real declared store from a hardcoded fault-injection /
10191
+ // flag-gated probe. Only set when the parser distinguished the two.
10192
+ evidence: config.hostSource ? { file: evidenceFile, hostSource: config.hostSource } : { file: evidenceFile }
10190
10193
  };
10191
10194
  if (!graph.hasEdge(edge.id)) {
10192
10195
  graph.addEdgeWithKey(edge.id, edge.source, edge.target, edge);
@@ -15981,6 +15984,53 @@ function detectColumnDrift(node) {
15981
15984
  function involvesNode(d, nodeId) {
15982
15985
  return d.source === nodeId || d.target === nodeId;
15983
15986
  }
15987
+ function datastoreEverObserved(graph, nodeId) {
15988
+ if (!graph.hasNode(nodeId)) return false;
15989
+ const n = graph.getNodeAttributes(nodeId);
15990
+ if (n.type === import_types57.NodeType.DatabaseNode) {
15991
+ const via = n.discoveredVia;
15992
+ if (via === "otel" || via === "merged") return true;
15993
+ }
15994
+ for (const edgeId of graph.inboundEdges(nodeId)) {
15995
+ const e = graph.getEdgeAttributes(edgeId);
15996
+ if (e.provenance === import_types57.Provenance.OBSERVED || e.provenance === import_types57.Provenance.STALE) return true;
15997
+ }
15998
+ return false;
15999
+ }
16000
+ function serviceHasObservedSameEngineStore(graph, buckets2, serviceId16, engine, excludeTarget) {
16001
+ for (const bucket of buckets2.values()) {
16002
+ if (bucket.type !== import_types57.EdgeType.CONNECTS_TO) continue;
16003
+ if (bucket.source !== serviceId16) continue;
16004
+ if (bucket.target === excludeTarget) continue;
16005
+ if (!graph.hasNode(bucket.target)) continue;
16006
+ const target = graph.getNodeAttributes(bucket.target);
16007
+ if (target.type !== import_types57.NodeType.DatabaseNode) continue;
16008
+ if (target.engine !== engine) continue;
16009
+ if (bucket.observed || datastoreEverObserved(graph, bucket.target)) return true;
16010
+ }
16011
+ return false;
16012
+ }
16013
+ var DEAD_CODE_PROBE_CONFIDENCE = 0.1;
16014
+ function dampenDeadCodeProbes(graph, buckets2, all) {
16015
+ return all.map((d) => {
16016
+ if (d.type !== "missing-observed") return d;
16017
+ if (!d.extracted || d.edgeType !== import_types57.EdgeType.CONNECTS_TO) return d;
16018
+ if (!graph.hasNode(d.target)) return d;
16019
+ const target = graph.getNodeAttributes(d.target);
16020
+ if (target.type !== import_types57.NodeType.DatabaseNode) return d;
16021
+ if (d.extracted.evidence?.hostSource !== "literal") return d;
16022
+ if (datastoreEverObserved(graph, d.target)) return d;
16023
+ const engine = target.engine;
16024
+ if (!serviceHasObservedSameEngineStore(graph, buckets2, d.source, engine, d.target)) return d;
16025
+ const host = target.host ?? target.name;
16026
+ return {
16027
+ ...d,
16028
+ confidence: Math.min(d.confidence, DEAD_CODE_PROBE_CONFIDENCE),
16029
+ 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.`,
16030
+ 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."
16031
+ };
16032
+ });
16033
+ }
15984
16034
  function suppressHostMismatchHalves(all) {
15985
16035
  const observedHalf = /* @__PURE__ */ new Set();
15986
16036
  const declaredHalf = /* @__PURE__ */ new Set();
@@ -16017,7 +16067,8 @@ function computeDivergences(graph, opts = {}) {
16017
16067
  }
16018
16068
  });
16019
16069
  const reconciled = suppressHostMismatchHalves(all);
16020
- let filtered = reconciled;
16070
+ const dampened = dampenDeadCodeProbes(graph, buckets2, reconciled);
16071
+ let filtered = dampened;
16021
16072
  if (opts.type) {
16022
16073
  const allowed = opts.type;
16023
16074
  filtered = filtered.filter((d) => allowed.has(d.type));