Skip to content

Fix Path Ordering - #2978

Merged
VirajSalaka merged 2 commits into
wso2:mainfrom
VirajSalaka:path-regex-fix
Jul 29, 2026
Merged

Fix Path Ordering#2978
VirajSalaka merged 2 commits into
wso2:mainfrom
VirajSalaka:path-regex-fix

Conversation

@VirajSalaka

@VirajSalaka VirajSalaka commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Purpose

This fixes issues related to the order of routes appearing in envoy config.

Goals

Describe what solutions this feature or fix introduces to address the problems outlined above.

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI. Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Route precedence scoring now compares semantic path segments and falls back to matcher-based scoring when route names lack semantic paths. Unit tests and an integration scenario verify ordering for generated regexes, legacy exact routes, wildcard paths, and overlapping LLM policy paths.

Changes

Route specificity sorting

Layer / File(s) Summary
Semantic path specificity scoring
gateway/gateway-controller/pkg/xds/route_sorter.go
Route sorting parses semantic paths from route names, classifies literal, parameter, mixed, and wildcard segments, compares them left to right, and falls back to matcher-based scoring when needed.
Route ordering validation
gateway/gateway-controller/pkg/xds/route_sorter_test.go, gateway/gateway-controller/pkg/xds/translator_test.go, gateway/it/features/llm-policy-path-specificity.feature
Tests cover generated regex precedence, legacy exact versus wildcard ordering, and overlapping LLM policy paths.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: pubudu538, malinthaprasan, lasanthas, tgtshanika, chamilaadhi

Sequence Diagram(s)

sequenceDiagram
  participant Request
  participant EnvoyRoutes
  participant RouteSorter
  participant LLMPolicy
  Request->>EnvoyRoutes: Match request path
  EnvoyRoutes->>RouteSorter: Compare overlapping routes
  RouteSorter->>LLMPolicy: Select most specific route
  LLMPolicy-->>Request: Apply matched policy headers
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is mostly the untouched template and lacks required details for goals, approach, testing, security, and other sections. Fill in the template sections with the problem context, solution approach, user stories, docs, unit/integration tests, security checks, related PRs, and test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately reflects the main change: fixing path ordering.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
@VirajSalaka
VirajSalaka merged commit fb2c860 into wso2:main Jul 29, 2026
13 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants