Skip to main content

materialize_context

Function materialize_context 

Source
pub fn materialize_context(raw: Value) -> Result<Context, String>
Expand description

Turns a sandbox context value — flat or the nested trace-snapshot shape — into a Context.

A context copied from GET /api/debug/traces/{id} (a step’s after, or the trace’s initial) is nested (request/response objects, bodies as {len, text, …} objects) and carries display-only fields (errors, body len/truncated/binary). This flattens that into the flat input shape before deserialising, so pasting a trace context “just works”.

Note: snapshots are redacted — a header shown as <redacted> replays literally as that string, and a truncated or binary body cannot be reconstructed. The sandbox replays what the trace could show, not the original secret bytes.