fix(parsers/js): capture decorators so framework route handlers are seeded#146
Open
gadievron wants to merge 1 commit into
Open
fix(parsers/js): capture decorators so framework route handlers are seeded#146gadievron wants to merge 1 commit into
gadievron wants to merge 1 commit into
Conversation
7af9548 to
14c3f3a
Compare
…eeded The TypeScript analyzer emitted function records with no 'decorators' field, so the reachability detector's decorator check (@Get/@Post/@controller in ENTRY_POINT_DECORATORS) could never fire for JS/TS. A NestJS/Angular handler identified only by a decorator (e.g. @get() findAll() { ... }) seeded zero entry points and its whole subtree was pruned from reachability — a false negative. Extract decorator source texts (method decorators plus the enclosing class's, so @controller is captured) via ts-morph getDecorators(), at ALL three class-member record sites: the class-declaration method loop, the class-expression method loop, and _emitAssignedFunction (an assigned method). Standalone-function record sites are left untouched because TS decorators cannot apply to them. The js reachable pipeline reads analyzer_output functions directly, so no normalization change is needed. JS sibling of the PHP #[Route] attribute-seeding fix (#138). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
14c3f3a to
05f6145
Compare
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.
The TypeScript analyzer emitted function records with no 'decorators' field, so
the reachability detector's decorator check (@Get/@Post/@controller in
ENTRY_POINT_DECORATORS) could never fire for JS/TS. A NestJS/Angular handler
identified only by a decorator (e.g. @get() findAll() { ... }) seeded zero entry
points and its whole subtree was pruned from reachability — a false negative.
Extract the decorator source texts (method decorators plus the enclosing class's,
so @controller is captured too) on class-method records via ts-morph
getDecorators(). The js reachable pipeline already reads analyzer_output
functions directly, so no normalization change is needed. A decorated handler is
now seeded and its callees stay reachable.
This is the JS sibling of the PHP #[Route] attribute-seeding fix (same class of
decorator-based entry point missed by a parser).
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Found during review of the PHP #[Route] fix (#138) as its JS sibling. The TS analyzer never captured decorators, so
@Get/@Controllerhandlers were undetected as entry points on every path. Ships with an end-to-end test (parse -> detect -> reachable). One of the reachability-fix series.🤖 Generated with Claude Code