gitnexus 1.6.2 → 1.6.3-rc.10
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/_shared/index.d.ts +45 -0
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +33 -0
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/def-index.d.ts +36 -0
- package/dist/_shared/scope-resolution/def-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/def-index.js +51 -0
- package/dist/_shared/scope-resolution/def-index.js.map +1 -0
- package/dist/_shared/scope-resolution/evidence-weights.d.ts +69 -0
- package/dist/_shared/scope-resolution/evidence-weights.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/evidence-weights.js +84 -0
- package/dist/_shared/scope-resolution/evidence-weights.js.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts +139 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js +479 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts +26 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/language-classification.js +44 -0
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +80 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js +79 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +46 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.js +58 -0
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -0
- package/dist/_shared/scope-resolution/origin-priority.d.ts +14 -0
- package/dist/_shared/scope-resolution/origin-priority.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/origin-priority.js +21 -0
- package/dist/_shared/scope-resolution/origin-priority.js.map +1 -0
- package/dist/_shared/scope-resolution/position-index.d.ts +62 -0
- package/dist/_shared/scope-resolution/position-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/position-index.js +134 -0
- package/dist/_shared/scope-resolution/position-index.js.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts +44 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js +75 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts +27 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js +30 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts +69 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.js +44 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +56 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.js +150 -0
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts +26 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js +31 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts +81 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js +332 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts +33 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js +56 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts +36 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts +43 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js +60 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts +53 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js +126 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts +43 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.js +46 -0
- package/dist/_shared/scope-resolution/scope-id.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts +61 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.js +186 -0
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +63 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js +122 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +59 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.js +79 -0
- package/dist/_shared/scope-resolution/shadow/diff.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +34 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.js +12 -0
- package/dist/_shared/scope-resolution/symbol-definition.js.map +1 -0
- package/dist/_shared/scope-resolution/types.d.ts +356 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/types.js +17 -0
- package/dist/_shared/scope-resolution/types.js.map +1 -0
- package/dist/core/ingestion/call-processor.d.ts +2 -1
- package/dist/core/ingestion/language-provider.d.ts +172 -1
- package/dist/core/ingestion/model/field-registry.d.ts +1 -1
- package/dist/core/ingestion/model/index.d.ts +1 -1
- package/dist/core/ingestion/model/index.js +2 -0
- package/dist/core/ingestion/model/method-registry.d.ts +1 -1
- package/dist/core/ingestion/model/registration-table.d.ts +1 -2
- package/dist/core/ingestion/model/resolution-context.d.ts +1 -1
- package/dist/core/ingestion/model/resolve.d.ts +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +1 -23
- package/dist/core/ingestion/model/type-registry.d.ts +1 -1
- package/dist/core/search/phase-timer.d.ts +72 -0
- package/dist/core/search/phase-timer.js +106 -0
- package/dist/mcp/local/local-backend.d.ts +48 -1
- package/dist/mcp/local/local-backend.js +345 -135
- package/dist/mcp/tools.js +19 -1
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
* Related types — `ShadowAgreement`, `ShadowCallsite`, `ShadowDiff` — are
|
|
9
|
+
* defined alongside `diffResolutions` in `./diff.ts` and re-exported
|
|
10
|
+
* through the top-level `gitnexus-shared` barrel. Consumers import all
|
|
11
|
+
* three from `gitnexus-shared`, not from this module.
|
|
12
|
+
*
|
|
13
|
+
* Part of RFC #909 Ring 2 SHARED — #918.
|
|
14
|
+
*/
|
|
15
|
+
// ─── Public API ─────────────────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* Aggregate a stream of `ShadowDiff` records into a `ShadowParityReport`,
|
|
18
|
+
* bucketed by language. Pure function.
|
|
19
|
+
*
|
|
20
|
+
* - `perLanguage` rows are sorted alphabetically by `SupportedLanguages`
|
|
21
|
+
* value for stable JSON output (the dashboard reads
|
|
22
|
+
* `.gitnexus/shadow-parity/latest.json` and diffing snapshots is useful).
|
|
23
|
+
* - `overall` is the column-wise sum across languages.
|
|
24
|
+
* - `generatedAt` is injected via the `now` parameter so tests stay
|
|
25
|
+
* deterministic; production callers let it default to `new Date()`.
|
|
26
|
+
*/
|
|
27
|
+
export function aggregateDiffs(diffs, now = new Date()) {
|
|
28
|
+
const perLanguageMap = new Map();
|
|
29
|
+
for (const { language, diff } of diffs) {
|
|
30
|
+
let counts = perLanguageMap.get(language);
|
|
31
|
+
if (!counts) {
|
|
32
|
+
counts = makeEmptyCounts();
|
|
33
|
+
perLanguageMap.set(language, counts);
|
|
34
|
+
}
|
|
35
|
+
tallyDiff(counts, diff);
|
|
36
|
+
}
|
|
37
|
+
const perLanguage = Array.from(perLanguageMap.entries())
|
|
38
|
+
.map(([language, counts]) => buildRow(language, counts))
|
|
39
|
+
.sort((a, b) => a.language.localeCompare(b.language));
|
|
40
|
+
const overall = buildOverallRow(perLanguage);
|
|
41
|
+
return {
|
|
42
|
+
generatedAt: now.toISOString(),
|
|
43
|
+
perLanguage,
|
|
44
|
+
overall,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function makeEmptyCounts() {
|
|
48
|
+
return {
|
|
49
|
+
totalCalls: 0,
|
|
50
|
+
bothAgree: 0,
|
|
51
|
+
onlyLegacy: 0,
|
|
52
|
+
onlyNew: 0,
|
|
53
|
+
bothDisagree: 0,
|
|
54
|
+
bothEmpty: 0,
|
|
55
|
+
evidenceBreakdown: new Map(),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function tallyDiff(counts, diff) {
|
|
59
|
+
counts.totalCalls += 1;
|
|
60
|
+
incrementAgreement(counts, diff.agreement);
|
|
61
|
+
if (diff.agreement === 'both-agree' || diff.agreement === 'both-empty')
|
|
62
|
+
return;
|
|
63
|
+
for (const ev of diff.evidenceDelta) {
|
|
64
|
+
counts.evidenceBreakdown.set(ev.kind, (counts.evidenceBreakdown.get(ev.kind) ?? 0) + 1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function incrementAgreement(counts, agreement) {
|
|
68
|
+
switch (agreement) {
|
|
69
|
+
case 'both-agree':
|
|
70
|
+
counts.bothAgree += 1;
|
|
71
|
+
return;
|
|
72
|
+
case 'only-legacy':
|
|
73
|
+
counts.onlyLegacy += 1;
|
|
74
|
+
return;
|
|
75
|
+
case 'only-new':
|
|
76
|
+
counts.onlyNew += 1;
|
|
77
|
+
return;
|
|
78
|
+
case 'both-disagree':
|
|
79
|
+
counts.bothDisagree += 1;
|
|
80
|
+
return;
|
|
81
|
+
case 'both-empty':
|
|
82
|
+
counts.bothEmpty += 1;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function buildRow(language, counts) {
|
|
87
|
+
const resolved = counts.totalCalls - counts.bothEmpty;
|
|
88
|
+
const parity = resolved > 0 ? counts.bothAgree / resolved : 0;
|
|
89
|
+
return {
|
|
90
|
+
language,
|
|
91
|
+
totalCalls: counts.totalCalls,
|
|
92
|
+
bothAgree: counts.bothAgree,
|
|
93
|
+
onlyLegacy: counts.onlyLegacy,
|
|
94
|
+
onlyNew: counts.onlyNew,
|
|
95
|
+
bothDisagree: counts.bothDisagree,
|
|
96
|
+
bothEmpty: counts.bothEmpty,
|
|
97
|
+
parity,
|
|
98
|
+
// Freeze via `new Map` on a sorted-kind copy so downstream consumers
|
|
99
|
+
// can't mutate the aggregator's internal state.
|
|
100
|
+
evidenceBreakdown: new Map(Array.from(counts.evidenceBreakdown.entries()).sort(([a], [b]) => a.localeCompare(b))),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function buildOverallRow(perLanguage) {
|
|
104
|
+
let totalCalls = 0;
|
|
105
|
+
let bothAgree = 0;
|
|
106
|
+
let onlyLegacy = 0;
|
|
107
|
+
let onlyNew = 0;
|
|
108
|
+
let bothDisagree = 0;
|
|
109
|
+
let bothEmpty = 0;
|
|
110
|
+
for (const row of perLanguage) {
|
|
111
|
+
totalCalls += row.totalCalls;
|
|
112
|
+
bothAgree += row.bothAgree;
|
|
113
|
+
onlyLegacy += row.onlyLegacy;
|
|
114
|
+
onlyNew += row.onlyNew;
|
|
115
|
+
bothDisagree += row.bothDisagree;
|
|
116
|
+
bothEmpty += row.bothEmpty;
|
|
117
|
+
}
|
|
118
|
+
const resolved = totalCalls - bothEmpty;
|
|
119
|
+
const parity = resolved > 0 ? bothAgree / resolved : 0;
|
|
120
|
+
return { totalCalls, bothAgree, onlyLegacy, onlyNew, bothDisagree, bothEmpty, parity };
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=aggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../src/scope-resolution/shadow/aggregate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;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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
+
*
|
|
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,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CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,MAAM,SAAS,GAAG,SAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9E,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,SAAS,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SymbolDefinition` — the canonical shape of an indexed symbol record.
|
|
3
|
+
*
|
|
4
|
+
* Historically defined in `gitnexus/src/core/ingestion/model/symbol-table.ts`;
|
|
5
|
+
* moved into `gitnexus-shared` as part of RFC #909 Ring 1 (#910) so the
|
|
6
|
+
* scope-resolution types that reference it can live in the shared package
|
|
7
|
+
* alongside their consumers (`gitnexus/` and `gitnexus-web/`).
|
|
8
|
+
*
|
|
9
|
+
* Shape is unchanged from the prior local definition.
|
|
10
|
+
*/
|
|
11
|
+
import type { NodeLabel } from '../graph/types.js';
|
|
12
|
+
export interface SymbolDefinition {
|
|
13
|
+
nodeId: string;
|
|
14
|
+
filePath: string;
|
|
15
|
+
type: NodeLabel;
|
|
16
|
+
/** Canonical dot-separated qualified type name for class-like symbols
|
|
17
|
+
* (e.g. `App.Models.User`). Falls back to the simple symbol name when no
|
|
18
|
+
* package/namespace/module scope exists or no explicit qualified metadata is provided. */
|
|
19
|
+
qualifiedName?: string;
|
|
20
|
+
parameterCount?: number;
|
|
21
|
+
/** Number of required (non-optional, non-default) parameters.
|
|
22
|
+
* Enables range-based arity filtering: argCount >= requiredParameterCount && argCount <= parameterCount. */
|
|
23
|
+
requiredParameterCount?: number;
|
|
24
|
+
/** Per-parameter type names for overload disambiguation (e.g. ['int', 'String']).
|
|
25
|
+
* Populated when parameter types are resolvable from AST (any typed language). */
|
|
26
|
+
parameterTypes?: string[];
|
|
27
|
+
/** Raw return type text extracted from AST (e.g. 'User', 'Promise<User>') */
|
|
28
|
+
returnType?: string;
|
|
29
|
+
/** Declared type for non-callable symbols — fields/properties (e.g. 'Address', 'List<User>') */
|
|
30
|
+
declaredType?: string;
|
|
31
|
+
/** Links Method/Constructor/Property to owning Class/Struct/Trait nodeId */
|
|
32
|
+
ownerId?: string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=symbol-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-definition.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/symbol-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;+FAE2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;iHAC6G;IAC7G,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;uFACmF;IACnF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SymbolDefinition` — the canonical shape of an indexed symbol record.
|
|
3
|
+
*
|
|
4
|
+
* Historically defined in `gitnexus/src/core/ingestion/model/symbol-table.ts`;
|
|
5
|
+
* moved into `gitnexus-shared` as part of RFC #909 Ring 1 (#910) so the
|
|
6
|
+
* scope-resolution types that reference it can live in the shared package
|
|
7
|
+
* alongside their consumers (`gitnexus/` and `gitnexus-web/`).
|
|
8
|
+
*
|
|
9
|
+
* Shape is unchanged from the prior local definition.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=symbol-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-definition.js","sourceRoot":"","sources":["../../src/scope-resolution/symbol-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|