fix(extract): compose Spring controller route prefixes#772
Draft
jonghyunlee-29cm wants to merge 1 commit into
Draft
fix(extract): compose Spring controller route prefixes#772jonghyunlee-29cm wants to merge 1 commit into
jonghyunlee-29cm wants to merge 1 commit into
Conversation
fe005b3 to
7b4a0ee
Compare
Spring class-level RequestMapping prefixes were not folded into method mapping route_path values, so the graph could contain partial Route nodes like /orders instead of the actual endpoint /api/orders even while HANDLES edges existed. Combine Java/Kotlin class mapping prefixes with method-level mappings during method definition extraction, and scan bounded annotation-argument subtrees so named or array-valued Spring annotations can provide the path literal. Strengthen edge_types_probe to assert exact Spring Route node names for Java and Kotlin, not just HANDLES edge counts. Signed-off-by: jonghyun.lee <jonghyun.lee@musinsa.com>
7b4a0ee to
a19fe03
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.
What does this PR do?
Distilled from a real Spring/Kotlin route-indexing failure: reindexing still missed actual controller API names because Spring method routes were indexed without their class-level
@RequestMappingprefix.Bug/Background
Spring annotation extraction can already produce method-level routes such as
/orders, butpush_method_defonly inspected the method node. Class-level mappings such as@RequestMapping("/api")or Kotlin's@RequestMapping(value = ["/internal/v1/api"])were not folded into the method route before Route/HANDLES emission.That leaves the graph with partial Route node names like
/ordersinstead of the actual endpoint/api/orders, which makes API discovery and route search miss the production route shape even though a HANDLES edge exists.Fix
route_pathextraction model.Reproduce-first
edge_types_probefixture to assert exact Route node names:/api/ordersand/api/orders/{id}.@RequestMapping(value = ["/internal/v1/api"])and exact Route node assertions./orderscannot remain alongside the full route.Validation
git diff --checkGIT_CONFIG_GLOBAL=/dev/null build/c/test-runner edge_types_probe->53 passedGIT_CONFIG_GLOBAL=/dev/null make -f Makefile.cbm test->5747 passedlint / lint-> passed (scripts/lint.sh --ci, which provisions cppcheck 2.20.0 and clang-format-20 before running thelint-cipath)Known limitation
This keeps the existing one-route-per-definition behavior. Multi-path annotations still select the first path-shaped literal rather than expanding into multiple Route nodes.
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)