{
  "slug": "formula-change",
  "status": "recorded",
  "recordedAt": "2026-12-04T13:05:11.385Z",
  "synthetic": true,
  "machine": {
    "model": "MacBookPro18,2",
    "cpuCount": 10,
    "cpu": "Apple M1 Max",
    "loadAverage": {
      "one": 23.15,
      "five": 31.62,
      "fifteen": 77.78
    },
    "loadNote": "load average 23.15 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, author grant to register, read and diff)",
  "kernels": [
    {
      "path": "scripts/case-evidence/kernels/formula.mjs",
      "moduleId": "case-formula",
      "digest": "sha256:b62905e922d672895e8f87d2588802a5633d5208a20451bac7050a21af280b7b",
      "operations": [
        "module.case-formula.change-midpoint",
        "module.case-formula.change-sum",
        "module.case-formula.volatility"
      ]
    }
  ],
  "programs": [
    {
      "name": "rates.volatility-report",
      "version": "1.0.0",
      "componentRef": "component:bf66452422aa3cdc781d3464beaca8f19107a5b7860a5a567467b84e12d0fde0",
      "visibility": "registered in a local engine scope; not published"
    },
    {
      "name": "rates.volatility-report",
      "version": "2.0.0",
      "componentRef": "component:10cbc65562b1588c19e50d60e81df563e57bd71a9b0938858636b0f9d9c4688c",
      "visibility": "registered in a local engine scope; not published"
    }
  ],
  "formulas": {
    "v1": "(new - old) / ((new + old) / 2)",
    "v2": "(new - old) / (new + old)",
    "volatility": "sample standard deviation (n - 1) of the daily relative changes"
  },
  "input": {
    "rows": 1001,
    "synthetic": true,
    "seed": 4100,
    "generator": "mulberry32 (scripts/case-evidence/lib.mjs seeded()), Box-Muller for normal draws",
    "description": "1001 made-up daily rates starting at 1.0850, a multiplicative random walk with 0.4% daily standard deviation, rounded to 4 decimals (1000 daily changes)"
  },
  "runs": [
    {
      "label": "Formula v1 (midpoint denominator)",
      "program": "rates.volatility-report@1.0.0",
      "status": "succeeded",
      "ms": 42.1,
      "headDigest": "sha256:05c793db59de079409e57cc14180bfbb51c016387b62159e41a1ec8308f9b145",
      "headDigestShort": "05c793db59de",
      "outputDigest": "sha256:ffbdd99ce7172b5ff9e6af64637a4dab40e70f54e715d8809ea46bad5efb2c7b",
      "outputDigestShort": "ffbdd99ce717",
      "summary": {
        "mean": -1.8418408320201454e-7,
        "n": 1000,
        "volatility": 0.0040630849762496105
      }
    },
    {
      "label": "Formula v2 (sum denominator)",
      "program": "rates.volatility-report@2.0.0",
      "status": "succeeded",
      "ms": 32.6,
      "headDigest": "sha256:34f7cdce30034d6b7a3e5d7512566f08d49a285137c81c8f2d5fb32d32c26eef",
      "headDigestShort": "34f7cdce3003",
      "outputDigest": "sha256:c047bda23bf700378fe3e08a7b0412ec20d22de67475781038c2143dfdde8491",
      "outputDigestShort": "c047bda23bf7",
      "summary": {
        "mean": -9.209204160100727e-8,
        "n": 1000,
        "volatility": 0.0020315424881248052
      }
    }
  ],
  "result": {
    "volatilityV1": 0.0040630849762496105,
    "volatilityV2": 0.0020315424881248052,
    "ratioV2toV1": 0.5,
    "ratioComputedBy": "capture script (one division of the two engine outputs)",
    "expectedRatio": 0.5,
    "differenceFromHalf": 0
  },
  "replay": {
    "reexecuted": true,
    "by": "engine",
    "digestMatched": true,
    "runs": [
      {
        "label": "v1",
        "program": "rates.volatility-report@1.0.0",
        "taskId": "series-v1",
        "reexecuted": true,
        "by": "engine",
        "digestMatched": true,
        "verifiedRetainedHistory": true,
        "originalOutputDigest": "sha256:ffbdd99ce7172b5ff9e6af64637a4dab40e70f54e715d8809ea46bad5efb2c7b",
        "reexecutedOutputDigest": "sha256:ffbdd99ce7172b5ff9e6af64637a4dab40e70f54e715d8809ea46bad5efb2c7b",
        "modules": [
          {
            "moduleId": "case-formula",
            "digest": "sha256:b62905e922d672895e8f87d2588802a5633d5208a20451bac7050a21af280b7b",
            "verified": true
          }
        ],
        "carriedContent": 0,
        "ms": 76.3
      },
      {
        "label": "v2",
        "program": "rates.volatility-report@2.0.0",
        "taskId": "series-v2",
        "reexecuted": true,
        "by": "engine",
        "digestMatched": true,
        "verifiedRetainedHistory": true,
        "originalOutputDigest": "sha256:c047bda23bf700378fe3e08a7b0412ec20d22de67475781038c2143dfdde8491",
        "reexecutedOutputDigest": "sha256:c047bda23bf700378fe3e08a7b0412ec20d22de67475781038c2143dfdde8491",
        "modules": [
          {
            "moduleId": "case-formula",
            "digest": "sha256:b62905e922d672895e8f87d2588802a5633d5208a20451bac7050a21af280b7b",
            "verified": true
          }
        ],
        "carriedContent": 0,
        "ms": 58.7
      }
    ]
  },
  "comparison": {
    "from": "rates.volatility-report@1.0.0",
    "to": "rates.volatility-report@2.0.0",
    "engineDiff": {
      "fromRef": "component:bf66452422aa3cdc781d3464beaca8f19107a5b7860a5a567467b84e12d0fde0",
      "toRef": "component:10cbc65562b1588c19e50d60e81df563e57bd71a9b0938858636b0f9d9c4688c",
      "inputChanges": {
        "added": [],
        "removed": [],
        "modified": []
      },
      "outputChanges": {
        "added": [],
        "removed": [],
        "modified": []
      },
      "stepDiff": {
        "added": [],
        "removed": [],
        "modified": [
          "change"
        ]
      },
      "contractBreaking": false
    },
    "changed": [
      "step changed (engine diff stepDiff.modified): change",
      "steps added: none; removed: none",
      "inputs and outputs unchanged (contractBreaking: false)",
      "the changed step now uses a different component: rates.relative-change@1.0.0 (component:0962f3b2c469c520b70f228ea4c3524ba2dcc663eefaf331f451f9667388fc11) -> rates.relative-change@2.0.0 (component:e34c2d6359b06b23facf4a9c9bd006d2df8de8048f49090c0362360a099c9d5e) (read from program.get and program.describe as author)"
    ],
    "changedStepComponents": {
      "v1": "rates.relative-change@1.0.0 (component:0962f3b2c469c520b70f228ea4c3524ba2dcc663eefaf331f451f9667388fc11)",
      "v2": "rates.relative-change@2.0.0 (component:e34c2d6359b06b23facf4a9c9bd006d2df8de8048f49090c0362360a099c9d5e)"
    }
  },
  "checks": [
    {
      "name": "both runs succeeded and verified",
      "passed": true,
      "detail": "succeeded, succeeded"
    },
    {
      "name": "output fingerprints differ between v1 and v2",
      "passed": true,
      "detail": "ffbdd99ce717 vs c047bda23bf7"
    },
    {
      "name": "diff names only the change step",
      "passed": true,
      "detail": "{\"added\":[],\"removed\":[],\"modified\":[\"change\"]}"
    },
    {
      "name": "engine replay re-executed each run to the same output digest",
      "passed": true,
      "detail": "v1 ffbdd99ce717 vs ffbdd99ce717, v2 c047bda23bf7 vs c047bda23bf7"
    },
    {
      "name": "volatility ratio is exactly 0.5 in floating point",
      "passed": true,
      "detail": "0.5"
    }
  ],
  "notes": [
    "Both formulas and the volatility step are a small JavaScript kernel that the engine loads only at the fingerprint of its exact bytes; the engine runs and records it but does not prove it correct.",
    "The ratio of the two volatilities is one division done by the capture script on the two engine results.",
    "In exact arithmetic the ratio is one half; the recorded ratio is what computer arithmetic gave, shown unrounded.",
    "The engine replayed both runs from scratch on its own and got the same result fingerprints.",
    "Times are wall-clock on a shared Mac (load average 23.15 on 10 cores at the start)."
  ],
  "detail": [
    "The kernel is scripts/case-evidence/kernels/formula.mjs, loaded with the engine's loadProgramModule at the SHA-256 recorded in kernels[]; its steps run as pure steps of programs registered through ProgramSurface.",
    "v1 divides the change by the midpoint (new + old) / 2, v2 by the sum new + old, so every v2 change is exactly half the v1 change. The engine's program.diff names the changed step; program.get and program.describe (author grant) name the component it now uses.",
    "replay.runs[] is the engine's program.replay with reexecute:true for each version: it verifies the retained history, re-reads the kernel module and checks it against the recorded digest, runs the program again in a fresh in-memory engine and compares output digests.",
    "headDigest fingerprints one run's retained history and includes when it ran; outputDigest is the engine's canonical digest of the outputs, which replay compares.",
    "Times are milliseconds measured with performance.now() around each engine call."
  ]
}
