Skip to content

docs: profiles use-case guide — define behaviors, switch at runtime - #97

Merged
deblasis merged 2 commits into
mainfrom
docs/profiles-use-cases
Aug 23, 2026
Merged

docs: profiles use-case guide — define behaviors, switch at runtime#97
deblasis merged 2 commits into
mainfrom
docs/profiles-use-cases

Conversation

@deblasis

Copy link
Copy Markdown
Contributor

Why

Profiles are documented as a reference (schema, semantics) but not as a tool: the
README says what the knobs are, not what you build with them. This adds the use-case
guide the feature deserves — the scenarios that are hard or impossible to get from
real APIs on demand.

What — docs/profiles.md, six recipes

  1. Chaos testing at an exact ratechance: 30 under a fixed rng_seed: the
    same 4-of-12 failures every run, so retry/backoff tuning becomes a unit test.
  2. Revoked credentials on demand — one switch, every call 401s before the
    adapter's auth sees it; no waiting an hour for token expiry.
  3. The one broken customerwhen.expr on request.body.amount > 1000: the
    surgical failure shape real sandboxes never expose.
  4. Hanging vs slow dependenciesbehavior: timeout (circuit-breaker food) vs
    latency_ms-only slow-success (timeout budgets, SLA UX).
  5. Adapter-authored degraded modes — the sqs-style throttled pattern:
    profile_active() in the handler, including the state-backed-counter caveat.
  6. Flipping worlds between test cases — activate/deactivate around each test in
    CI, up --profile, the dashboard panel, --json.

Plus the fine print (precedence, WS/GraphQL, determinism, name resolution) and the
three shapes a profile can take up front.

Verification

  • Every YAML block assembles into one manifest that passes stunt plan (this caught
    a real drafting error: rule bundles shown under the top-level profiles: key —
    that's the preset namespace; they belong on the service).
  • Every transcript is real captured output: the 429 pattern under chance: 30,
    401 {"error":"invalid_api_key"}, the 201/402 expr split, 200 in 1.501475s,
    curl: (52) at the 700 ms hang, activated "throttled" on sqs.

Linked from the README's Profiles section and the Reference list.

docs/profiles.md, linked from the README profiles section: six verified
recipes for the scenarios real APIs won't give you on demand — chaos
testing at an exact rate (chance + rng_seed), revoked credentials as a
switch (pre-dispatch 401), the one broken customer (when.expr on the
request), hanging vs slow dependencies (behavior:timeout / latency_ms),
adapter-authored degraded modes (profile_active, sqs-style throttled),
and flipping worlds between test cases in CI.

Every YAML block assembles into a manifest that passes stunt plan; every
transcript is real output from a live run (429-pattern under chance:30,
401 invalid_api_key, 201/402 expr split, 200 in 1.50s, curl(52) hang at
700ms, 'activated "throttled" on sqs').
Healthy GET /v1/charges is 200 (201 is the POST create); the one-broken-
customer curls carry the auth header (without it the fall-through 401s,
not 201); preset fragment notes that every set: name must be a declared
service.
@deblasis
deblasis merged commit ceffbd9 into main Aug 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant