mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-06 02:49:56 +00:00
* fix(resolution): distinguish name guesses and preserve export visibility * test(go): keep method enrichment fixture in one package * fix(resolution): address split review edge cases and evidence reporting * fix(exports): recognize imported and expression-local receivers * fix(resolution): align export and target evidence with language scope * fix(ingestion): preserve lexical import provenance through resolution * test(ci): rebalance Windows shards from measured slow suites * Address PR review feedback (#3190) - Label constructor unique-name guesses as global-name-fallback and run language vetoes - Tighten Go qualified, Rust crate::, and Ruby class-reopen fallback guards - Ignore for-loop shadowed CommonJS receivers and exclude guesses from the resolved-call census - Refresh FinalizeOutput and hook docs for lexical binding scopes Co-authored-by: Cursor <cursoragent@cursor.com> * Tighten review-feedback leftovers on fallback visibility. Qualified Go calls still respect export and test-package rules, nested Rust src/ stays a module segment, and top-level conditional this.x is treated as CommonJS. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(autofix): apply prettier + eslint fixes via /autofix command * Address PR review feedback (#3190) - Distinguish Swift package prefixes when comparing target modules - Document lexical import binding and handledSites refusal marking - Drop the stale ci-scope-parity workflow claim and prototype-safe export verdicts Co-authored-by: Cursor <cursoragent@cursor.com> * Address PR review feedback (#3190) Supply caller source on Ruby visibility cases so they exercise the named allow branches instead of the missing-text bypass. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(resolution): label unique constructor types as name guesses A workspace-unique class hit in findClassBindingInScope was treated as an in-scope bind, so Go/JS constructor-form sites skipped the guess label and the Go unexported veto. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(resolution): keep qualified constructors precise after unique-name split Bare constructor unique-name hits stay guesses so Go can veto an unexported type. A written qualifier is now carried as rawQualifiedName so `new pkg.Foo()` and `models.Box[T]{}` can still recover the unique class without that veto. Co-authored-by: Cursor <cursoragent@cursor.com> * test(bench): rebaseline Go/Java scope-capture fingerprints for constructor qualifiers Generic Go composite literals and qualified Java `new pkg.Foo()` now carry @reference.qualified-name on existing constructor matches. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(resolution): treat import-reached unique constructors as precise C++ #include and Rust re-exports do not mint a lexical class binding. A unique type in an imported file (or imported directory) is therefore a real bind, not a name guess, so those CALLS edges stay import-resolved. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(resolution): require named or resolved imports for constructor precision Bare Go Box[T]{} is not package-qualified, and a sibling-file import of a different name is not constructor visibility. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
/**
|
|
* Review finding on #3182 (name-fallback-summary.ts:104): the census
|
|
* denominator `callsByLanguage` was never supplied in production. The pipeline
|
|
* now builds `resolvedCalleeNamesByCaller` (caller node → callee simple names)
|
|
* through the edge source that is complete under streaming, and `run-analyze`
|
|
* feeds it to `countCallsByLanguage`.
|
|
*/
|
|
import { describe, it, expect } from 'vitest';
|
|
import { createKnowledgeGraph } from '../../../src/core/graph/graph.js';
|
|
import { collectResolvedCalleeNames } from '../../../src/core/ingestion/pipeline.js';
|
|
import { countCallsByLanguage } from '../../../src/core/ingestion/scope-resolution/name-fallback-summary.js';
|
|
import { GLOBAL_NAME_FALLBACK_REASON } from '../../../src/core/graph/edge-reasons.js';
|
|
import type { NodeLabel } from 'gitnexus-shared';
|
|
|
|
describe('collectResolvedCalleeNames', () => {
|
|
it('groups CALLS targets by caller and ignores other edge types and nameless targets', () => {
|
|
const g = createKnowledgeGraph();
|
|
const fn = (id: string, name: string, filePath: string) =>
|
|
g.addNode({ id, label: 'Function' as NodeLabel, properties: { name, filePath } });
|
|
fn('a', 'a', 'src/a.go');
|
|
fn('b', 'b', 'src/b.go');
|
|
fn('c', 'c', 'src/c.ts');
|
|
fn('d', 'd', 'src/d.go');
|
|
g.addNode({ id: 'file', label: 'File' as NodeLabel, properties: { filePath: 'src/a.go' } });
|
|
g.addRelationship({
|
|
id: 'r1',
|
|
sourceId: 'a',
|
|
targetId: 'b',
|
|
type: 'CALLS',
|
|
confidence: 0.85,
|
|
reason: '',
|
|
});
|
|
g.addRelationship({
|
|
id: 'r2',
|
|
sourceId: 'a',
|
|
targetId: 'c',
|
|
type: 'CALLS',
|
|
confidence: 0.5,
|
|
reason: '',
|
|
});
|
|
g.addRelationship({
|
|
id: 'r3',
|
|
sourceId: 'c',
|
|
targetId: 'b',
|
|
type: 'CALLS',
|
|
confidence: 0.85,
|
|
reason: '',
|
|
});
|
|
g.addRelationship({
|
|
id: 'r4',
|
|
sourceId: 'file',
|
|
targetId: 'a',
|
|
type: 'DEFINES',
|
|
confidence: 1,
|
|
reason: '',
|
|
});
|
|
g.addRelationship({
|
|
id: 'r5',
|
|
sourceId: 'a',
|
|
targetId: 'file',
|
|
type: 'CALLS',
|
|
confidence: 1,
|
|
reason: '',
|
|
});
|
|
g.addRelationship({
|
|
id: 'r6',
|
|
sourceId: 'a',
|
|
targetId: 'd',
|
|
type: 'CALLS',
|
|
confidence: 0.5,
|
|
reason: GLOBAL_NAME_FALLBACK_REASON,
|
|
});
|
|
|
|
const index = collectResolvedCalleeNames(g, g);
|
|
expect([...index.keys()].sort()).toEqual(['a', 'c']);
|
|
expect([...index.get('a')!].sort()).toEqual(['b', 'c']);
|
|
expect([...index.get('c')!]).toEqual(['b']);
|
|
|
|
// ...and it is the shape the census denominator consumes.
|
|
expect(countCallsByLanguage(index, g)).toEqual({ go: 2, typescript: 1 });
|
|
});
|
|
});
|