Index TypeScript abstract classes, not just concrete ones - #1033
Open
aala-conga wants to merge 2 commits into
Open
aala-conga wants to merge 2 commits into
aala-conga wants to merge 2 commits into
Conversation
Tree-sitter gives an abstract class its own node type, abstract_class_declaration, and _CLASS_TYPES listed only class_declaration for typescript/tsx. An abstract base therefore contributed no Class node, and the concrete methods hosted on it lost their parent and were not emitted either — so shared behaviour on a base class was invisible to the graph while every subclass was indexed. Measured on an Angular codebase: abstract classes indexed 0/21 -> 21/21, concrete classes unchanged at 634/641. Java is not affected (abstract_class_declaration is TS-specific; Java reuses class_declaration). Adds TestTypeScriptAbstractClasses, a sibling of the tirth8205#737 class, covering the declaration, the methods that disappear with it, the tsx list, and reachability by qualified name in a built graph. All four fail on staging. See: tirth8205#1031 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
code-review-graph reviewOverall risk: 0.25 (LOW) — 7 changed function(s)/class(es), 17 affected flow(s), 1 test gap(s) Risk-scored changes
Affected execution flows
Test gaps
Token savings: this graph-backed report used ~202,054 fewer tokens (~91%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1031.
Tree-sitter gives an abstract class its own node type,
abstract_class_declaration, and_CLASS_TYPESlisted onlyclass_declarationfortypescript/tsx. An abstract base thereforecontributed no
Classnode — and the concrete methods hosted on it lost their parent and were notemitted either, so shared behaviour on a base class was invisible to the graph while every subclass
was indexed.
The fix adds one string to each of the two lists.
abstract_class_declarationis TypeScript-specific;Java reuses
class_declarationand is not affected.Measured
On an Angular codebase (1696
Classnodes before):Classnodes total<file>::handle<file>::Base.handleJava on the same run: 4 abstract classes, 4 indexed, before and after.
Tests
TestTypeScriptAbstractClassesintests/test_parser.py, a sibling ofTestTypeScriptTypeDeclarations(the #737 class, whose shape it copies). Four cases: thedeclaration itself, the methods that disappear with it, the
tsxlist (the fix touches two lists,and a
.ts-only test would have covered only one), and reachability by qualified name in a builtgraph — the form the symptom actually took.
All four fail on
stagingand pass with the fix:Full suite, fresh clone of
stagingatf0e4eb7, Python 3.13,pip install -e ".[dev]":staging, untouched — baseline3963 passed, 773 skipped, 2 xfailed, 2 xpassed(349 s)3963 passed, 773 skipped, 2 xfailed, 2 xpassed(321 s)3967 passed, 773 skipped, 2 xfailed, 2 xpassed(333 s)Nothing in the existing suite depended on abstract classes being absent.
Scope
This does not close #1031's downstream effects on its own.
callers_ofon a method inherited from anabstract base is still 0, because
this.method()remains bound to the enclosing class rather thanwalked up the now-complete
INHERITSchain — that is the subject of the follow-up discussion on#984. What this change does fix is the inheritance chain breaking at an abstract intermediate, and
the node naming of base methods.
I did not check Kotlin, PHP or C#, which also have abstract classes and which I have no codebase to
measure on.
🤖 Generated with Claude Code