Yichus / Saved runs
This example changed — review before accepting
Yichus/Demo/SnapshotLedger::apply_changes
The compiled program ran with the saved inputs and a fresh in-memory database. This page compares its ordered IO receipts and result. It describes this example only; it does not prove every input or schedule is correct.
Inputs, seeded rows, and fixed clock
{
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
}Clock answer: 123
Machine-readable comparison
{
"artifactClass": "run-snapshot-comparison-1",
"scope": "this example and the interpreter's deterministic schedule only; not proof for all inputs",
"status": "changed",
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
},
"result": {
"saved": 22,
"current": 22
},
"ioCounts": {
"saved": {
"Yichus/Data::db_read": 3,
"Yichus/Data::db_write": 2
},
"current": {
"Yichus/Data::db_read": 3,
"Yichus/Data::db_write": 4
}
},
"ioSteps": {
"same": 5,
"changed": 0,
"removed": 0,
"inserted": 2
},
"firstIODifference": {
"step": "inserted",
"savedStep": null,
"currentStep": 3,
"saved": null,
"current": {
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 15
},
"result": 15
}
}
}What the program did
Read Write or allocate. Lines run in execution order. Steps are lined up by identical request and answer, so one inserted or removed step does not shift the rest; a pairing is a match of receipts, not of causes. Open a station for its exact request and answer.
| Step saved / current | Saved run | Current run |
|---|---|---|
| 1 / 1 same |
|
|
| 2 / 2 same |
|
|
| – / 3 inserted | No operation |
|
| 3 / 4 same |
|
|
| – / 5 inserted | No operation |
|
| 4 / 6 same |
|
|
| 5 / 7 same |
|
|
What it returned
Saved
22
Current
22
Full current record, including source and static facts
{
"schema": "yichus-run-snapshot-1",
"clock": 123,
"mocks": [],
"run": {
"ok": true,
"tool": "api_why",
"artifactClass": "why-run",
"schemaVersion": "why-run-1.0",
"sources": {
"hash": "537c8ec600d457a53e6e66b2e547234bcf2a58fff6816fff14453fea51d21e9e",
"files": [
{
"name": "ledger",
"sha256": "6dc83fd121acbb23a02581a74c9412eff3c9276ca3b66f87a99769c38690064b",
"content": "package Yichus/Demo/SnapshotLedger\n\nfrom Yichus/Data import Db, Table, table, db_read, db_write\nfrom Yichus/IO import IO, flat_map\n\nexport (apply_changes)\nexposes (Yichus/Data, Yichus/IO)\n\ndef balances(db: Db) -> Table[Int]:\n table(db, \"balances\")\n\ndef apply_changes(db: Db, changes: List[Int]) -> IO[Int]:\n recur changes:\n case []:\n db_read(balances(db), \"alice\")\n case [amount, *rest]:\n before <- flat_map(db_read(balances(db), \"alice\"))\n _ <- flat_map(db_write(balances(db), \"alice\", before.add(amount)))\n _ <- flat_map(db_write(balances(db), \"alice\", before.add(amount)))\n apply_changes(db, rest)\n"
}
]
},
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
},
"binding": {
"package": "Yichus/Demo/SnapshotLedger",
"name": "apply_changes",
"id": "Yichus/Demo/SnapshotLedger::apply_changes",
"type": "(Yichus/Data::Db, Bosatsu/Predef::List[Bosatsu/Predef::Int]) -> Yichus/IO::IO[Bosatsu/Predef::Int]",
"isIO": true,
"arity": 2
},
"seed": 41,
"inputs": [
{
"param": "db",
"type": "Yichus/Data::Db",
"shape": {
"kind": "enum",
"name": "Db",
"constructors": []
},
"origin": "world",
"json": null,
"rendered": null
},
{
"param": "changes",
"type": "Bosatsu/Predef::List[Bosatsu/Predef::Int]",
"shape": {
"kind": "list",
"elem": {
"kind": "int"
}
},
"origin": "provided",
"json": [
5,
7
],
"rendered": "[5, 7]"
}
],
"output": {
"type": "Bosatsu/Predef::Int",
"json": 22,
"jsonStatus": "encoded",
"rendered": "22"
},
"steps": {
"basis": "not evaluated: a handler's lets run inside its IO plan, so steps are shown for pure definitions only",
"items": []
},
"soundFacts": {
"basis": "sound-static (holds for every input)",
"paramInfluence": [
{
"param": "changes",
"kind": "return-data",
"sentence": "parameter 'changes' may reach the returned data (static dataflow; holds for every input); no observation can rule its influence out"
},
{
"param": "db",
"kind": "return-data",
"sentence": "parameter 'db' may reach the returned data (static dataflow; holds for every input); no observation can rule its influence out"
}
],
"deadInputs": [
"_a",
"_b"
],
"structFields": []
},
"observed": {
"basis": "bounded-observation (seed 41, one recorded handler run; 5 variations per aspect, each on a fresh world from the same seeded rows)",
"variation": "a provided Int varies near its value first (+10%, -10%, doubled, halved, zero); every other value is drawn from the seed",
"referenceBasis": "global-value-forcing",
"touched": [
"Yichus/Demo/SnapshotLedger::balances"
],
"differentials": [],
"notReached": {
"definitions": [],
"sentence": "global values were forced for every definition reachable from Yichus/Demo/SnapshotLedger::apply_changes statically on this input (seed 41); this does not establish that their function bodies ran; bounded observation, not proof"
}
},
"world": {
"shape": {
"tables": {
"balances": {
"rowType": "Int",
"rowForm": "record: the row under an id is one record (a JSON object)",
"rowIsList": false,
"recordFields": {},
"recordShape": {
"kind": "int"
}
}
},
"rowKey": "rows are {table: {id: row}} (or {table: [row, ...]} numbering rows \"1\"..\"n\"); a handler that reads by the principal's user_id needs a row under that id",
"principalForm": {
"user_id": "<id>",
"roles": [
"<role>"
]
},
"enumForm": "an enum value is written {\"Ctor\": {fields}} -- {\"Backlog\": {}} for a nullary constructor, which is also the form this tool prints; the bare object of a constructor's fields is read too, and a bare {} is the first nullary constructor"
},
"misses": [],
"seededRows": {
"balances": [
"10"
]
},
"rowsAfter": {
"balances": [
"22"
]
}
},
"skipped": [
{
"aspect": "differentials",
"reason": "observe=false"
}
],
"proposals": [
{
"name": "changes = the empty list",
"rationale": "sound: 'changes' may reach the result (static dataflow, every input); observed: 'changes' was not varied (observe=false); untried: 'changes' = [], a type class the run's recorded value does not occupy",
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": []
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
}
},
{
"name": "every table empty",
"rationale": "the recorded run was seeded with rows in balances; untried: an empty world, where every read misses",
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {},
"seed": 41,
"observe": false,
"variations": 5
}
}
],
"epistemics": "soundFacts hold for every input (static dataflow). observed entries are bounded observations from seeded runs. Decision rule: output dependence is ruled OUT only by a sound unused fact. A guard-only fact rules out data flow, but control flow can still change the result. A concrete differing-output witness establishes dependence. A return-data (may-reach) fact combined with observed-constant runs stays UNRESOLVED — the reaching path may need input regions these runs never visited, so vary the OTHER parameters' regions to hunt a witness before concluding anything.",
"narrative": "This run evaluated the handler 'apply_changes' (package Yichus/Demo/SnapshotLedger) with 'db' (the world's database) and 'changes' = [5, 7] (provided). It returned 22.\n\nProven for every input, by static dataflow (no run needed): 'db' may reach the result, so no run can rule its influence out; 'changes' may reach the result, so no run can rule its influence out.\n\nObserved on this run, not proven (bounded-observation (seed 41, one recorded handler run; 5 variations per aspect, each on a fresh world from the same seeded rows)): No input was varied. The run forced global values for 1 definition: balances. Loading a function value does not establish that its body ran. Global values were forced for every definition this one can reach; this does not establish execution of their function bodies.\n\nThe world was seeded with 1 row in 'balances'. Seeded rows, as rendered: 'balances': 10. Every read found its row. After the run, 'balances' changed under 1 id (the same count, different rows).\n\nNot measured: differentials (observe=false).\n\n2 experiments are proposed from this run's facts, none of them run: changes = the empty list; every table empty."
},
"io": [
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 10
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 15
},
"result": 15
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 15
},
"result": 15
},
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 15
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 22
},
"result": 22
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 22
},
"result": 22
},
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 22
}
]
}Full saved record
{
"schema": "yichus-run-snapshot-1",
"clock": 123,
"mocks": [],
"run": {
"ok": true,
"tool": "api_why",
"artifactClass": "why-run",
"schemaVersion": "why-run-1.0",
"sources": {
"hash": "1fb3b0d71dd417cbac52eb90213e1e14b372670f9f03eed6bb9d8196ae4cf98f",
"files": [
{
"name": "ledger",
"sha256": "206d5115a67fc4fcd4bce996d4e5ac65b01ca38f75c49accb6829e4fa2a1ef16",
"content": "package Yichus/Demo/SnapshotLedger\n\nfrom Yichus/Data import Db, Table, table, db_read, db_write\nfrom Yichus/IO import IO, flat_map\n\nexport (apply_changes)\nexposes (Yichus/Data, Yichus/IO)\n\ndef balances(db: Db) -> Table[Int]:\n table(db, \"balances\")\n\ndef apply_changes(db: Db, changes: List[Int]) -> IO[Int]:\n recur changes:\n case []:\n db_read(balances(db), \"alice\")\n case [amount, *rest]:\n before <- flat_map(db_read(balances(db), \"alice\"))\n _ <- flat_map(db_write(balances(db), \"alice\", before.add(amount)))\n apply_changes(db, rest)\n"
}
]
},
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
},
"binding": {
"package": "Yichus/Demo/SnapshotLedger",
"name": "apply_changes",
"id": "Yichus/Demo/SnapshotLedger::apply_changes",
"type": "(Yichus/Data::Db, Bosatsu/Predef::List[Bosatsu/Predef::Int]) -> Yichus/IO::IO[Bosatsu/Predef::Int]",
"isIO": true,
"arity": 2
},
"seed": 41,
"inputs": [
{
"param": "db",
"type": "Yichus/Data::Db",
"shape": {
"kind": "enum",
"name": "Db",
"constructors": []
},
"origin": "world",
"json": null,
"rendered": null
},
{
"param": "changes",
"type": "Bosatsu/Predef::List[Bosatsu/Predef::Int]",
"shape": {
"kind": "list",
"elem": {
"kind": "int"
}
},
"origin": "provided",
"json": [
5,
7
],
"rendered": "[5, 7]"
}
],
"output": {
"type": "Bosatsu/Predef::Int",
"json": 22,
"jsonStatus": "encoded",
"rendered": "22"
},
"steps": {
"basis": "not evaluated: a handler's lets run inside its IO plan, so steps are shown for pure definitions only",
"items": []
},
"soundFacts": {
"basis": "sound-static (holds for every input)",
"paramInfluence": [
{
"param": "changes",
"kind": "return-data",
"sentence": "parameter 'changes' may reach the returned data (static dataflow; holds for every input); no observation can rule its influence out"
},
{
"param": "db",
"kind": "return-data",
"sentence": "parameter 'db' may reach the returned data (static dataflow; holds for every input); no observation can rule its influence out"
}
],
"deadInputs": [
"_a"
],
"structFields": []
},
"observed": {
"basis": "bounded-observation (seed 41, one recorded handler run; 5 variations per aspect, each on a fresh world from the same seeded rows)",
"variation": "a provided Int varies near its value first (+10%, -10%, doubled, halved, zero); every other value is drawn from the seed",
"referenceBasis": "global-value-forcing",
"touched": [
"Yichus/Demo/SnapshotLedger::balances"
],
"differentials": [],
"notReached": {
"definitions": [],
"sentence": "global values were forced for every definition reachable from Yichus/Demo/SnapshotLedger::apply_changes statically on this input (seed 41); this does not establish that their function bodies ran; bounded observation, not proof"
}
},
"world": {
"shape": {
"tables": {
"balances": {
"rowType": "Int",
"rowForm": "record: the row under an id is one record (a JSON object)",
"rowIsList": false,
"recordFields": {},
"recordShape": {
"kind": "int"
}
}
},
"rowKey": "rows are {table: {id: row}} (or {table: [row, ...]} numbering rows \"1\"..\"n\"); a handler that reads by the principal's user_id needs a row under that id",
"principalForm": {
"user_id": "<id>",
"roles": [
"<role>"
]
},
"enumForm": "an enum value is written {\"Ctor\": {fields}} -- {\"Backlog\": {}} for a nullary constructor, which is also the form this tool prints; the bare object of a constructor's fields is read too, and a bare {} is the first nullary constructor"
},
"misses": [],
"seededRows": {
"balances": [
"10"
]
},
"rowsAfter": {
"balances": [
"22"
]
}
},
"skipped": [
{
"aspect": "differentials",
"reason": "observe=false"
}
],
"proposals": [
{
"name": "changes = the empty list",
"rationale": "sound: 'changes' may reach the result (static dataflow, every input); observed: 'changes' was not varied (observe=false); untried: 'changes' = [], a type class the run's recorded value does not occupy",
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": []
},
"rows": {
"balances": {
"alice": 10
}
},
"seed": 41,
"observe": false,
"variations": 5
}
},
{
"name": "every table empty",
"rationale": "the recorded run was seeded with rows in balances; untried: an empty world, where every read misses",
"request": {
"binding": "Yichus/Demo/SnapshotLedger::apply_changes",
"inputs": {
"changes": [
5,
7
]
},
"rows": {},
"seed": 41,
"observe": false,
"variations": 5
}
}
],
"epistemics": "soundFacts hold for every input (static dataflow). observed entries are bounded observations from seeded runs. Decision rule: output dependence is ruled OUT only by a sound unused fact. A guard-only fact rules out data flow, but control flow can still change the result. A concrete differing-output witness establishes dependence. A return-data (may-reach) fact combined with observed-constant runs stays UNRESOLVED — the reaching path may need input regions these runs never visited, so vary the OTHER parameters' regions to hunt a witness before concluding anything.",
"narrative": "This run evaluated the handler 'apply_changes' (package Yichus/Demo/SnapshotLedger) with 'db' (the world's database) and 'changes' = [5, 7] (provided). It returned 22.\n\nProven for every input, by static dataflow (no run needed): 'db' may reach the result, so no run can rule its influence out; 'changes' may reach the result, so no run can rule its influence out.\n\nObserved on this run, not proven (bounded-observation (seed 41, one recorded handler run; 5 variations per aspect, each on a fresh world from the same seeded rows)): No input was varied. The run forced global values for 1 definition: balances. Loading a function value does not establish that its body ran. Global values were forced for every definition this one can reach; this does not establish execution of their function bodies.\n\nThe world was seeded with 1 row in 'balances'. Seeded rows, as rendered: 'balances': 10. Every read found its row. After the run, 'balances' changed under 1 id (the same count, different rows).\n\nNot measured: differentials (observe=false).\n\n2 experiments are proposed from this run's facts, none of them run: changes = the empty list; every table empty."
},
"io": [
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 10
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 15
},
"result": 15
},
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 15
},
{
"operation": "Yichus/Data::db_write",
"kind": "DbWrite",
"request": {
"table": "balances",
"key": "alice",
"value": 22
},
"result": 22
},
{
"operation": "Yichus/Data::db_read",
"kind": "DbRead",
"request": {
"table": "balances",
"key": "alice"
},
"result": 22
}
]
}Checking never replaces the saved run: accepting a change means saving its candidate, after this review. Database effects stay in memory; the clock is fixed; registered host operations use the exact saved mock answers. Other host operations are refused.