{
  "schemaVersion": 1,
  "verifiedOn": "2026-09-07",
  "data": "Synthetic records only. No external requests or billing writes.",
  "workflowSha256LF": "45684e6e3d7e3dd466d2c9c29aadcab907b56881e3c34de95d899f6bab53b81d",
  "runtimeCheck": {
    "version": "n8n 2.37.10",
    "verifiedOn": "2026-09-07",
    "environment": "Windows CLI, clean local SQLite state, JavaScript task runner",
    "scope": "Built-in two-record manual sample only",
    "source": "docs/n8n-template-validation-2026-09-07.json",
    "slug": "invoice-review-gate",
    "status": "success",
    "lastNode": "Validate for review",
    "sha256LF": "45684e6e3d7e3dd466d2c9c29aadcab907b56881e3c34de95d899f6bab53b81d",
    "sampleOutput": [
      {
        "dealId": "D-104",
        "status": "ready_for_review",
        "reasons": [],
        "calculatedTotalMinor": 250000,
        "draft": {
          "sourceKey": "[\"D-104\",1]",
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "totalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      },
      {
        "dealId": "D-105",
        "status": "needs_review",
        "reasons": [
          "Line total does not match approved total"
        ],
        "calculatedTotalMinor": 170000
      }
    ]
  },
  "logicCheck": {
    "runtime": "Node.js VM executing the downloaded Code-node source",
    "scope": "Eight fixtures and two independent replays. No cross-execution state."
  },
  "fixtures": [
    {
      "name": "approved record",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "ready_for_review",
          "reasons": [],
          "calculatedTotalMinor": 250000,
          "draft": {
            "sourceKey": "[\"D-104\",1]",
            "customerReference": "customer-demo-01",
            "currency": "USD",
            "totalMinor": 250000,
            "lineItems": [
              {
                "description": "Synthetic implementation milestone",
                "quantity": 1,
                "unitAmountMinor": 250000
              }
            ]
          }
        }
      ]
    },
    {
      "name": "amount mismatch",
      "input": [
        {
          "dealId": "D-105",
          "billingVersion": 1,
          "customerReference": "customer-demo-02",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 175000,
          "lineItems": [
            {
              "description": "Synthetic mismatch example",
              "quantity": 1,
              "unitAmountMinor": 170000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-105",
          "status": "needs_review",
          "reasons": [
            "Line total does not match approved total"
          ],
          "calculatedTotalMinor": 170000
        }
      ]
    },
    {
      "name": "approval absent",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "Commercial approval is required"
          ],
          "calculatedTotalMinor": 250000
        }
      ]
    },
    {
      "name": "duplicate key in one batch",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        },
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "Duplicate deal/version in this batch"
          ],
          "calculatedTotalMinor": 250000
        },
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "Duplicate deal/version in this batch"
          ],
          "calculatedTotalMinor": 250000
        }
      ]
    },
    {
      "name": "distinct billing versions",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        },
        {
          "dealId": "D-104",
          "billingVersion": 2,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "ready_for_review",
          "reasons": [],
          "calculatedTotalMinor": 250000,
          "draft": {
            "sourceKey": "[\"D-104\",1]",
            "customerReference": "customer-demo-01",
            "currency": "USD",
            "totalMinor": 250000,
            "lineItems": [
              {
                "description": "Synthetic implementation milestone",
                "quantity": 1,
                "unitAmountMinor": 250000
              }
            ]
          }
        },
        {
          "dealId": "D-104",
          "status": "ready_for_review",
          "reasons": [],
          "calculatedTotalMinor": 250000,
          "draft": {
            "sourceKey": "[\"D-104\",2]",
            "customerReference": "customer-demo-01",
            "currency": "USD",
            "totalMinor": 250000,
            "lineItems": [
              {
                "description": "Synthetic implementation milestone",
                "quantity": 1,
                "unitAmountMinor": 250000
              }
            ]
          }
        }
      ]
    },
    {
      "name": "unsupported currency",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "EUR",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "This example supports USD only"
          ],
          "calculatedTotalMinor": 250000
        }
      ]
    },
    {
      "name": "decimal minor units",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000.5
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "Invalid line description, quantity, or unit amount",
            "Line total does not match approved total"
          ],
          "calculatedTotalMinor": 0
        }
      ]
    },
    {
      "name": "customer reference absent",
      "input": [
        {
          "dealId": "D-104",
          "billingVersion": 1,
          "currency": "USD",
          "approved": true,
          "approvedTotalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      ],
      "expected": [
        {
          "dealId": "D-104",
          "status": "needs_review",
          "reasons": [
            "Missing billing customer reference"
          ],
          "calculatedTotalMinor": 250000
        }
      ]
    }
  ],
  "replay": {
    "name": "independent replay demonstrates no persistent duplicate protection",
    "input": [
      {
        "dealId": "D-104",
        "billingVersion": 1,
        "customerReference": "customer-demo-01",
        "currency": "USD",
        "approved": true,
        "approvedTotalMinor": 250000,
        "lineItems": [
          {
            "description": "Synthetic implementation milestone",
            "quantity": 1,
            "unitAmountMinor": 250000
          }
        ]
      }
    ],
    "expectedEachRun": [
      {
        "dealId": "D-104",
        "status": "ready_for_review",
        "reasons": [],
        "calculatedTotalMinor": 250000,
        "draft": {
          "sourceKey": "[\"D-104\",1]",
          "customerReference": "customer-demo-01",
          "currency": "USD",
          "totalMinor": 250000,
          "lineItems": [
            {
              "description": "Synthetic implementation milestone",
              "quantity": 1,
              "unitAmountMinor": 250000
            }
          ]
        }
      }
    ],
    "runs": 2
  }
}
