Files
git.stella-ops.org/docs/features/checked/gateway/configurable-route-table-route-resolver.md
2026-02-12 21:02:43 +02:00

38 lines
2.6 KiB
Markdown

# Configurable Route Table - Route Resolution Engine
## Module
Gateway
## Status
VERIFIED
## Description
The Gateway includes a `StellaOpsRouteResolver` that maps incoming HTTP request paths to configured `StellaOpsRoute` entries. Uses first-match-wins ordering. Supports both prefix matching (case-insensitive `PathString.StartsWith`) and compiled regex matching (`IsRegex = true`). Excludes `NotFoundPage` and `ServerErrorPage` routes from path resolution (these are handled separately by `ErrorPageFallbackMiddleware`). Returns `null` for no match, allowing fallthrough to the existing Microservice pipeline.
## Implementation Details
- **Modules**: `src/Router/StellaOps.Gateway.WebService/`
- **Key Classes**:
- `StellaOpsRouteResolver` (`src/Router/StellaOps.Gateway.WebService/Routing/StellaOpsRouteResolver.cs`) - First-match-wins resolver with prefix and regex support
- `RouteDispatchMiddleware` (`src/Router/StellaOps.Gateway.WebService/Middleware/RouteDispatchMiddleware.cs`) - Calls resolver, dispatches to handler based on route type
- `Program.cs` (`src/Router/StellaOps.Gateway.WebService/Program.cs`) - Registers `StellaOpsRouteResolver` as singleton in DI
- **Tests**:
- `StellaOpsRouteResolverTests` (`src/Router/__Tests/StellaOps.Gateway.WebService.Tests/Routing/StellaOpsRouteResolverTests.cs`) - 9 unit tests (exact match, prefix, regex, no match, first-match-wins, excluded error types, case-insensitive, empty)
- `RouteTableIntegrationTests` (`src/Router/__Tests/StellaOps.Gateway.WebService.Tests/Integration/RouteTableIntegrationTests.cs`) - 2 route resolution integration tests
## E2E Test Plan
- [ ] Exact path match: `GET /favicon.ico` resolves to StaticFile route (returns file content)
- [ ] Prefix match: `GET /app/index.html` resolves to StaticFiles route (serves directory file)
- [ ] Regex match: `GET /api/v2/data` resolves to ReverseProxy route with pattern `^/api/v[0-9]+/.*`
- [ ] No match fallthrough: `GET /unmatched/path` returns 404 (falls through to Microservice pipeline)
- [ ] First-match-wins: when multiple routes could match, first configured route takes precedence
- [ ] Case-insensitive: `GET /APP/index.html` resolves to `/app` StaticFiles route
## Verification
- **Run ID**: run-001
- **Date**: 2026-02-12
- **Method**: Tier 0 source verification + Tier 1 build/code review (224/224 tests pass) + Tier 2a live HTTP API testing
- **Build**: PASS (0 errors, 0 warnings)
- **Tests**: PASS (224/224 Gateway tests pass)
- **Tier 2a Evidence**: `docs/qa/feature-checks/runs/gateway/configurable-route-table-route-resolver/run-001/tier2-api-check.json`
- **Verdict**: PASS