EXAMPLE / Execution

Stop a write before it runs

Trace a REST request through an approval gate and inspect the zero-handler-call denial assertion.

Test fixtureIntermediate
PATTERN EXPLORER

Follow the pattern. Inspect its limits.

Explore the source walkthrough, its evidence and the choices you would make in your own application.

RECORRIDO DEL CÓDIGO FUENTELeer la operación en el orden redactado
Choose a point to look closer
01 / Recorrido del código fuente

Declare the boundary

The fixture defines a command with execution.effects set to write and external-side-effect, and execution.approval.required set to true.

An exploration of the inspected source; no example is executed here.

1 / 4

The situation.

A synthetic rest.approval.protected command has write and external-side-effect declarations. The fixture sends a request first without approval evidence, then with a receipt bound to the operation and input.

What you will learn

  • Declare effect and approval requirements on an operation.
  • Pass receipt evidence through the transport adapter rather than changing operation input.
  • Check that a denial happens before the handler runs.

See the boundary first.

The homepage illustration makes the approval sequence visible. It is separate from the source fixture described here.

Open the interactive illustration →

Follow the operation.

  1. 01

    Declare the boundary

    The fixture defines a command with execution.effects set to write and external-side-effect, and execution.approval.required set to true.

  2. 02

    Inspect the denied request

    The first test binds a handler with a call counter. Without a receipt, it expects HTTP 403, APPROVAL_REQUIRED with reason missing_receipt, and calls equal to zero.

  3. 03

    Inspect the approved request

    The second test provides a receipt through createFetchHandler's approvalReceipt option and an approval port with a controlled clock. The response is expected to be 200 with value ran.

  4. 04

    Apply the pattern to your side effect

    Replace the synthetic handler with your operation and trusted receipt source. Add tests for the exact subject, operation, input, expiry, and effect requirements your application uses.

What the source demonstrates.

  • The inspected denial test asserts that the handler is not invoked when a required receipt is missing.
  • The approved case adapts receipt evidence outside the operation input.
  • The fixture has an inspectable positive and negative request path.

What it does not establish.

  • A fresh successful execution in this review.
  • An end-to-end human approval UI or trusted production receipt issuer.
  • A real external write: the approved handler only returns a fixture value.

Bring it into your environment.

Use the exact source context and prerequisites below. A source walkthrough is not a verified public-package installation recipe.

  • Access to the inspected source repository and a checkout at the cited revision.
  • The repository's Bun workspace dependencies and required generated package exports. These instructions were inspected; the examples were not executed in this review.

Directorio de trabajo: packages/platform/delivery/contracts-runtime-server-rest

PACKAGE-LOCAL COMMANDS
bun test src/rest-approval-enforcement.test.ts

The source assertions require a 403 denial before invocation and a 200 response for the controlled valid-receipt case.

Test source inspected; not executed here.

Read the related guide →

Make the pattern your own.

  • Use a trusted application boundary to resolve approval evidence.
  • Keep authorization and approval validation at execution time.
  • Preserve a negative test that measures whether the handler ran.
CONTEXTO DE LA FUENTE

Inspect the evidence.

Reviewed 2026-10-27 · b67c376f

Pinned source links require repository access; publication and anonymous package availability were not checked for this example.

Declared maturity
experimental fixture metadata
Catalogue registration
Library test; not an example catalog entry
Inline preview
None
Execution in this review
Not rerun
Production qualification
Not assessed
Tu vista

Make room for your context.

Shape the presentation around this moment. You can change it whenever you need.

Tu contexto

The different parts of you

Choose a starting point

Una mezcla útil de contexto, imágenes y orientación discreta.

Tune each dimension
Each dimension can change independently. Product permissions and available actions stay unchanged.

Support the way you begin and return

Tune your support

Comodidad de lectura

Elige tu idioma

El idioma de la interfaz solo cambia el texto. Los mercados, precios y flujos de trabajo conservan sus propios ajustes.

Cobertura de traducción

Parte del contenido se muestra en inglés.

Navegación151
Grafo616
Categorías188
Portafolio332
Ejemplos2035
Vista previa de la fuente41

Se añadirán más traducciones a medida que se revise el contenido.

Esta preferencia se guarda en este navegador.

Buscar en el sitio web

Puntos de partida útiles

Sin resultados. Prueba una frase más corta, un nombre de operación u otro ámbito de búsqueda.

UN POCO DE ESPACIO PARA EXPLORAR

Encuentra algo que explorar.

Abre una vista detallada en esta página, prueba otra perspectiva o sigue el detalle a su propia página.

Cómo funcionan las vistas previas y los controles
01

Mirar antes de salir

Pasa el cursor por un enlace o enfócalo con Tab para ver una vista previa. Hacer clic en el enlace original o pulsar Intro siempre abre su destino.

02

Mantener el contexto

Entra en la vista previa para explorar sus secciones. Usa Alt + ↓ desde un enlace enfocado para entrar con el teclado. Escape la cierra.

03

Abrir las posibilidades

Las filas desplegables, las perspectivas y los controles destacados revelan más. Tu vista cambia la comodidad de lectura y el contexto que exploras.

Un botón separado para mirar más de cerca

Muestra pequeños botones de vista previa junto a los enlaces donde haya espacio. Toca el ojo para inspeccionar o el enlace para ir directamente. Esta elección permanece en esta pestaña.

No se recoge historial de navegación. El movimiento reducido sigue tu dispositivo y Tu vista.