Expand description
Field-level input validation for HTTP request bodies.
Issue 56: oversized or malformed fields used to flow all the way to
signal::pipeline before being rejected. These checks fail fast at the
adapter boundary with a 400 so the pipeline only ever sees bounded input.
Length budgets are looser than the 1 MiB body cap on /v1/* so the body
limit stays the outer wall and these are the inner shape checks.
Constants§
- MAX_
CONTENT_ BYTES - Max byte length of
SignalRequest.content. Tuned to leave headroom for metadata + transport framing inside the 1 MiB per-request body limit. - MAX_
IDENT_ BYTES - Max byte length of short identifier-ish fields (namespace, agent, session_id, sender, channel).
- MAX_
QUERY_ BYTES - Max byte length of
SearchRequest.query. Search queries that exceed this are almost certainly accidental dumps. - MAX_
TOP_ K - Hard ceiling on
top_k. The recall layer ignores anything above its own configured max anyway; this just prevents a client from forcing the adapter to round-trip absurd values.
Functions§
- check_
content - Reject empty / oversized free-text payloads.
- check_
query - Reject empty / oversized search queries.
- check_
short_ ident - Reject empty / oversized short identifier fields. Also rejects ASCII control characters which have no place in any identifier and would otherwise turn into junk in logs.
- check_
top_ k - Bound
top_kto a sane window.Nonemeans caller will fall back to a pipeline-internal default and is fine.