Expand description
The plugin sandbox: run plugins against a synthetic Context.
Two modes, both producing the same Trace shape a live
request produces — so the UI viewer, the diff, and the redaction tests are
written once and serve both:
- ad-hoc nodes — a list of plugin nodes run in order, for testing one plugin (or a handful) in isolation;
- named policy — a configured policy replayed against a synthetic request, for testing a whole pipeline.
Ad-hoc mode does not get its own executor. It synthesises a
PolicyConfig — prepending a listener and appending a client, which
validate_policy requires — and reuses
compile_policy. One executor means a
sandbox run can never diverge from what the gateway really does.
Structs§
- Response
Input - Optional seed for
Context.response, so response-phase plugins (response-rewrite, the loggers) have something to act on. - Sandbox
Context Input - A synthetic context. Every field is optional: posting
{}yields a validGET /run. - Sandbox
Request - A sandbox request: exactly one of
nodesorpolicy.
Enums§
- OnError
- What to do when an ad-hoc node fails.
- String
OrList - A header/query value given as either a bare string or a list.
Functions§
- body_
text 🔒 - Extracts replayable body text: a plain string, or a snapshot body object’s
textfield.Nonefor a binary or uncaptured body. - materialize_
context - Turns a sandbox
contextvalue — flat or the nested trace-snapshot shape — into aContext. - normalize_
context 🔒 - Flattens the nested trace-snapshot shape into the flat input shape. A value that is already flat passes through essentially unchanged.
- synthesize_
policy - Synthesises a runnable policy from an ad-hoc node list.