# Algorithmic-complexity (DoS) probe.
#
# The request body is a generated adversarial payload whose depth is the swept
# `depth` axis (exported to the run as LOADR_SWEEP_DEPTH). Run it under
# `loadr sweep` with `--complexity depth` to fit response-time vs depth and
# `--max-exponent 1.2` to fail CI when a parser scales worse than quasilinear:
#
#   loadr sweep examples/49-payload-complexity.yaml \
#     --var depth=4000,8000,16000,32000,64000 \
#     --complexity depth --max-exponent 1.2
#
# See `loadr payload --list` for every payload kind.
name: payload-complexity-probe
description: scale a nested-markdown payload and fit the target's complexity exponent

defaults:
  http:
    base_url: http://localhost:3001

scenarios:
  render:
    executor: per-vu-iterations
    vus: 1
    iterations: 4
    flow:
      - request:
          name: render
          method: POST
          url: /api/v1/markup
          headers: { Content-Type: application/json }
          # ${payload:<kind>:$ENVVAR} — depth comes from the swept axis.
          body: '{"Text": "${payload:nested-markdown-blockquote:$LOADR_SWEEP_DEPTH}", "Mode": "markdown", "Context": "x/y"}'
          checks: [ { type: status, equals: 200 } ]
