feat(java): detect @Scheduled methods and emit TRIGGERS edges#590
Open
YutenC wants to merge 1 commit into
Open
feat(java): detect @Scheduled methods and emit TRIGGERS edges#590YutenC wants to merge 1 commit into
YutenC wants to merge 1 commit into
Conversation
Spring @scheduled methods are scheduler entry points with no static caller in the codebase. CRG previously had no way to discover them via graph queries, forcing users to fall back to Grep. This change emits TRIGGERS edges from virtual scheduler source nodes to the annotated method: - SCHEDULER::cron <- @scheduled(cron = "...") - SCHEDULER::fixedRate <- @scheduled(fixedRate = N) - SCHEDULER::fixedDelay <- @scheduled(fixedDelay = N) - SCHEDULER::scheduled <- unrecognised / missing schedule param Schedule metadata (cron expression, fixedRate value, etc.) is stored in edge extra for traceability. No post-build resolver is required — schedule parameters are statically present in the annotation. Tests: TestSpringScheduledParsing (8 assertions) in test_multilang.py Fixture: tests/fixtures/ScheduledTasks.java
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.
Problem
Spring
@Scheduledmethods are scheduler entry points with no static caller in the codebase. CRG previously had no way to discover them via graph queries — users had to fall back torg "@Scheduled".Solution
Emit
TRIGGERSedges from virtual scheduler source nodes to annotated methods at parse time. No post-build resolver needed — schedule parameters are statically present in the annotation.@Scheduledparamcron = "..."SCHEDULER::cronfixedRate = NSCHEDULER::fixedRatefixedDelay = NSCHEDULER::fixedDelaySCHEDULER::scheduledSchedule metadata (cron expression, rate value, etc.) is stored in edge
extrafor traceability.Usage after this change
Changes
code_review_graph/parser.py—_SPRING_SCHEDULED_ANNOTATIONSconstant +_emit_scheduled_edges_from_method()+ hook in_extract_functionstests/fixtures/ScheduledTasks.java— fixture with cron / fixedRate / fixedDelay / plain methodstests/test_multilang.py—TestSpringScheduledParsing(8 assertions)