- 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.
2.2 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gateway-routes | The 5 core gateway routes wired into the router | completed |
|
moderate | medium | component | implementation |
|
Description
Port server/gateway_routes.rs from
/workspace/@alkdev/alknet/crates/alknet-http/src/server/gateway_routes.rs:
GET /search (AccessControl-filtered services/list), GET /schema,
POST /call ({operation, input}), POST /batch, and POST /subscribe
(SSE projection: text/event-stream, call.responded → data: frames,
terminal error event, abort on client disconnect). Auth middleware
applied to all five. The route set intentionally excludes /publish
(separate task). Integration tests over DuplexStream: search filtering
by identity scopes, call round-trip, subscribe stream of multiple
events, batch correlation.
Acceptance Criteria
- 5 routes ported and wired in server-adapter's router
- SSE framing tests (multi-event, error-terminates, client-disconnect)
- /search returns only ops the caller's identity can invoke
- Full request→dispatch→response test over DuplexStream
cargo testpasses
References
- docs/architecture/http-server.md (§router list, §Streaming projection)
- docs/architecture/decisions/042-openapi-gateway-pattern.md, 047-remove-direct-call-http-surface.md
Notes
Agent fills during implementation.
Summary
Ported src/gateway/routes.rs: GatewayState (FromRef),
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.