feat: server foundation (phase 1 core) — state, auth, healthz/decoy, gateway dispatch, HttpAdapter
Tasks completed: server-core-types, server-auth, server-healthz-decoy, gateway-dispatch, server-adapter (5 of 17). - src/server/state.rs: DecoyConfig + RouterState (alkcall type paths, 6-endpoint reserved-path docs) - src/server/auth.rs: bearer middleware + ResolvedIdentity extractor (10 tests: missing/malformed/basic/failed-resolution matrix) - src/server/healthz.rs + decoy.rs: raw healthz; nginx-style 404, static site (path-traversal guarded), redirect decoys - src/gateway/dispatch.rs: GatewayDispatch invoke/invoke_streaming (internal:false, forwarded_for:None, bounded deadline) + src/gateway/error.rs: CallError→HTTP status mapping (HTTP_<status> passthrough, retryable→Retry-After) - src/server/adapter.rs: HttpAdapter ProtocolHandler — accept_bi → BiStream → TokioIo → hyper auto builder (h2 CONNECT enabled); integration tests over DuplexStream (request/response cycle, healthz, decoy 404) Verified: cargo test (46 lib tests), clippy -D warnings, fmt, test --all-features.
This commit is contained in:
+11
-6
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: server-auth
|
||||
name: Bearer auth middleware and identity extraction
|
||||
status: pending
|
||||
status: completed
|
||||
depends_on: [server-core-types]
|
||||
scope: narrow
|
||||
risk: low
|
||||
@@ -23,10 +23,10 @@ static identity provider.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Middleware ports with tests (missing header, malformed, valid token, unknown token)
|
||||
- [ ] `set_identity` observability path documented for the WS route's use
|
||||
- [ ] No env-var reads anywhere (no-env-vars invariant)
|
||||
- [ ] `cargo test` passes
|
||||
- [x] Middleware ports with tests (missing header, malformed, valid token, unknown token)
|
||||
- [x] `set_identity` observability path documented for the WS route's use
|
||||
- [x] No env-var reads anywhere (no-env-vars invariant)
|
||||
- [x] `cargo test` passes
|
||||
|
||||
## References
|
||||
|
||||
@@ -39,4 +39,9 @@ static identity provider.
|
||||
|
||||
## Summary
|
||||
|
||||
> Agent fills on completion.
|
||||
Ported `src/server/auth.rs`: `bearer_auth_middleware`,
|
||||
`extract_bearer_identity`, `ResolvedIdentity` extractor — resolution
|
||||
semantics preserved (no header/malformed/failed resolution → None;
|
||||
routes decide 401 vs anonymous). 10 unit tests covering the matrix.
|
||||
alkcall type paths. The WS route's `set_identity` observability is
|
||||
documented in the module doc of adapter.rs.
|
||||
Reference in New Issue
Block a user