{
  "slug": "ledger",
  "status": "recorded",
  "recordedAt": "2026-12-04T13:05:29.047Z",
  "synthetic": true,
  "machine": {
    "model": "MacBookPro18,2",
    "cpuCount": 10,
    "cpu": "Apple M1 Max",
    "loadAverage": {
      "one": 21.42,
      "five": 30.82,
      "fifteen": 76.69
    },
    "loadNote": "load average 21.42 on 10 cores when the capture started: more work was waiting than there were cores, so times are slower than on an idle machine"
  },
  "engine": {
    "repository": "hopperlabs-ai-engines/hopper-engines-graph-computer",
    "commit": "5bf4d08bbf04210afa23a00271efd361310e835c",
    "workingTreeNote": "6 uncommitted path(s) in the checkout at capture time (not imported by this script unless listed in imports): M experiments/hopper-dag/bench/temporal/hopper-server.mjs; M experiments/hopper-dag/src/orchestration/durable/activities.mjs; M experiments/hopper-dag/src/orchestration/durable/operations.mjs; M experiments/hopper-dag/src/orchestration/durable/visibility.mjs; M experiments/hopper-dag/test/durable-engine.test.mjs; M experiments/hopper-dag/test/durable-leases.test.mjs",
    "imports": [
      "src/computer.mjs",
      "src/program-surface.mjs",
      "src/program-modules.mjs",
      "src/dependencies.mjs"
    ]
  },
  "via": "engine directly (ProgramSurface from src/program-surface.mjs)",
  "reusedProgram": {
    "repository": "hopperlabs-ai-dev/hopper-graph-computer-programs",
    "commit": "a704ccee5bcc97205eaa59b1aeb7d324aa074312",
    "workingTreeNote": "10 uncommitted path(s) elsewhere in that checkout; the kernel file is loaded only at the digest its manifest pins",
    "program": "business-books@0.2.2",
    "kernel": {
      "path": "runtime/business-books/kernels.mjs",
      "pinnedDigest": "sha256:bd788a910c368afe2082ab8e9bf0b313e0b4808bc5139726e964241520d208d2",
      "loadedDigest": "sha256:bd788a910c368afe2082ab8e9bf0b313e0b4808bc5139726e964241520d208d2",
      "operationUsed": "plan"
    },
    "whatWasNotRun": "the program's owner jobs (Stripe, Plaid, Ledger Engine, Workpapers and tax reads and changes) and its report step; only its pure plan kernel ran, on supplied records"
  },
  "kernels": [
    {
      "path": "runtime/business-books/kernels.mjs",
      "repository": "hopperlabs-ai-dev/hopper-graph-computer-programs",
      "moduleId": "business-books",
      "digest": "sha256:bd788a910c368afe2082ab8e9bf0b313e0b4808bc5139726e964241520d208d2",
      "operations": [
        "module.business-books.plan",
        "module.business-books.report"
      ]
    },
    {
      "path": "scripts/case-evidence/kernels/ledger.mjs",
      "moduleId": "case-ledger",
      "digest": "sha256:1750b5c1f7606dc2f09db1bd90a17f3ef3481470ad806d7935a69d76a2d684c2",
      "operations": [
        "module.case-ledger.assign"
      ]
    }
  ],
  "programs": [
    {
      "name": "ledger.quarter-payouts",
      "version": "1.0.0",
      "componentRef": "component:4399fb59d03a72289ae0cf0a1baf97dc7df3c3995f38e4a9e22a999f0909d6fc",
      "visibility": "registered in a local engine scope; not published"
    }
  ],
  "input": {
    "rows": 5156,
    "charges": 5057,
    "refunds": 99,
    "payouts": 87,
    "bankDeposits": 86,
    "quarter": "2026-01-01 to 2026-03-31",
    "synthetic": true,
    "seed": 20260331,
    "generator": "mulberry32 (scripts/case-evidence/lib.mjs seeded()), Box-Muller for normal draws",
    "description": "5,156 made-up Stripe-shaped balance transactions (5057 charges with a 2.9% + 30c fee each, 99 full refunds) over 86 days, one payout per day arriving two days later, and Plaid-shaped bank deposits. Built in: on 2026-02-10 a second payout with the same transaction amounts, so two payouts and two deposits share amount and date; the payout of 2026-03-05 has no bank deposit."
  },
  "runs": [
    {
      "label": "Quarter of payouts matched to deposits",
      "program": "ledger.quarter-payouts@1.0.0",
      "status": "succeeded",
      "ms": 417.1,
      "headDigest": "sha256:1fed8956de9c492a700e3df7b37b9b4de45a9dad14466aa893a7a8fed03b7c7f",
      "headDigestShort": "1fed8956de9c",
      "outputDigest": "sha256:945a3b7a088cdfda344eaeda1ac74e491b50f74e64d1584ed62da43fa8217726",
      "outputDigestShort": "945a3b7a088c",
      "summary": {
        "transactionsIn": 5156,
        "assignedToExactlyOnePayout": 5156,
        "unassigned": 0,
        "payoutsWhoseAmountEqualsNetOfTransactions": 87,
        "payouts": 87,
        "transactionsInJournalEntries": 5156,
        "distinctTransactionsInJournalEntries": 5156,
        "journalEntries": 3,
        "payoutResults": {
          "matched": 84,
          "ambiguous": 2,
          "not-in-bank": 1
        },
        "unmatchedDeposits": 2,
        "engineCounts": {
          "depositsWithoutPayout": 2,
          "inTransit": 0,
          "matched": 84,
          "notInBank": 3,
          "payouts": 87
        },
        "paidCents": 41993821,
        "depositedCents": 41476599,
        "aggregateResult": "differs",
        "matchingResult": "exceptions",
        "tieoutWithheld": null
      }
    }
  ],
  "exceptions": {
    "missingDeposit": [
      {
        "payout": "po_20260305",
        "arrival": "2026-03-07",
        "amountCents": 517222,
        "result": "not-in-bank"
      }
    ],
    "sentToReview": [
      {
        "payout": "po_20260210",
        "arrival": "2026-02-12",
        "amountCents": 513810,
        "result": "ambiguous"
      },
      {
        "payout": "po_20260210_b",
        "arrival": "2026-02-12",
        "amountCents": 513810,
        "result": "ambiguous"
      }
    ],
    "depositsWithoutPayout": [
      {
        "amountCents": 513810,
        "date": "2026-02-12",
        "result": "deposit-without-payout",
        "transactionId": "bank_0041"
      },
      {
        "amountCents": 513810,
        "date": "2026-02-12",
        "result": "deposit-without-payout",
        "transactionId": "bank_0042"
      }
    ]
  },
  "replay": {
    "reexecuted": true,
    "by": "engine",
    "digestMatched": true,
    "verifiedRetainedHistory": true,
    "originalOutputDigest": "sha256:945a3b7a088cdfda344eaeda1ac74e491b50f74e64d1584ed62da43fa8217726",
    "reexecutedOutputDigest": "sha256:945a3b7a088cdfda344eaeda1ac74e491b50f74e64d1584ed62da43fa8217726",
    "modules": [
      {
        "moduleId": "case-ledger",
        "digest": "sha256:1750b5c1f7606dc2f09db1bd90a17f3ef3481470ad806d7935a69d76a2d684c2",
        "verified": true
      },
      {
        "moduleId": "business-books",
        "digest": "sha256:bd788a910c368afe2082ab8e9bf0b313e0b4808bc5139726e964241520d208d2",
        "verified": true
      }
    ],
    "carriedContent": 0,
    "ms": 533.4,
    "program": "ledger.quarter-payouts@1.0.0",
    "taskId": "q1-2026"
  },
  "checks": [
    {
      "name": "run succeeded and verified",
      "passed": true,
      "detail": "succeeded"
    },
    {
      "name": "every transaction assigned to exactly one payout",
      "passed": true,
      "detail": "5156 of 5156"
    },
    {
      "name": "every payout equals the net of its transactions",
      "passed": true,
      "detail": "87 of 87"
    },
    {
      "name": "transactions in = transactions in the journal entries, each once",
      "passed": true,
      "detail": "5156 in, 5156 in entries, 5156 distinct"
    },
    {
      "name": "payouts in = payouts accounted for (matched + review + missing)",
      "passed": true,
      "detail": "matched 84, ambiguous 2, not-in-bank 1"
    },
    {
      "name": "same-amount same-day payouts sent to review, not matched",
      "passed": true,
      "detail": "po_20260210, po_20260210_b"
    },
    {
      "name": "missing deposit named",
      "passed": true,
      "detail": "po_20260305"
    },
    {
      "name": "engine replay re-executed the run to the same output digest",
      "passed": true,
      "detail": "945a3b7a088c vs 945a3b7a088c"
    }
  ],
  "notes": [
    "Payouts were matched to bank deposits by the real matching code of our books program, which the engine loads only at the fingerprint its manifest pins; the engine runs and records it but does not prove it correct.",
    "A payout is matched only when exactly one deposit has the same amount and date; the two look-alike payouts and the missing deposit were planted in the made-up data on purpose, and the run found them.",
    "Nothing was sent to Stripe, a bank or the books.",
    "The engine replayed the run from scratch on its own and got the same result fingerprint.",
    "Times are wall-clock on a shared Mac (load average 21.42 on 10 cores at the start)."
  ],
  "detail": [
    "The matcher is the business-books plan kernel from hopperlabs-ai-dev/hopper-graph-computer-programs (runtime/business-books/kernels.mjs), loaded with the engine's loadProgramModule at the digest the program's manifest pins (bd788a910c36). It requires one paid payout and one deposit with the same amount and arrival date, unique on both sides; input order never resolves a tie.",
    "The check that every transaction belongs to exactly one payout and that each payout equals the net of its transactions is a small kernel written for this capture (scripts/case-evidence/kernels/ledger.mjs), run by the engine as a pure step beside the plan step. The business-books kernel does not assign transactions to payouts.",
    "The tally counts (transactions in the journal entries, payout results by kind) were counted by the capture script from the engine run's outputs. The plan kernel also prepares a tax-estimate request; it was not sent, and the bundle id in the settings is a placeholder for it. The program's owner jobs and report step were not run.",
    "Not the \"payout close\" demo on the site: that one (runtime/business-books/payout-close.mjs) matches deposits by explicit payout reference. This capture uses the amount-and-date matcher from the same repository.",
    "replay is the engine's program.replay with reexecute:true: it verifies the retained history, re-reads both kernel modules and checks them against their recorded digests, runs the program again in a fresh in-memory engine and compares output digests. headDigest fingerprints one run's retained history (it includes when it ran); outputDigest fingerprints the outputs. Times are milliseconds measured with performance.now()."
  ]
}
