gitnexus 1.6.3-rc.3 → 1.6.3-rc.4

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.
@@ -12,4 +12,8 @@ export { ORIGIN_PRIORITY } from './scope-resolution/origin-priority.js';
12
12
  export type { OriginForTieBreak } from './scope-resolution/origin-priority.js';
13
13
  export { LanguageClassifications, isProductionLanguage, } from './scope-resolution/language-classification.js';
14
14
  export type { LanguageClassification } from './scope-resolution/language-classification.js';
15
+ export { diffResolutions } from './scope-resolution/shadow/diff.js';
16
+ export type { ShadowAgreement, ShadowCallsite, ShadowDiff, } from './scope-resolution/shadow/diff.js';
17
+ export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
18
+ export type { LanguageParityRow, ShadowParityReport } from './scope-resolution/shadow/aggregate.js';
15
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACjG,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,YAAY,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,YA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B,EAClB,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAG5F,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,YAAY,EACV,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC"}
@@ -8,4 +8,7 @@ export { EvidenceWeights, typeBindingWeightAtDepth } from './scope-resolution/ev
8
8
  export { ORIGIN_PRIORITY } from './scope-resolution/origin-priority.js';
9
9
  // Language classification (RFC §6.1 Ring 3/4 governance)
10
10
  export { LanguageClassifications, isProductionLanguage, } from './scope-resolution/language-classification.js';
