fix(routes): accept relative JAX-RS @Path templates and compose Scala class-level @Path (#2147) - #2158
fix(routes): accept relative JAX-RS @Path templates and compose Scala class-level @Path (#2147)#2158htarnacki wants to merge 5 commits into
Conversation
|
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. |
5bb94c5 to
b5f119c
Compare
|
CI status: everything is green except I believe that one is pre-existing / environmental rather than caused by this PR: the change is confined to JAX-RS |
b5f119c to
334e0b0
Compare
|
Thank you for the JAX-RS relative-path cases and Scala coverage. Current extraction rejects the relative forms at the identified path, so these regressions address a concrete gap. Please retain the rooted, non-JAX-RS negative control so the change cannot accidentally broaden unrelated route extraction. No empty commit or CI-only push is being requested. |
JAX-RS allows @path values without a leading slash, both on the class and on the method. The route extractor rejected such literals, so resources such as `@Path("widgets")` + `@Path("{id}")` produced no Route nodes and no HANDLES edges at all. Accept relative templates and normalize the class/method composition so the resulting path is always rooted. Existing JAX-RS Java probe tests are updated to use relative templates so they guard the regression. Signed-off-by: Hubert Tarnacki <hubert.tarnacki@gmail.com>
Scala JAX-RS resources declare @path on the class exactly like Java and Kotlin, but the class-level prefix was only joined with the method path for those two languages. Include Scala so a method route is emitted as `<class path>/<method path>` instead of the bare method template. Adds a Scala probe test covering both an empty and a non-empty method template. Signed-off-by: Hubert Tarnacki <hubert.tarnacki@gmail.com>
334e0b0 to
d493124
Compare
|
Updated per your note — the branch base is unchanged, only the test coverage moved:
Verified locally by swapping in |
|
Thank you — this is exactly what was asked for, and the way you verified it is the part I appreciate most: swapping in Two things on our side: The I have updated your branch with |
|
The local half is done, on the merge result of your head
So the tests bind to the fix, which is the property that matters, and the change is scoped the way it should be: One small edge, and it is a behaviour change, so I would like it closed before this merges. return path[0] ? cbm_arena_sprintf(a, "/%s", path) : path;For return path[0] ? cbm_arena_sprintf(a, "/%s", path) : NULL;plus one assertion for After that and a green matrix this merges. Thank you for the careful follow-through on the negative controls. |
…path Accepting relative JAX-RS templates made route_path_from_string_node return "" for @path(""), which is non-NULL and so replaced the "/" fallback with an empty method path. @path("") is legal JAX-RS and means "the class path itself"; on main the empty value was rejected and the method fell back to "/" like a method without @path. Return NULL for the empty case so that behaviour is unchanged. The regression covers both shapes: with a class-level @path the method composes to the class path, and without one the route stays "/" (with the empty string it was dropped entirely, because join_route_paths returns the NULL prefix for an empty path). Signed-off-by: Hubert Tarnacki <hubert.tarnacki@gmail.com>
|
Closed the return path[0] ? cbm_arena_sprintf(a, "/%s", path) : NULL;One note on the test shape. A single assertion next to the relative-template test would not have bound to the fix: with a class-level So the regression is a dedicated
Verified locally: with the fix The 4 |
What does this PR do?
Fixes #2147.
JAX-RS allows
@Pathtemplates without a leading slash (@Path("widgets"),@Path("{id}")); the route extractor rejected them, so such resources produced noRoutenodes and noHANDLESedges. Two commits:fix(routes): accept relative JAX-RS @Path templates— accept relative templates on class and method level and normalize the composed path so it is always rooted (/widgets/{id}). Existing tests updated to use the relative spelling for the JAX-RS cases, a rooted case is kept.fix(routes): compose class-level @Path for Scala JAX-RS resources— the class-level prefix was joined with the method path for Java and Kotlin but not for Scala; Scala now composes the same way. New pipeline test.No behaviour change for Spring / other frameworks: rooted templates compose exactly as before (follow-up to #1005).
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test) — all suites green except 10test_cli.cinstall/uninstall cases that fail identically on a cleanmainin my environment (activation transaction I/O failed: target-entry-snapshot, environment-specific).make -f Makefile.cbm lint-ci) —clang-format-20andcheck-dco.shclean;clang-tidy/cppcheckare not installed locally, relying on CI for those two.