Repository navigation
fix(extract): emit HTTP_CALLS for Retrofit interface methods (#2723) - #2905
divakantpandey wants to merge 3 commits into
Conversation
…a#2723) Retrofit's @GET/@POST/... share their names with the JAX-RS verbs, so every annotated client method became a served Route with a HANDLES edge, and any path without a leading slash collapsed onto "/". JAX-RS verbs are marker annotations; a verb that carries an argument is a Retrofit request. Record its path as client_route_path and emit HTTP_CALLS to the Route instead. Relative paths are rooted, full URLs kept; constants, templates and concatenations have no static value and produce no edge. Signed-off-by: Divakant Pandey <divakant01@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thank you so much for this, @divakantpandey! This is a precise fix for a real graph-quality problem: a Retrofit interface describes calls the client makes, and the graph was turning each one into a served endpoint. Several things here are exactly right:
One request before we merge:
Also, a production file this PR touches ( Thanks again for the careful work, and for leaving the same-file constant resolution for a separate change. Keeping this one focused on the direction fix made it easy to review. |
…into fix/2723-retrofit-client-http-calls Signed-off-by: Divakant Pandey <divakant01@gmail.com>
|
Limited the Retrofit reading to methods declared in a Java or Kotlin interface, and added a control test with a Pippo-style Java controller and a Rapidoid-style Kotlin class that keep HANDLES and get no HTTP_CALLS (it fails without the gate). Also merged current main; CI is green on the merged tree. |
Fixes #2723.
Retrofit's
@GET/@POST/... match the bare-verb branch ofannotation_route_methodthat exists for JAX-RS, so each interface method became aRoutewith aHANDLESedge in the client project. Non-@Pathpaths must start with/, so Retrofit's relativev1/ordersfell back to/.JAX-RS verbs are marker annotations (the path is a sibling
@Path), and Retrofit services must be interfaces, so a verb annotation with an argument on a method declared in a Java or Kotlin interface is a Retrofit request. Controller classes that put the path in@GET("/x")(Pippo, Rapidoid) keep theirHANDLES. Such methods now storeclient_route_pathinstead ofroute_path, andcbm_pipeline_emit_def_routeemitsHTTP_CALLSwith the sameurl_path/methodproperties as call-site service edges, so cross-repo matching treats them like any other outbound call. A separate field keeps everyroute_pathconsumer (prefix bridge, decorator backstop, UI) meaning "served endpoint" unchanged. The incremental routes re-extract an edited file and go through the same emit, soensure_decorator_routesneeds no change; the incremental test covers both routes.Path handling: a leading
/is kept, a relative path is rooted (Retrofit resolves it against the base URL), and a full URL is kept as written. Aconst val, a string template or a concatenation has no static value: no edge, rather than a/Route. Resolving same-file constants would cover the remaining two cases in the issue; I left it out to keep this change to the direction fix.On the issue's fixture: client
HANDLES4 -> 0,HTTP_CALLS0 -> 2; client -> servercross_http_calls0 -> 2; billing caller 2 -> 1 (no longer lands on the client). JAX-RS server routes unchanged.Checklist
scripts/test.sh --suites pipeline_semantic_manifest_repro,pipeline,extraction,edge_types_probe,cross_repo,incremental(1376 passed, ASan/UBSan, macOS arm64); fullscripts/test.sh: 10324 passed, 0 failedHANDLES, and an incremental re-index; the Retrofit tests fail without the fix and the controller-class test fails without the interface gate