Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
fix(fingerprints): reanalyze changed unresolved receiver identities
Lum1104cb08cf155846
diff --git a/tests/skill/understand/test_prepare_incremental.test.mjs b/tests/skill/understand/test_prepare_incremental.test.mjsindex 5632e88a..03432d9e 100644--- a/tests/skill/understand/test_prepare_incremental.test.mjs+++ b/tests/skill/understand/test_prepare_incremental.test.mjs@@ -232,6 +232,25 @@ afterEach(async () => {});describe('incremental symbol publication gate', { timeout: 30_000 }, () => {+ it('reanalyzes changed Rust trait identities and blocks publication with unresolved receivers', () => {+ const path = 'src/method.rs';+ const f = symbolFixture(2, { [path]: 'impl TraitA for A { fn run(&self) {} }\n' });+ const previous = JSON.parse(f.persisted()[0]);+ const method = { ...f.methodNodes[0], id: `function:${path}:run`, name: 'run', filePath: path, lineRange: [1, 1] };+ previous.nodes.push(method);+ writeFileSync(join(f.dataDir, 'knowledge-graph.json'), JSON.stringify(previous));+ writeProjectFile(f.root, path, 'impl TraitB for B { fn run(&self) {} }\n');+ commit(f.root, 'change trait and receiver');+ const before = f.persisted();+ const { plan } = prepare(f.root, f.baseCommit);+ expect(plan.filesToReanalyze).toContain(path);+ f.write('batch-1.json', { nodes: [previous.nodes.find(node => node.id === `file:${path}`), method], edges: [] });+ expect(spawnSync(python, [mergeScript, f.root]).status).toBe(1);+ expect(f.read('incremental-symbol-report.json').files.find(file => file.filePath === path).missing[0].status).toBe('unknown');+ expect(spawnSync(process.execPath, [finalizeScript, f.root]).status).toBe(1);+ expect(f.persisted()).toEqual(before);+ });+it('does not publish a missing method whose computed source name still denotes the old symbol', () => {const f = symbolFixture(2);const source = 'export class Service { ["method" + "0"]() { return 1; } method1() {} }\n';diff --git a/understand-anything-plugin/packages/core/src/__tests__/fingerprint.test.ts b/understand-anything-plugin/packages/core/src/__tests__/fingerprint.test.tsindex a3254b8c..ea35b18d 100644--- a/understand-anything-plugin/packages/core/src/__tests__/fingerprint.test.ts+++ b/understand-anything-plugin/packages/core/src/__tests__/fingerprint.test.ts@@ -67,6 +67,20 @@ describe("contentHash", () => {});describe("extractFileFingerprint", () => {+ it("never classifies changed unresolved receivers as cosmetic", () => {+ const fingerprint = (content: string) => extractFileFingerprint("a.rs", content, {+ functions: [{ name: "run", owner: null, lineRange: [1, 1], params: ["self"] }],+ classes: [], imports: [], exports: [],+ });+ const before = fingerprint("impl TraitA for A { fn run(&self) {} }");+ const after = fingerprint("impl TraitB for B { fn run(&self) {} }");+ expect(compareFingerprints(before, before).changeLevel).toBe("NONE");+ expect(compareFingerprints(before, after).changeLevel).toBe("STRUCTURAL");+ const resolved = { ...after, functions: after.functions.map(fn => ({ ...fn, owner: "B" })) };+ expect(compareFingerprints(before, resolved).changeLevel).toBe("STRUCTURAL");+ expect(compareFingerprints(resolved, before).changeLevel).toBe("STRUCTURAL");+ });+it("classifies receiver changes as structural without a local class declaration", () => {const fingerprint = (owner: string | undefined, content: string) => extractFileFingerprint("a.go", content, {functions: [{ name: "Run", owner, lineRange: [2, 2], params: [] }],diff --git a/understand-anything-plugin/packages/core/src/fingerprint.ts b/understand-anything-plugin/packages/core/src/fingerprint.tsindex 2f4fe298..66d904d5 100644--- a/understand-anything-plugin/packages/core/src/fingerprint.ts+++ b/understand-anything-plugin/packages/core/src/fingerprint.ts@@ -160,6 +160,16 @@ export function compareFingerprints(};}+ // A null receiver is incomplete evidence, not a stable identity. Any content+ // change must reach the source validator even if other signatures match.+ if ([...oldFp.functions, ...newFp.functions].some(fn => fn.owner === null)) {+ return {+ filePath: newFp.filePath,+ changeLevel: "STRUCTURAL",+ details: ["unresolved function ownership — conservative classification"],+ };+ }+// Compare function signatures// Receiver changes matter even when the type is declared in another file.// Also conservatively reanalyze changed files with older ownerless evidence.