Summary
extract_decorators() walks prev-siblings and breaks on the first named
tree-sitter node. Comments are named nodes, so a comment interleaved in a
decorator run ends the walk early and silently drops every decorator above
the comment.
Reproduce
Index a TypeScript file with a comment between decorators:
@Post('login') // dropped
@HttpCode(HttpStatus.OK) // dropped
// throttled per IP and per account
@Throttle({ default: { ttl: 900_000, limit: 5 } }) // kept
async login(dto: LoginDto) { ... }
The method ends up with only @Throttle. @Post/@HttpCode are gone, so the
route disappears from any decorator/route/authz query — documenting a decorator
with an explanatory comment removes the endpoint from the graph.
Impact
On a real NestJS backend, exactly 1 of 95 HTTP endpoints was missing from the
graph — the one whose throttle policy carried an explanatory comment.
Expected
Comments should be transparent to the prev-sibling walk, the same way the
anonymous tokens (e.g. the TS export keyword) already are. The existing
is_comment_node() helper can be reused.
Environment
Found while indexing a NestJS + Angular monorepo. Affects any framework whose
decorators/annotations can be interleaved with comments (NestJS, Angular, etc.).
A reproduce-first regression test
(extract_ts_decorators_survive_interleaved_comment) and the fix are ready; PR
to follow, linked to this issue.
Summary
extract_decorators()walks prev-siblings and breaks on the first namedtree-sitter node. Comments are named nodes, so a comment interleaved in a
decorator run ends the walk early and silently drops every decorator above
the comment.
Reproduce
Index a TypeScript file with a comment between decorators:
The method ends up with only
@Throttle.@Post/@HttpCodeare gone, so theroute disappears from any decorator/route/authz query — documenting a decorator
with an explanatory comment removes the endpoint from the graph.
Impact
On a real NestJS backend, exactly 1 of 95 HTTP endpoints was missing from the
graph — the one whose throttle policy carried an explanatory comment.
Expected
Comments should be transparent to the prev-sibling walk, the same way the
anonymous tokens (e.g. the TS
exportkeyword) already are. The existingis_comment_node()helper can be reused.Environment
Found while indexing a NestJS + Angular monorepo. Affects any framework whose
decorators/annotations can be interleaved with comments (NestJS, Angular, etc.).
A reproduce-first regression test
(
extract_ts_decorators_survive_interleaved_comment) and the fix are ready; PRto follow, linked to this issue.