{
  "tool_id": "art-684-intercompany-elimination-netting",
  "note": "worked example (parity pin 2ef81e5259e39f897169eaeb311de0ae3b15bb4fdfa94d7160cf3642aadd4eb4 from INTERCOMPANY-ELIM-BUILD-SPEC.md), the opposite-verdict vector (ALL_MATCHED, exercising the 2dp half-up rounding declaration at 100.005 vs 100.01), and two fail-closed refusal paths (empty pairs array, negative payable amount). human_sign_off: PENDING.",
  "vectors": [
    {
      "name": "worked_example_parity",
      "policy_parameters": {
        "pairs": [
          {
            "a": "SUB-1",
            "b": "SUB-2",
            "a_receivable": 50000,
            "b_payable": 50000
          },
          {
            "a": "SUB-1",
            "b": "SUB-3",
            "a_receivable": 20000,
            "b_payable": 18000
          }
        ]
      },
      "output_payload": {
        "matched_pairs": 1,
        "mismatched_pairs": 1,
        "elimination_total": 68000,
        "unmatched_residual": 2000,
        "mismatches": [
          {
            "a": "SUB-1",
            "b": "SUB-3",
            "difference": 2000
          }
        ],
        "trace": "eliminate min(20000,18000)=18000 + matched 50000 = 68000; residual 20000-18000=2000",
        "overall": "GAPS_FOUND"
      },
      "golden_hash": "2ef81e5259e39f897169eaeb311de0ae3b15bb4fdfa94d7160cf3642aadd4eb4"
    },
    {
      "name": "opposite_verdict_all_matched_rounding",
      "policy_parameters": {
        "pairs": [
          {
            "a": "HOLD-OPS",
            "b": "HOLD-FIN",
            "a_receivable": 1250.5,
            "b_payable": 1250.5
          },
          {
            "a": "SUB-A",
            "b": "SUB-B",
            "a_receivable": 100.005,
            "b_payable": 100.01
          }
        ]
      },
      "output_payload": {
        "matched_pairs": 2,
        "mismatched_pairs": 0,
        "elimination_total": 1350.51,
        "unmatched_residual": 0,
        "mismatches": [],
        "trace": "eliminate matched 1250.5 + matched 100.01 = 1350.51; residual 0",
        "overall": "ALL_MATCHED"
      },
      "golden_hash": "c6f0f153e349655db26b7395da9f1309bbf02d26ab04d9d43cfe6b26608998a5"
    },
    {
      "name": "fail_closed_empty_pairs",
      "policy_parameters": {
        "pairs": []
      },
      "output_payload": {
        "matched_pairs": null,
        "mismatched_pairs": null,
        "elimination_total": null,
        "unmatched_residual": null,
        "mismatches": null,
        "trace": "fail-closed: pairs must be a non-empty array of declared entity pairs; no elimination arithmetic computed -- correct the named inputs and resubmit. Intercompany elimination and netting arithmetic over caller-declared synthetic inputs only: not legal advice, not an audit opinion, and not a settlement instruction.",
        "overall": null,
        "domain_errors": [
          "INVALID_PAIRS_REQUIRED"
        ]
      },
      "golden_hash": "56f5462788a401f47e97e2549c349e6c0513578274ec7d59afa3fef19b9e19fa"
    },
    {
      "name": "fail_closed_negative_amount",
      "policy_parameters": {
        "pairs": [
          {
            "a": "SUB-A",
            "b": "SUB-B",
            "a_receivable": 500,
            "b_payable": -5
          }
        ]
      },
      "output_payload": {
        "matched_pairs": null,
        "mismatched_pairs": null,
        "elimination_total": null,
        "unmatched_residual": null,
        "mismatches": null,
        "trace": "fail-closed: each pair needs finite, non-negative numbers a_receivable and b_payable; no elimination arithmetic computed -- correct the named inputs and resubmit. Intercompany elimination and netting arithmetic over caller-declared synthetic inputs only: not legal advice, not an audit opinion, and not a settlement instruction.",
        "overall": null,
        "domain_errors": [
          "INVALID_AMOUNT"
        ]
      },
      "golden_hash": "c73f7d0e16edaa3b578b67aab47287687d8b6ea0d6b3cd65458ae6854005be8a"
    }
  ]
}
