Skip to content

fix(parsers/js): capture decorators so framework route handlers are seeded#146

Open
gadievron wants to merge 1 commit into
masterfrom
fix/js-decorator-entry-points
Open

fix(parsers/js): capture decorators so framework route handlers are seeded#146
gadievron wants to merge 1 commit into
masterfrom
fix/js-decorator-entry-points

Conversation

@gadievron

Copy link
Copy Markdown
Collaborator

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/@Controller handlers 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

@gadievron gadievron force-pushed the fix/js-decorator-entry-points branch from 7af9548 to 14c3f3a Compare July 10, 2026 16:52
…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>
@gadievron gadievron force-pushed the fix/js-decorator-entry-points branch from 14c3f3a to 05f6145 Compare July 10, 2026 17:30
@gadievron gadievron marked this pull request as ready for review July 10, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant