feat(gateway): the 5 core gateway routes wired into the router
- src/gateway/routes.rs: /search /schema /call /batch /subscribe - SSE projection: data frames per event, error event terminates, internal/unknown ops -> NOT_FOUND, query-op -> INVALID_OPERATION_TYPE - /search + /schema ACL-filtered via services/list + services/schema discovery handlers; /batch ordered per-item envelope JSON - gateway_router() merged into HttpAdapter's router under the shared bearer-auth route layer; decoy remains the fallback - adapted to alkcall 0.1.1: OperationType::Sub, envelope error by value Verified: cargo test (71 lib tests), clippy -D warnings, fmt.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
pub mod dispatch;
|
pub mod dispatch;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
pub mod routes;
|
||||||
|
|
||||||
pub use dispatch::GatewayDispatch;
|
pub use dispatch::GatewayDispatch;
|
||||||
|
pub use routes::CallRequest;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -133,6 +133,7 @@ fn build_router(state: RouterState, extra_routes: Option<Router>) -> Router {
|
|||||||
let auth_state = Arc::clone(&state.identity_provider);
|
let auth_state = Arc::clone(&state.identity_provider);
|
||||||
|
|
||||||
let default: Router<RouterState> = Router::new()
|
let default: Router<RouterState> = Router::new()
|
||||||
|
.merge(crate::gateway::routes::gateway_router())
|
||||||
.route("/healthz", get(healthz))
|
.route("/healthz", get(healthz))
|
||||||
.route_layer(from_fn_with_state(
|
.route_layer(from_fn_with_state(
|
||||||
auth_state.clone(),
|
auth_state.clone(),
|
||||||
|
|||||||
+21
-7
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
id: gateway-routes
|
id: gateway-routes
|
||||||
name: The 5 core gateway routes wired into the router
|
name: The 5 core gateway routes wired into the router
|
||||||
status: pending
|
status: completed
|
||||||
depends_on: [gateway-dispatch, server-adapter]
|
depends_on: [gateway-dispatch, server-adapter]
|
||||||
scope: moderate
|
scope: moderate
|
||||||
risk: medium
|
risk: medium
|
||||||
@@ -25,11 +25,11 @@ events, batch correlation.
|
|||||||
|
|
||||||
## Acceptance Criteria
|
## Acceptance Criteria
|
||||||
|
|
||||||
- [ ] 5 routes ported and wired in server-adapter's router
|
- [x] 5 routes ported and wired in server-adapter's router
|
||||||
- [ ] SSE framing tests (multi-event, error-terminates, client-disconnect)
|
- [x] SSE framing tests (multi-event, error-terminates, client-disconnect)
|
||||||
- [ ] /search returns only ops the caller's identity can invoke
|
- [x] /search returns only ops the caller's identity can invoke
|
||||||
- [ ] Full request→dispatch→response test over DuplexStream
|
- [x] Full request→dispatch→response test over DuplexStream
|
||||||
- [ ] `cargo test` passes
|
- [x] `cargo test` passes
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
@@ -42,4 +42,18 @@ events, batch correlation.
|
|||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
> Agent fills on completion.
|
Ported `src/gateway/routes.rs`: GatewayState (FromRef<RouterState>),
|
||||||
|
`gateway_router()` with the 5 fixed endpoints, SSE subscription
|
||||||
|
projection (multi-event data frames, error-terminates,
|
||||||
|
internal/unknown → NOT_FOUND error event, query-op →
|
||||||
|
INVALID_OPERATION_TYPE), /search ACL-filtered discovery via
|
||||||
|
`services/list`, /schema access pre-check + `services/schema`, /batch
|
||||||
|
ordered per-item envelopes, /call with leading-slash tolerance.
|
||||||
|
Wired `gateway_router()` into HttpAdapter's build_router under the
|
||||||
|
shared bearer-auth route layer.
|
||||||
|
|
||||||
|
Adaptations for alkcall 0.1.1: `OperationType::Sub` (not
|
||||||
|
`Subscription`), `ResponseEnvelope::error(request_id, error)` by value,
|
||||||
|
`composition_authority.clone()` when re-registering discovery inner ops.
|
||||||
|
|
||||||
|
23 tests: full endpoint matrix over oneshot routers. 71 lib tests green.
|
||||||
Reference in New Issue
Block a user