| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- {
- "name": "nested-loop-sees-outer-item",
- "description": "A node inside a nested loop must still be able to reference the OUTER loop's item. Reproduces the Email OCR failure of 2026-09-04: build_email sits in a loop over one email's attachments, nested in a loop over emails, and {{email.from}} resolved to empty - so the reply was addressed to nobody and the send failed with \"At least one recipient is required\". The inner loop deliberately uses a different item variable name, and the assertion checks both are visible at once.",
- "nodes": [
- {
- "id": "n1",
- "name": "Trigger",
- "type": "click-trigger",
- "position": {
- "x": 0,
- "y": 0
- },
- "config": {}
- },
- {
- "id": "seed",
- "name": "Seed",
- "type": "code",
- "position": {
- "x": 0,
- "y": 100
- },
- "config": {
- "code": "return { mails: [{ from: 'a@example.com', parts: ['p1', 'p2'] }] };"
- }
- },
- {
- "id": "outer",
- "name": "Outer",
- "type": "loop",
- "position": {
- "x": 0,
- "y": 200
- },
- "config": {
- "inputField": "result.mails",
- "itemVariableName": "email",
- "continueOnError": false
- }
- },
- {
- "id": "inner",
- "name": "Inner",
- "type": "loop",
- "position": {
- "x": 240,
- "y": 200
- },
- "config": {
- "inputField": "data.parts",
- "itemVariableName": "part",
- "continueOnError": false
- }
- },
- {
- "id": "build",
- "name": "Build",
- "type": "set-fields",
- "position": {
- "x": 480,
- "y": 200
- },
- "config": {
- "mode": "only-set",
- "fields": [
- {
- "name": "outerFrom",
- "value": "{{email.from}}"
- },
- {
- "name": "innerPart",
- "value": "{{part}}"
- }
- ]
- }
- },
- {
- "id": "after",
- "name": "After",
- "type": "set-fields",
- "position": {
- "x": 240,
- "y": 340
- },
- "config": {
- "mode": "only-set",
- "fields": [
- {
- "name": "done",
- "value": "yes"
- }
- ]
- }
- }
- ],
- "connections": [
- {
- "sourceNodeId": "n1",
- "sourceOutput": "main",
- "targetNodeId": "seed",
- "targetInput": "data"
- },
- {
- "sourceNodeId": "seed",
- "sourceOutput": "main",
- "targetNodeId": "outer",
- "targetInput": "data"
- },
- {
- "sourceNodeId": "outer",
- "sourceOutput": "loop",
- "targetNodeId": "inner",
- "targetInput": "data"
- },
- {
- "sourceNodeId": "inner",
- "sourceOutput": "loop",
- "targetNodeId": "build",
- "targetInput": "data"
- },
- {
- "sourceNodeId": "outer",
- "sourceOutput": "done",
- "targetNodeId": "after",
- "targetInput": "data"
- }
- ],
- "expect": {
- "build": {
- "status": "completed",
- "output": {
- "outerFrom": "a@example.com",
- "innerPart": "p2"
- }
- }
- }
- }
|