Make the governed RAG evidence path executable end to end
Some checks failed
verify / verify (push) Has been cancelled
Some checks failed
verify / verify (push) Has been cancelled
Separate local parsing from model indexing, bind review decisions to immutable manifests, persist vectors behind active profiles, and expose retrieval, chat, evaluation, and document workflows through the React workbench. Constraint: Live Bailian authentication currently fails for all three configured capabilities Rejected: Direct upload-to-embedding flow | bypasses local review and manifest binding Confidence: high Scope-risk: broad Directive: Keep private-data deployment blocked until authentication, RBAC, and separate database roles land Tested: make verify; fresh and replay Docker document smoke; worker recovery smoke; frozen synthetic evaluation; migration 0003-0004 roundtrip Not-tested: Successful live Bailian calls, OCR, real multi-user authorization
This commit is contained in:
@@ -6,6 +6,7 @@ from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
PROBLEM_MEDIA_TYPE = "application/problem+json"
|
||||
@@ -60,3 +61,35 @@ def api_problem_handler(request: Request, exc: ApiProblem) -> JSONResponse:
|
||||
trace_id=trace_id,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def request_validation_problem_handler(
|
||||
request: Request,
|
||||
exc: RequestValidationError,
|
||||
) -> JSONResponse:
|
||||
"""Return bounded validation metadata without echoing rejected input values."""
|
||||
|
||||
trace_id = str(getattr(request.state, "trace_id", "unavailable"))
|
||||
field_errors: list[dict[str, str]] = []
|
||||
for error in exc.errors():
|
||||
location = error.get("loc", ())
|
||||
field = ".".join(str(part) for part in location if str(part) not in {"body", "query"})
|
||||
error_type = error.get("type")
|
||||
field_errors.append(
|
||||
{
|
||||
"field": field[:240] or "request",
|
||||
"code": str(error_type)[:120] if error_type else "invalid_value",
|
||||
}
|
||||
)
|
||||
return JSONResponse(
|
||||
status_code=422,
|
||||
media_type=PROBLEM_MEDIA_TYPE,
|
||||
content=problem_payload(
|
||||
status=422,
|
||||
code="REQUEST_VALIDATION_FAILED",
|
||||
title="Request validation failed",
|
||||
detail="One or more request fields did not satisfy the public API contract.",
|
||||
trace_id=trace_id,
|
||||
field_errors=field_errors[:50],
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user