Skip to content

Conformance Examples 0.1.0 — Partials: torture-adversarial-recursion

direct-partial-self-recursion-soft-fails

A partial whose body invokes itself unconditionally, with no data-driven stopping condition, renders exactly maxPartialDepth (8) levels before soft-failing once with RecursionLimit and stopping — proving unbounded self-recursion degrades gracefully rather than overflowing the call stack.

Template

{{> node }}

Partials

node:

X{{> node }}

Output

XXXXXXXX

mutual-partial-recursion-soft-fails

Two partials (a, b) recurse into each other unconditionally (a -> b -> a -> ...) with maxPartialDepth 5. The limit counts total nesting depth across both names, not per-name, so it soft-fails once after exactly 5 levels (A,B,A,B,A) and stops.

Template

{{> a }}

Partials

a:

A{{> b }}

b:

B{{> a }}

Output

ABABA

recursion-just-under-limit-succeeds

A self-recursive partial chain that terminates naturally (its data's 'child' is present but false at the last node, so the recursive arm never fires) reaches exactly maxPartialDepth (4) invocations and completes normally with no RecursionLimit soft-fail — the boundary complement to the two soft-failing cases above.

Template

{{> node }}

Context

{
    "name": "1",
    "child": {
        "name": "2",
        "child": {
            "name": "3",
            "child": {
                "name": "4",
                "child": false
            }
        }
    }
}

Partials

node:

{{ name }}{{#if child }}{{#with child }}{{> node }}{{/with}}{{/if}}

Output

1234

self-referential-inline-partial-soft-fails-at-the-recursion-ceiling

An inline partial whose own body invokes itself is bound by the same maxPartialDepth guard as a loaded partial: it renders nothing (the outermost invocation never completes a body before the ceiling is hit) and soft-fails once with RecursionLimit.

Template

{{#inline loop }}{{> loop }}{{/inline}}{{> loop }}

Partials

Output


Source fixture: partials/torture-adversarial-recursion.json