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(incremental): replace static accessor leaves with exact installed names
Lum1104c130fe054de7
diff --git a/tests/skill/understand/test_incremental_symbols.test.mjs b/tests/skill/understand/test_incremental_symbols.test.mjsindex 51d32d75..c3d45810 100644--- a/tests/skill/understand/test_incremental_symbols.test.mjs+++ b/tests/skill/understand/test_incremental_symbols.test.mjs@@ -19,7 +19,7 @@ const compare = (oldNodes, newNodes, oldSource, newSource) => compareFileSymbolsdescribe('incremental symbol matching', () => {it.each(['attr :name', 'attr "name"', 'attr :"name"', 'attr :name, true', 'attr_reader :name',- 'attr_writer :name', 'attr_accessor :name', 'obj.attr'])('allows unrelated Ruby deletion beside %s', accessor => {+ 'attr_writer :name', 'attr_accessor :name', 'obj.attr', 'attr_writer "run"', 'attr_writer :"run"'])('allows unrelated Ruby deletion beside %s', accessor => {const before = parser.analyzeFileStrict('a.rb', 'class A\n def run; end\nend');const after = parser.analyzeFileStrict('a.rb', `class A\n def keep; end\n ${accessor}\nend`);expect(after.hasUnresolvedNames).toBe(false);@@ -28,6 +28,7 @@ describe('incremental symbol matching', () => {it.each([['run', 'attr :run'], ['run=', 'attr :run, true'], ['run=', 'attr_writer :run'],+ ['run=', 'attr_writer "run"'], ['run=', 'attr_writer :"run"'],['run', 'attr_accessor :run'], ['run=', 'attr_accessor :run'], ['run', 'attr_reader :run'],])('does not confirm deletion of Ruby %s still installed by %s', (name, accessor) => {const before = parser.analyzeFileStrict('a.rb', `class A\n def ${name}${name.endsWith('=') ? '(value)' : ''}; end\nend`);diff --git a/tests/skill/understand/test_prepare_incremental.test.mjs b/tests/skill/understand/test_prepare_incremental.test.mjsindex ebfe1193..9d1063fe 100644--- a/tests/skill/understand/test_prepare_incremental.test.mjs+++ b/tests/skill/understand/test_prepare_incremental.test.mjs@@ -232,14 +232,14 @@ afterEach(async () => {});describe('incremental symbol publication gate', { timeout: 30_000 }, () => {- it('publishes genuine Ruby method deletion beside a static attr and an ordinary attr call', () => {+ it.each(['attr :name', 'attr_writer "run"', 'attr_writer :"run"'])('publishes genuine Ruby reader deletion beside %s and an ordinary attr call', accessor => {const path = 'src/accessor.rb';- const f = symbolFixture(2, { [path]: 'class A\n def run; end\n attr :name\nend\nobj.attr\n' });+ const f = symbolFixture(2, { [path]: `class A\n def run; end\n ${accessor}\nend\nobj.attr\n` });const previous = JSON.parse(f.persisted()[0]);const method = { ...f.methodNodes[0], id: `function:${path}:A.run`, name: 'A.run', filePath: path };previous.nodes.push(method);writeFileSync(join(f.dataDir, 'knowledge-graph.json'), JSON.stringify(previous));- writeProjectFile(f.root, path, 'class A\n def keep; end\n attr :name\nend\nobj.attr\n');+ writeProjectFile(f.root, path, `class A\n def keep; end\n ${accessor}\nend\nobj.attr\n`);const head = commit(f.root, 'delete method beside static accessor');prepare(f.root, f.baseCommit);f.write('batch-1.json', { nodes: [previous.nodes.find(node => node.id === `file:${path}`)], edges: [] });diff --git a/understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.ts b/understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.tsindex 97e4c704..94f3a0c5 100644--- a/understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.ts+++ b/understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.ts@@ -358,12 +358,14 @@ export class TreeSitterPlugin implements AnalyzerPlugin {const pending = [tree.rootNode];while (pending.length > 0) {const node = pending.pop()!;+ let staticAccessorArguments: TreeSitterNode | null = null;if (isRubyExtractor) {const accessor = rubyAccessorEvidence(node);if (accessor?.unresolved) hasUnresolvedNames = true;// Static readers/writers only prevent deleting those exact names;// an unrelated attr token or accessor cannot taint the entire file.for (const name of accessor?.names ?? []) leafTexts.add(name);+ if (accessor && !accessor.unresolved) staticAccessorArguments = node.childForFieldName("arguments");}// Name references also cover local aliases and dynamic dispatch. These// languages can install methods without any structural declaration.@@ -414,7 +416,9 @@ export class TreeSitterPlugin implements AnalyzerPlugin {}}if (node.childCount === 0) leafTexts.add(node.text);- else pending.push(...node.children);+ // Exact accessor names replace their literal argument leaves: the+ // quoted key in attr_writer "run" is evidence of run=, not run.+ else pending.push(...node.children.filter(child => child.id !== staticAccessorArguments?.id));}return {status: "succeeded",