You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(body-aware): clarify v1 scope per Gemini Code Assist feedback
Three medium-priority concerns from the review needed reconciliation
between the design doc and the v1 implementation:
1. Pre-eval optimization with require_body_eval: doc described a flag
but didn't say the header-side allow rule should still run first
to short-circuit deny on header-only decisions. v1 doesn't ship
the flag at all -- body callback always evaluates allow_body when
it fires. Reframed as 'v1 vs v2': v2 lands the flag plus the
header-phase short-circuit (saves CPU and buffering on rejected
requests). Static-AST flag inference noted via the streaming
evaluation proposal.
2. RequestContext lifecycle in host_allocator: doc proposed the
snapshot map without saying anything about the deep-free /
leak risk for the inner slices and json.Value tree. v1 doesn't
ship per-context state; the snapshot is v2. Doc now recommends
a per-context arena (lazy on first header callback, reset on
proxy_on_done) so v2 starts from a shape that doesn't need
manual deep-frees.
3. 'body: undefined' on cap exceedance: doc was wrong, undefined
isn't valid JSON. v1's actual behaviour: body is set to JSON
null when the body fails to parse, is empty, or was truncated
by the host's max_body_bytes cap. body_raw always carries the
raw (capped) bytes. Doc now states this explicitly and shows
how Rego-style policies can branch on body_raw == '' vs
body == null to distinguish 'no body' from 'non-JSON body'.
Input shape section now splits v1 (body-only) from v2 (body plus
request snapshot) so existing 'allow' rules are visibly unaffected.
0 commit comments