11
+ // Shadow-mode diff + aggregation (RFC §6.3; Ring 2 SHARED #918)
12
+ export { diffResolutions } from './scope-resolution/shadow/diff.js';
13
+ export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
11
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,mBAAmB;AACnB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAiCjG,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,yDAAyD;AACzD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,mBAAmB;AACnB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAiCjG,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,yDAAyD;AACzD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AAGvD,gEAAgE;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shadow-mode aggregation — per-language parity %, per-evidence-kind
3
+ * breakdown of divergences. Consumed by the parity dashboard (RING2-PKG-5).
4
+ *
5
+ * Pure functions; no I/O. The harness persists per-run JSON; the dashboard
6
+ * reads `.gitnexus/shadow-parity/latest.json` and renders.
7
+ *
8
+ * Part of RFC #909 Ring 2 SHARED — #918.
9
+ */
10
+ import type { SupportedLanguages } from '../../languages.js';
11
+ import type { ResolutionEvidence } from '../types.js';
12
+ import type { ShadowAgreement, ShadowDiff } from './diff.js';
13
+ export interface LanguageParityRow {
14
+ readonly language: SupportedLanguages;
15
+ readonly totalCalls: number;
16
+ readonly bothAgree: number;
17
+ readonly onlyLegacy: number;
18
+ readonly onlyNew: number;
19
+ readonly bothDisagree: number;
20
+ readonly bothEmpty: number;
21
+ /**
22
+ * Fraction in [0, 1]. Numerator = `bothAgree`; denominator = "calls where
23
+ * at least one side resolved" = `totalCalls - bothEmpty`.
24
+ *
25
+ * When the denominator is 0 (all calls for this language were
26
+ * `both-empty`), returns 0. Callers rendering the dashboard should treat
27
+ * a 0 parity alongside `totalCalls === bothEmpty` as "no signal" rather
28
+ * than "total disagreement".
29
+ */
30
+ readonly parity: number;
31
+ /**
32
+ * Divergence signals broken down by `ResolutionEvidence.kind`. Sourced
33
+ * from `ShadowDiff.evidenceDelta` on non-agreeing rows only — `both-agree`
34
+ * and `both-empty` do not contribute.
35
+ */
36
+ readonly evidenceBreakdown: ReadonlyMap<ResolutionEvidence['kind'], number>;
37
+ }
38
+ export interface ShadowParityReport {
39
+ readonly generatedAt: string;
40
+ readonly perLanguage: readonly LanguageParityRow[];
41
+ readonly overall: Omit<LanguageParityRow, 'language' | 'evidenceBreakdown'>;
42
+ }
43
+ /**
44
+ * Aggregate a stream of `ShadowDiff` records into a `ShadowParityReport`,
45
+ * bucketed by language. Pure function.
46
+ *
47
+ * - `perLanguage` rows are sorted alphabetically by `SupportedLanguages`
48
+ * value for stable JSON output (the dashboard reads
49
+ * `.gitnexus/shadow-parity/latest.json` and diffing snapshots is useful).
50
+ * - `overall` is the column-wise sum across languages.
51
+ * - `generatedAt` is injected via the `now` parameter so tests stay
52
+ * deterministic; production callers let it default to `new Date()`.
53
+ */
54
+ export declare function aggregateDiffs(diffs: readonly {
55
+ readonly language: SupportedLanguages;
56
+ readonly diff: ShadowDiff;
57
+ }[], now?: Date): ShadowParityReport;
58
+ export type { Shadow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AC,IAAI,EAAE,UAAU,CAAA;CAAE,EAAE,EACtF,GAAG,GAAE,IAAiB,GACrB,kBAAkB,CAuBpB;AAiGD,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Shadow-mode aggregation — per-language parity %, per-evidence-kind
3
+ * breakdown of divergences. Consumed by the parity dashboard (RING2-PKG-5).
4
+ *
5
+ * Pure functions; no I/O. The harness persists per-run JSON; the dashboard
6
+ * reads `.gitnexus/shadow-parity/latest.json` and renders.
7
+ *
8
+ * Part of RFC #909 Ring 2 SHARED — #918.
9
+ */
10
+ // ─── Public API ─────────────────────────────────────────────────────────────
11
+ /**
12
+ * Aggregate a stream of `ShadowDiff` records into a `ShadowParityReport`,
13
+ * bucketed by language. Pure function.
14
+ *
15
+ * - `perLanguage` rows are sorted alphabetically by `SupportedLanguages`
16
+ * value for stable JSON output (the dashboard reads
17
+ * `.gitnexus/shadow-parity/latest.json` and diffing snapshots is useful).
18
+ * - `overall` is the column-wise sum across languages.
19
+ * - `generatedAt` is injected via the `now` parameter so tests stay
20
+ * deterministic; production callers let it default to `new Date()`.
21
+ */
22
+ export function aggregateDiffs(diffs, now = new Date()) {
23
+ const perLanguageMap = new Map();
24
+ for (const { language, diff } of diffs) {
25
+ let counts = perLanguageMap.get(language);
26
+ if (!counts) {
27
+ counts = makeEmptyCounts();
28
+ perLanguageMap.set(language, counts);
29
+ }
30
+ tallyDiff(counts, diff);
31
+ }
32
+ const perLanguage = Array.from(perLanguageMap.entries())
33
+ .map(([language, counts]) => buildRow(language, counts))
34
+ .sort((a, b) => a.language.localeCompare(b.language));
35
+ const overall = buildOverallRow(perLanguage);
36
+ return {
37
+ generatedAt: now.toISOString(),
38
+ perLanguage,
39
+ overall,
40
+ };
41
+ }
42
+ function makeEmptyCounts() {
43
+ return {
44
+ totalCalls: 0,
45
+ bothAgree: 0,
46
+ onlyLegacy: 0,
47
+ onlyNew: 0,
48
+ bothDisagree: 0,
49
+ bothEmpty: 0,
50
+ evidenceBreakdown: new Map(),
51
+ };
52
+ }
53
+ function tallyDiff(counts, diff) {
54
+ counts.totalCalls += 1;
55
+ incrementAgreement(counts, diff.agreement);
56
+ if (diff.agreement === 'both-agree' || diff.agreement === 'both-empty')
57
+ return;
58
+ for (const ev of diff.evidenceDelta) {
59
+ counts.evidenceBreakdown.set(ev.kind, (counts.evidenceBreakdown.get(ev.kind) ?? 0) + 1);
60
+ }
61
+ }
62
+ function incrementAgreement(counts, agreement) {
63
+ switch (agreement) {
64
+ case 'both-agree':
65
+ counts.bothAgree += 1;
66
+ return;
67
+ case 'only-legacy':
68
+ counts.onlyLegacy += 1;
69
+ return;
70
+ case 'only-new':
71
+ counts.onlyNew += 1;
72
+ return;
73
+ case 'both-disagree':
74
+ counts.bothDisagree += 1;
75
+ return;
76
+ case 'both-empty':
77
+ counts.bothEmpty += 1;
78
+ return;
79
+ }
80
+ }
81
+ function buildRow(language, counts) {
82
+ const resolved = counts.totalCalls - counts.bothEmpty;
83
+ const parity = resolved > 0 ? counts.bothAgree / resolved : 0;
84
+ return {
85
+ language,
86
+ totalCalls: counts.totalCalls,
87
+ bothAgree: counts.bothAgree,
88
+ onlyLegacy: counts.onlyLegacy,
89
+ onlyNew: counts.onlyNew,
90
+ bothDisagree: counts.bothDisagree,
91
+ bothEmpty: counts.bothEmpty,
92
+ parity,
93
+ // Freeze via `new Map` on a sorted-kind copy so downstream consumers
94
+ // can't mutate the aggregator's internal state.
95
+ evidenceBreakdown: new Map(Array.from(counts.evidenceBreakdown.entries()).sort(([a], [b]) => a.localeCompare(b))),
96
+ };
97
+ }
98
+ function buildOverallRow(perLanguage) {
99
+ let totalCalls = 0;
100
+ let bothAgree = 0;
101
+ let onlyLegacy = 0;
102
+ let onlyNew = 0;
103
+ let bothDisagree = 0;
104
+ let bothEmpty = 0;
105
+ for (const row of perLanguage) {
106
+ totalCalls += row.totalCalls;
107
+ bothAgree += row.bothAgree;
108
+ onlyLegacy += row.onlyLegacy;
109
+ onlyNew += row.onlyNew;
110
+ bothDisagree += row.bothDisagree;
111
+ bothEmpty += row.bothEmpty;
112
+ }
113
+ const resolved = totalCalls - bothEmpty;
114
+ const parity = resolved > 0 ? bothAgree / resolved : 0;
115
+ return { totalCalls, bothAgree, onlyLegacy, onlyNew, bothDisagree, bothEmpty, parity };
116
+ }
117
+ //# sourceMappingURL=aggregate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../src/scope-resolution/shadow/aggregate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwCH,+EAA+E;AAE/E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAsF,EACtF,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAqC,CAAC;IAEpE,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC;QACvC,IAAI,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,eAAe,EAAE,CAAC;YAC3B,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,WAAW,GAAwB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC1E,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SACvD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAExD,MAAM,OAA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AAS,IAAI,GAAG,CAAC,SAAS,CAAC;QAC3B,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC;QAC7B,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC;QACvB,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC;QACjC,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC;IAC7B,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACxC,MAAM,MAAM,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACzF,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shadow-mode diff logic — RFC §6.3.
3
+ *
4
+ * Pure comparison logic for shadow mode. Takes two `Resolution[]` (legacy
5
+ * DAG result + new scope-based registry result) and produces a structured
6
+ * diff record for the parity dashboard.
7
+ *
8
+ * Consumed by the Ring 2 PKG shadow harness (#923), which dual-runs each
9
+ * call through legacy + new paths, diffs results, and persists per-run JSON
10
+ * for the parity dashboard.
11
+ *
12
+ * Part of RFC #909 Ring 2 SHARED — #918.
13
+ */
14
+ import type { Resolution, ResolutionEvidence } from '../types.js';
15
+ export type ShadowAgreement = 'both-agree' | 'only-legacy' | 'only-new' | 'both-disagree' | 'both-empty';
16
+ export interface ShadowDiff {
17
+ readonly callsite: ShadowCallsite;
18
+ readonly legacy: Resolution | null;
19
+ readonly newResult: Resolution | null;
20
+ readonly agreement: ShadowAgreement;
21
+ /**
22
+ * Symmetric difference of the two top resolutions' `evidence` arrays,
23
+ * keyed on `ResolutionEvidence.kind`.
24
+ *
25
+ * - For `'both-agree'` and `'both-empty'` agreements, always empty.
26
+ * - For `'both-disagree'`, contains evidence kinds present on exactly one
27
+ * side (not in both).
28
+ * - For `'only-legacy'`, contains all of legacy's top evidence.
29
+ * - For `'only-new'`, contains all of new's top evidence.
30
+ */
31
+ readonly evidenceDelta: readonly ResolutionEvidence[];
32
+ }
33
+ export interface ShadowCallsite {
34
+ readonly filePath: string;
35
+ readonly line: number;
36
+ readonly col: number;
37
+ readonly calledName: string;
38
+ }
39
+ /**
40
+ * Compare two `Resolution[]` arrays (top matches at `[0]`) and produce a
41
+ * `ShadowDiff`. Pure function.
42
+ *
43
+ * Agreement rules:
44
+ * - both arrays empty → `'both-empty'`, `evidenceDelta: []`
45
+ * - legacy empty, new non-empty → `'only-new'`, `evidenceDelta` = new's top evidence
46
+ * - legacy non-empty, new empty → `'only-legacy'`, `evidenceDelta` = legacy's top evidence
47
+ * - both non-empty, same top `def.nodeId` → `'both-agree'`, `evidenceDelta: []`
48
+ * - both non-empty, different top `def.nodeId` → `'both-disagree'`,
49
+ * `evidenceDelta` = symmetric difference by `ResolutionEvidence.kind`
50
+ * (first occurrence of a kind-only-on-legacy then kind-only-on-new; order
51
+ * preserved from input arrays)
52
+ *
53
+ * Evidence-delta rationale: callers aggregating divergences want to know
54
+ * which signal kinds explain a disagreement. Keying on `kind` (not full
55
+ * equality over `weight`/`note`) avoids spurious deltas when the same
56
+ * signal fires with slightly different calibration weights on each side.
57
+ */
58
+ export declare function diffResolutions(callsite: ShadowCallsite, legacy: readonly Resolution[], newResult: readonly Resolution[]): ShadowDiff;
59
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/shadow/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIlE,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,aAAa,GACb,UAAU,GACV,eAAe,GACf,YAAY,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,SAAS,EAAE,SAAS,UAAU,EAAE,GAC/B,UAAU,CAoBZ"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Shadow-mode diff logic — RFC §6.3.
3
+ *
4
+ * Pure comparison logic for shadow mode. Takes two `Resolution[]` (legacy
5
+ * DAG result + new scope-based registry result) and produces a structured
6
+ * diff record for the parity dashboard.
7
+ *
8
+ * Consumed by the Ring 2 PKG shadow harness (#923), which dual-runs each
9
+ * call through legacy + new paths, diffs results, and persists per-run JSON
10
+ * for the parity dashboard.
11
+ *
12
+ * Part of RFC #909 Ring 2 SHARED — #918.
13
+ */
14
+ // ─── Public API ─────────────────────────────────────────────────────────────
15
+ /**
16
+ * Compare two `Resolution[]` arrays (top matches at `[0]`) and produce a
17
+ * `ShadowDiff`. Pure function.
18
+ *
19
+ * Agreement rules:
20
+ * - both arrays empty → `'both-empty'`, `evidenceDelta: []`
21
+ * - legacy empty, new non-empty → `'only-new'`, `evidenceDelta` = new's top evidence
22
+ * - legacy non-empty, new empty → `'only-legacy'`, `evidenceDelta` = legacy's top evidence
23
+ * - both non-empty, same top `def.nodeId` → `'both-agree'`, `evidenceDelta: []`
24
+ * - both non-empty, different top `def.nodeId` → `'both-disagree'`,
25
+ * `evidenceDelta` = symmetric difference by `ResolutionEvidence.kind`
26
+ * (first occurrence of a kind-only-on-legacy then kind-only-on-new; order
27
+ * preserved from input arrays)
28
+ *
29
+ * Evidence-delta rationale: callers aggregating divergences want to know
30
+ * which signal kinds explain a disagreement. Keying on `kind` (not full
31
+ * equality over `weight`/`note`) avoids spurious deltas when the same
32
+ * signal fires with slightly different calibration weights on each side.
33
+ */
34
+ export function diffResolutions(callsite, legacy, newResult) {
35
+ const legacyTop = legacy.length > 0 ? legacy[0] : null;
36
+ const newTop = newResult.length > 0 ? newResult[0] : null;
37
+ const agreement = (() => {
38
+ if (legacyTop === null && newTop === null)
39
+ return 'both-empty';
40
+ if (legacyTop === null)
41
+ return 'only-new';
42
+ if (newTop === null)
43
+ return 'only-legacy';
44
+ return legacyTop.def.nodeId === newTop.def.nodeId ? 'both-agree' : 'both-disagree';
45
+ })();
46
+ const evidenceDelta = computeEvidenceDelta(legacyTop, newTop, agreement);
47
+ return {
48
+ callsite,
49
+ legacy: legacyTop,
50
+ newResult: newTop,
51
+ agreement,
52
+ evidenceDelta,
53
+ };
54
+ }
55
+ // ─── Internal helpers ───────────────────────────────────────────────────────
56
+ /**
57
+ * Symmetric difference of two evidence arrays, keyed on
58
+ * `ResolutionEvidence.kind`. Preserves input order: legacy-only signals
59
+ * first (in legacy's original order), then new-only signals (in new's order).
60
+ *
61
+ * For `'both-agree'` / `'both-empty'` the delta is empty by contract. For
62
+ * `'only-legacy'` / `'only-new'` one side's evidence is the delta (nothing to
63
+ * subtract against).
64
+ */
65
+ function computeEvidenceDelta(legacy, newResult, agreement) {
66
+ if (agreement === 'both-agree' || agreement === 'both-empty')
67
+ return [];
68
+ if (agreement === 'only-legacy')
69
+ return legacy.evidence;
70
+ if (agreement === 'only-new')
71
+ return newResult.evidence;
72
+ // both-disagree: symmetric difference keyed on `kind`
73
+ const legacyKinds = new Set(legacy.evidence.map((e) => e.kind));
74
+ const newKinds = new Set(newResult.evidence.map((e) => e.kind));
75
+ const onlyInLegacy = legacy.evidence.filter((e) => !newKinds.has(e.kind));
76
+ const onlyInNew = newResult.evidence.filter((e) => !legacyKinds.has(e.kind));
77
+ return [...onlyInLegacy, ...onlyInNew];
78
+ }
79
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/scope-resolution/shadow/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsCH,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAwB,EACxB,MAA6B,EAC7B,SAAgC;IAEhC,MAAM,SAAS,GAAsB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1E,MAAM,MAAM,GAAsB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7E,MAAM,SAAS,GAAoB,CAAC,GAAG,EAAE;QACvC,IAAI,SAAS,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,YAAY,CAAC;QAC/D,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,UAAU,CAAC;QAC1C,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,aAAa,CAAC;QAC1C,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC;IACrF,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,aAAa,GAAG,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC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.6.3-rc.4",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",