phase 1 core platform
Milestone 1.2.3: Proxy Input Validation and Stable Error Envelope — complete.
Milestone 1.2.3: Proxy Input Validation and Stable Error Envelope
Status: Complete
Goal: 1.2 Proxy platform integration
Phase: 1 — Core Platform
Summary
Body size and Content-Type middleware on chat, semantic validation with field_errors, extended stable error envelope, response headers on all proxy HTTP responses, path org_id UUID validation. Completes Goal 1.2 validation envelope criteria; rate limiting → 1.2.4.
Branch
feature/m1-2-3-input-validation
PR title
feat(proxy): input validation and stable error envelope (m1.2.3)
Prerequisites
- 1.2.2 merged (
ADR-0012,internal/llm/)
Tasks
- ADR-0013
-
services/proxy/internal/validation/— limits, chat, headers, uuid + tests - Extend
services/proxy/internal/errors/—FieldError,Write, 413/415/validation codes -
services/proxy/internal/http/middleware.go— request context, response headers, body limit, content-type - Refactor auth middleware to reuse request ID from context
- Router wiring + fix
WithChatRequestcontext assignment - Config:
IBEX_MAX_REQUEST_BODY_BYTES, request/trace header names - Integration tests: 413/415/validation/headers matrix
- Docs: API, SECURITY §8.1, TESTING_STRATEGY §6.2.3, FILE_STRUCTURE, proxy README, DEVELOPMENT_GUIDE post-merge
- Contributor execution materials prepared
Files affected
| Path | Action |
|---|---|
docs/adr/ADR-0013-proxy-input-validation-and-error-envelope.md | Add |
services/proxy/internal/validation/ | Add |
services/proxy/internal/errors/envelope.go | Extend |
services/proxy/internal/http/middleware.go | Add |
services/proxy/internal/http/contextkeys.go | Add |
services/proxy/internal/http/router.go | Middleware chain + handler |
services/proxy/internal/http/auth_middleware.go | Reuse request ID |
services/proxy/internal/config/config.go | Limits + header names |
services/proxy/proxy_auth_integration_test.go | Validation matrix |
docs/API_DOCUMENTATION.md | 413/415, METHOD_NOT_ALLOWED |
docs/SECURITY.md | §8.1 proxy limits |
docs/TESTING_STRATEGY.md | §6.2.3 |
docs/FILE_STRUCTURE.md | validation + llm |
services/proxy/README.md | Middleware order, PowerShell |
Testing requirements
go test ./services/proxy/...
go test -tags=integration ./services/proxy/...
golangci-lint run ./services/proxy/...Definition of done
- Body limit before parse; 413 / 415 documented and tested
- Semantic validation → 400
VALIDATION_ERRORwithfield_errors - All proxy JSON errors use extended envelope
-
X-Request-ID,X-Trace-ID,X-Response-Timeon responses -
X-IBEX-Agent-IDenforced on chat (UUID) - Auth error codes unchanged
- Goal 1.2 validation items satisfied on proxy
-
proxy-auth-smoke(CI) - PR merge with
--delete-branch(maintainer)
Deferred (1.2.4+)
- Redis rate limit middleware
- OTel trace propagation
- Multimodal
contentarrays - Full envelope migration for non-proxy services
Risks
| Risk | Mitigation |
|---|---|
| Breaking clients on empty model | Documented in ADR; integration tests |
| MaxBytesReader error handling | Map *http.MaxBytesError to 413 envelope |
| Header name config drift | Defaults match API doc; env overrides in config |
Verification
See .
Edit on GitHub
Last updated on