Plan updated with the alknet-tty findings: the drainer pattern (single ordered writer) makes outbound chunk-boundary parsing sound; TestStdinSink's try_send→Full→Pending is the inbound backpressure precedent; OQ-01(a) now cites the reference. Task graph (taskgraph-validated, 17 tasks, 6 generations, no cycles): - tasks/server/: core-types, auth, healthz-decoy, adapter - tasks/gateway/: dispatch, routes, publish - tasks/websocket/: byte-adapter (research POC), upgrade-session, overlay-ops - tasks/adapters/: from-openapi, from-jsonschema, to-openapi, from-wss, mcp - tasks/client/: http-host - tasks/infra/: integration-suite (phase 4) Critical path runs through server core → adapter → WS session → overlay tests → integration suite. High-risk tasks are the three WS tasks, de-risked by the ws-byte-adapter POC blocking upgrade-session.
47 lines
1.6 KiB
Markdown
47 lines
1.6 KiB
Markdown
---
|
|
id: gateway-dispatch
|
|
name: GatewayDispatch — shared dispatch spine (invoke + streaming)
|
|
status: pending
|
|
depends_on: [server-core-types]
|
|
scope: moderate
|
|
risk: medium
|
|
impact: component
|
|
level: implementation
|
|
tags: [gateway, phase-1]
|
|
---
|
|
|
|
## Description
|
|
|
|
Port the dispatch spine from
|
|
`/workspace/@alkdev/alknet/crates/alknet-http/src/gateway/dispatch.rs`
|
|
to alkcall's API: `GatewayDispatch::new(registry, identity_provider)`,
|
|
`invoke()` (identity resolve → root OperationContext →
|
|
`OperationRegistry` invoke → ResponseEnvelope), and `invoke_streaming()`
|
|
(`BoxStream<ResponseEnvelope>` for Sub ops). The security invariants
|
|
must hold identically across both: `External`-only (Internal →
|
|
NOT_FOUND), `AccessControl::check` gating, no env-var reads. Port the
|
|
error mapping (`gateway/error.rs`) too: CallError → HTTP status per
|
|
docs/architecture/http-server.md §Error Mapping (NOT_FOUND→404,
|
|
FORBIDDEN→401/403, INVALID_INPUT→422, TIMEOUT→504, INTERNAL→500,
|
|
`HTTP_<status>` passthrough, retryable→Retry-After hint).
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] `invoke()` + `invoke_streaming()` ported against alkcall dispatch
|
|
- [ ] Error mapping table ported with unit tests per row
|
|
- [ ] Internal ops → 404 before ACL; ACL failure → 401/403 distinction preserved
|
|
- [ ] `cargo test` passes
|
|
|
|
## References
|
|
|
|
- docs/architecture/http-server.md (§HTTP-to-call dispatch, §Error Mapping)
|
|
- docs/architecture/decisions/023-operation-error-schemas.md
|
|
- alkcall ADR-016 (error schemas), ADR-017 (privilege model)
|
|
|
|
## Notes
|
|
|
|
> Agent fills during implementation.
|
|
|
|
## Summary
|
|
|
|
> Agent fills on completion. |