@feltdb/core 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cli/commands.js +4 -1
  2. package/dist/cli/provisioning-neutrality.js +79 -0
  3. package/dist/collection.d.ts +43 -1
  4. package/dist/collection.d.ts.map +1 -1
  5. package/dist/collection.js +192 -22
  6. package/dist/create/create.js +25 -21
  7. package/dist/create/managed-account.js +11 -0
  8. package/dist/create/package-versions.js +1 -1
  9. package/dist/create/server-source/Cargo.lock +165 -0
  10. package/dist/create/server-source/Cargo.toml +9 -0
  11. package/dist/create/server-source/crates/feltdb/Cargo.toml +3 -0
  12. package/dist/create/server-source/crates/feltdb/benches/gate13_baseline.rs +44 -44
  13. package/dist/create/server-source/crates/feltdb/benches/gate13_phase_7_1_release_economics.rs +12 -24
  14. package/dist/create/server-source/crates/feltdb/benches/gate_13_redux.rs +7 -13
  15. package/dist/create/server-source/crates/feltdb/benches/gate_13_regression_runner.rs +13 -10
  16. package/dist/create/server-source/crates/feltdb/benches/gate_14a_concurrent_writer_scaling.rs +12 -9
  17. package/dist/create/server-source/crates/feltdb/benches/gate_14a_production_admission_revalidation.rs +78 -25
  18. package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc2_admission_contract.rs +16 -13
  19. package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc_root_cause.rs +13 -5
  20. package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync1_queued_prototype.rs +41 -22
  21. package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync_economics.rs +33 -15
  22. package/dist/create/server-source/crates/feltdb/benches/gate_14b_causal_backlog_scaling.rs +100 -33
  23. package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_contract_test.rs +56 -20
  24. package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_scaling.rs +116 -41
  25. package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs +186 -55
  26. package/dist/create/server-source/crates/feltdb/benches/phase_7_1_2_optimization_benchmark.rs +64 -26
  27. package/dist/create/server-source/crates/feltdb/benches/phase_7_1_3_crossover_analysis.rs +46 -15
  28. package/dist/create/server-source/crates/feltdb/src/admission.rs +8 -15
  29. package/dist/create/server-source/crates/feltdb/src/admission_contract_tests.rs +43 -13
  30. package/dist/create/server-source/crates/feltdb/src/adversarial_transport.rs +15 -42
  31. package/dist/create/server-source/crates/feltdb/src/analytics.rs +65 -19
  32. package/dist/create/server-source/crates/feltdb/src/application.rs +113 -30
  33. package/dist/create/server-source/crates/feltdb/src/authorization_security_tests.rs +475 -140
  34. package/dist/create/server-source/crates/feltdb/src/cardinality_diagnostics.rs +17 -15
  35. package/dist/create/server-source/crates/feltdb/src/cardinality_endpoint.rs +0 -1
  36. package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +59 -15
  37. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +266 -114
  38. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier_phase_7_1.rs +25 -7
  39. package/dist/create/server-source/crates/feltdb/src/concurrency_fuzzing.rs +10 -15
  40. package/dist/create/server-source/crates/feltdb/src/consistency_contract.rs +3 -11
  41. package/dist/create/server-source/crates/feltdb/src/crash_atomic_boundary.rs +14 -5
  42. package/dist/create/server-source/crates/feltdb/src/crash_injection.rs +21 -25
  43. package/dist/create/server-source/crates/feltdb/src/crash_recovery_tests.rs +14 -11
  44. package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +103 -22
  45. package/dist/create/server-source/crates/feltdb/src/distributed_indexing.rs +18 -15
  46. package/dist/create/server-source/crates/feltdb/src/durability_guarantees.rs +12 -8
  47. package/dist/create/server-source/crates/feltdb/src/durable_dedup_set.rs +1 -5
  48. package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +87 -23
  49. package/dist/create/server-source/crates/feltdb/src/durable_operation_log.rs +3 -7
  50. package/dist/create/server-source/crates/feltdb/src/durable_sync.rs +10 -9
  51. package/dist/create/server-source/crates/feltdb/src/equality_index.rs +595 -0
  52. package/dist/create/server-source/crates/feltdb/src/in_process_transport.rs +1 -6
  53. package/dist/create/server-source/crates/feltdb/src/indexing.rs +35 -38
  54. package/dist/create/server-source/crates/feltdb/src/lib.rs +1050 -117
  55. package/dist/create/server-source/crates/feltdb/src/managed_cas_tests.rs +4 -1
  56. package/dist/create/server-source/crates/feltdb/src/metrics.rs +0 -1
  57. package/dist/create/server-source/crates/feltdb/src/multi_node_convergence.rs +1 -2
  58. package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +107 -30
  59. package/dist/create/server-source/crates/feltdb/src/observability.rs +19 -6
  60. package/dist/create/server-source/crates/feltdb/src/operation_algebra.rs +12 -11
  61. package/dist/create/server-source/crates/feltdb/src/operation_log.rs +9 -4
  62. package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +65 -18
  63. package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +193 -57
  64. package/dist/create/server-source/crates/feltdb/src/partition_reconciliation.rs +37 -27
  65. package/dist/create/server-source/crates/feltdb/src/permutation_scheduler.rs +38 -10
  66. package/dist/create/server-source/crates/feltdb/src/persistence_reality.rs +20 -14
  67. package/dist/create/server-source/crates/feltdb/src/phase1b_acceptance.rs +394 -229
  68. package/dist/create/server-source/crates/feltdb/src/phase1c1_acceptance.rs +8 -6
  69. package/dist/create/server-source/crates/feltdb/src/phase1c2_acceptance.rs +11 -13
  70. package/dist/create/server-source/crates/feltdb/src/phase1c3_acceptance.rs +90 -72
  71. package/dist/create/server-source/crates/feltdb/src/phase1c_atomicity_proof.rs +3 -3
  72. package/dist/create/server-source/crates/feltdb/src/phase5_integration.rs +33 -11
  73. package/dist/create/server-source/crates/feltdb/src/phase5_scenarios.rs +6 -6
  74. package/dist/create/server-source/crates/feltdb/src/phase6_adversarial_scenarios.rs +14 -56
  75. package/dist/create/server-source/crates/feltdb/src/phase6_convergence_validator.rs +29 -27
  76. package/dist/create/server-source/crates/feltdb/src/phase6_persistence.rs +35 -17
  77. package/dist/create/server-source/crates/feltdb/src/phase_1c_real_tcp.rs +8 -2
  78. package/dist/create/server-source/crates/feltdb/src/phase_2a_failures.rs +59 -15
  79. package/dist/create/server-source/crates/feltdb/src/phase_2b_network.rs +70 -17
  80. package/dist/create/server-source/crates/feltdb/src/phase_2c_cascading.rs +23 -6
  81. package/dist/create/server-source/crates/feltdb/src/phase_3_durability.rs +12 -3
  82. package/dist/create/server-source/crates/feltdb/src/phase_4_baseline.rs +41 -11
  83. package/dist/create/server-source/crates/feltdb/src/phase_5_soak.rs +56 -25
  84. package/dist/create/server-source/crates/feltdb/src/policy_evaluation.rs +701 -245
  85. package/dist/create/server-source/crates/feltdb/src/production_api.rs +31 -13
  86. package/dist/create/server-source/crates/feltdb/src/query_execution_diagnostics.rs +126 -0
  87. package/dist/create/server-source/crates/feltdb/src/query_performance.rs +6 -8
  88. package/dist/create/server-source/crates/feltdb/src/replay_fuzzing.rs +5 -5
  89. package/dist/create/server-source/crates/feltdb/src/replica_acknowledgements.rs +48 -18
  90. package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +30 -11
  91. package/dist/create/server-source/crates/feltdb/src/replication_manager.rs +6 -3
  92. package/dist/create/server-source/crates/feltdb/src/replication_protocol.rs +4 -3
  93. package/dist/create/server-source/crates/feltdb/src/sharding.rs +36 -10
  94. package/dist/create/server-source/crates/feltdb/src/state_conflict_contract.rs +516 -0
  95. package/dist/create/server-source/crates/feltdb/src/state_contract.rs +305 -6
  96. package/dist/create/server-source/crates/feltdb/src/state_diff_contract.rs +222 -0
  97. package/dist/create/server-source/crates/feltdb/src/state_facade.rs +82 -54
  98. package/dist/create/server-source/crates/feltdb/src/state_hash.rs +2 -2
  99. package/dist/create/server-source/crates/feltdb/src/state_model.rs +1514 -537
  100. package/dist/create/server-source/crates/feltdb/src/state_transition_store.rs +6 -3
  101. package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +672 -0
  102. package/dist/create/server-source/crates/feltdb/src/submission.rs +5 -11
  103. package/dist/create/server-source/crates/feltdb/src/sync.rs +12 -0
  104. package/dist/create/server-source/crates/feltdb/src/tcp_transport.rs +6 -8
  105. package/dist/create/server-source/crates/feltdb/src/transaction_api.rs +24 -35
  106. package/dist/create/server-source/crates/feltdb/src/transaction_invariants.rs +24 -8
  107. package/dist/create/server-source/crates/feltdb/src/transaction_preconditions.rs +248 -59
  108. package/dist/create/server-source/crates/feltdb/src/transactions.rs +17 -20
  109. package/dist/create/server-source/crates/feltdb/src/trigger_contract.rs +749 -0
  110. package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +1 -0
  111. package/dist/create/server-source/crates/feltdb/src/workload.rs +512 -4
  112. package/dist/create/server-source/crates/feltdb/src/workload_diagnostics.rs +442 -0
  113. package/dist/create/server-source/crates/feltdb/tests/branching_evidence.rs +299 -0
  114. package/dist/create/server-source/crates/feltdb/tests/current_revision_authority_evidence.rs +288 -0
  115. package/dist/create/server-source/crates/feltdb/tests/durable_format_compatibility.rs +392 -0
  116. package/dist/create/server-source/crates/feltdb/tests/feltdb_state_boundary_tests.rs +436 -220
  117. package/dist/create/server-source/crates/feltdb/tests/fixtures/state_conflict_contract_corpus.json +1916 -0
  118. package/dist/create/server-source/crates/feltdb/tests/fixtures/state_diff_contract_corpus.json +1878 -0
  119. package/dist/create/server-source/crates/feltdb/tests/fixtures/trigger_contract_corpus.json +1862 -0
  120. package/dist/create/server-source/crates/feltdb/tests/pr34_query_collection.rs +234 -0
  121. package/dist/create/server-source/crates/feltdb/tests/pr35_equality_index.rs +947 -0
  122. package/dist/create/server-source/crates/feltdb/tests/pr7_self_authorization_proof.rs +5 -8
  123. package/dist/create/server-source/crates/feltdb/tests/pr8_vocabulary_assessment.rs +52 -44
  124. package/dist/create/server-source/crates/feltdb/tests/pr9_phase2_boundary_tests.rs +33 -16
  125. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3a_path_a_tests.rs +22 -7
  126. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_authorized_mutations.rs +41 -22
  127. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_role_based_authorization.rs +25 -8
  128. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_simple_auth_delete.rs +9 -6
  129. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_team_delete_role_authorization.rs +120 -69
  130. package/dist/create/server-source/crates/feltdb/tests/pr9_teams_role_based_access.rs +21 -10
  131. package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +1032 -0
  132. package/dist/create/server-source/crates/feltdb/tests/reconciliation_application.rs +868 -0
  133. package/dist/create/server-source/crates/feltdb/tests/reconciliation_wire_format_evidence.rs +221 -0
  134. package/dist/create/server-source/crates/feltdb/tests/resource_scoped_revisions.rs +338 -0
  135. package/dist/create/server-source/crates/feltdb/tests/revision_identity_contract.rs +1039 -0
  136. package/dist/create/server-source/crates/feltdb/tests/revision_model_decision.rs +739 -0
  137. package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +427 -0
  138. package/dist/create/server-source/crates/feltdb/tests/saas_authorization_integration.rs +3 -3
  139. package/dist/create/server-source/crates/feltdb/tests/saas_invitation_lifecycle.rs +25 -22
  140. package/dist/create/server-source/crates/feltdb/tests/state_conflict_contract_conformance.rs +1799 -0
  141. package/dist/create/server-source/crates/feltdb/tests/state_diff_contract_conformance.rs +1316 -0
  142. package/dist/create/server-source/crates/feltdb/tests/state_model_integration.rs +53 -61
  143. package/dist/create/server-source/crates/feltdb/tests/state_persistence_integration.rs +156 -61
  144. package/dist/create/server-source/crates/feltdb/tests/state_store_boundary_evidence.rs +299 -0
  145. package/dist/create/server-source/crates/feltdb/tests/sync_divergence_evidence.rs +255 -0
  146. package/dist/create/server-source/crates/feltdb/tests/three_way_input_boundary_evidence.rs +249 -0
  147. package/dist/create/server-source/crates/feltdb/tests/trigger_contract_conformance.rs +994 -0
  148. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +2 -1
  149. package/dist/create/server-source/crates/feltdb-server/src/audit.rs +1137 -29
  150. package/dist/create/server-source/crates/feltdb-server/src/auth.rs +164 -13
  151. package/dist/create/server-source/crates/feltdb-server/src/main.rs +800 -34
  152. package/dist/db.d.ts +33 -34
  153. package/dist/db.d.ts.map +1 -1
  154. package/dist/db.js +74 -20
  155. package/dist/deployment.d.ts +30 -0
  156. package/dist/deployment.d.ts.map +1 -0
  157. package/dist/deployment.js +130 -0
  158. package/dist/embedded-transaction.d.ts +22 -4
  159. package/dist/embedded-transaction.d.ts.map +1 -1
  160. package/dist/embedded-transaction.js +51 -5
  161. package/dist/feltdb.d.ts +14 -2
  162. package/dist/feltdb.d.ts.map +1 -1
  163. package/dist/file-db.js +1 -1
  164. package/dist/http-client.d.ts +14 -0
  165. package/dist/http-client.d.ts.map +1 -1
  166. package/dist/http-client.js +23 -5
  167. package/dist/http-db.d.ts +119 -1
  168. package/dist/http-db.d.ts.map +1 -1
  169. package/dist/http-db.js +346 -31
  170. package/dist/index-core.d.ts +2 -0
  171. package/dist/index-core.d.ts.map +1 -1
  172. package/dist/index-core.js +2 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +9 -0
  175. package/dist/indexeddb-db.d.ts.map +1 -1
  176. package/dist/indexeddb-db.js +35 -21
  177. package/dist/managed-recovery.d.ts +192 -0
  178. package/dist/managed-recovery.d.ts.map +1 -0
  179. package/dist/managed-recovery.js +242 -0
  180. package/dist/memory-db.js +1 -1
  181. package/dist/studio-app/assets/{feltdb_wasm-DB8cX151.js → feltdb_wasm-DaNwCLRX.js} +1 -1
  182. package/dist/studio-app/assets/feltdb_wasm_bg-DnsHNv6g.wasm +0 -0
  183. package/dist/studio-app/assets/index-j8IlhNqJ.js +29 -0
  184. package/dist/studio-app/index.html +1 -1
  185. package/dist/transaction.d.ts +30 -0
  186. package/dist/transaction.d.ts.map +1 -1
  187. package/dist/transaction.js +41 -0
  188. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  189. package/dist/workload.d.ts +2 -1
  190. package/dist/workload.d.ts.map +1 -1
  191. package/package.json +1 -1
  192. package/dist/studio-app/assets/feltdb_wasm_bg-ClhDHp0S.wasm +0 -0
  193. package/dist/studio-app/assets/index-B0k4UAlI.js +0 -29
@@ -0,0 +1,1878 @@
1
+ {
2
+ "about": "Deterministic conformance corpus for the feltdb.state.diff contract. Every case is executed by both the native and the WASM implementation and their canonical output bytes must be identical to each other and to expected_output. Cases with 'input' are canonically encoded by the harness and carry those bytes as canonical_input; cases with 'raw_input' are fed to the contract verbatim so that non-canonical and malformed encodings are testable. Regenerate expected_output with FELTDB_STATE_DIFF_CONTRACT_BLESS=1 cargo test -p feltdb --test state_diff_contract_conformance -- bless --ignored",
3
+ "cases": [
4
+ {
5
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":1},\"version\":1}",
6
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
7
+ "input": {
8
+ "contract": "feltdb.state.diff",
9
+ "state_a": {
10
+ "x": 1
11
+ },
12
+ "state_b": {
13
+ "x": 1
14
+ },
15
+ "version": 1
16
+ },
17
+ "name": "identical_objects",
18
+ "why": "two equal states produce no change"
19
+ },
20
+ {
21
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":{\"b\":[1,{\"c\":2}]}},\"state_b\":{\"a\":{\"b\":[1,{\"c\":2}]}},\"version\":1}",
22
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
23
+ "input": {
24
+ "contract": "feltdb.state.diff",
25
+ "state_a": {
26
+ "a": {
27
+ "b": [
28
+ 1,
29
+ {
30
+ "c": 2
31
+ }
32
+ ]
33
+ }
34
+ },
35
+ "state_b": {
36
+ "a": {
37
+ "b": [
38
+ 1,
39
+ {
40
+ "c": 2
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ "version": 1
46
+ },
47
+ "name": "identical_nested",
48
+ "why": "equality is structural"
49
+ },
50
+ {
51
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":{},\"version\":1}",
52
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
53
+ "input": {
54
+ "contract": "feltdb.state.diff",
55
+ "state_a": {},
56
+ "state_b": {},
57
+ "version": 1
58
+ },
59
+ "name": "both_empty_objects",
60
+ "why": "an empty state against itself"
61
+ },
62
+ {
63
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[],\"state_b\":[],\"version\":1}",
64
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
65
+ "input": {
66
+ "contract": "feltdb.state.diff",
67
+ "state_a": [],
68
+ "state_b": [],
69
+ "version": 1
70
+ },
71
+ "name": "both_empty_arrays",
72
+ "why": "an empty array against itself"
73
+ },
74
+ {
75
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":null,\"state_b\":null,\"version\":1}",
76
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
77
+ "input": {
78
+ "contract": "feltdb.state.diff",
79
+ "state_a": null,
80
+ "state_b": null,
81
+ "version": 1
82
+ },
83
+ "name": "both_null",
84
+ "why": "null against null is the matched-null branch"
85
+ },
86
+ {
87
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":{\"a\":1,\"b\":2},\"version\":1}",
88
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":1},{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
89
+ "input": {
90
+ "contract": "feltdb.state.diff",
91
+ "state_a": {},
92
+ "state_b": {
93
+ "a": 1,
94
+ "b": 2
95
+ },
96
+ "version": 1
97
+ },
98
+ "name": "empty_to_populated_object",
99
+ "why": "every member of the new state is an addition"
100
+ },
101
+ {
102
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":1,\"b\":2},\"state_b\":{},\"version\":1}",
103
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Removed\",\"old_value\":1,\"new_value\":null},{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
104
+ "input": {
105
+ "contract": "feltdb.state.diff",
106
+ "state_a": {
107
+ "a": 1,
108
+ "b": 2
109
+ },
110
+ "state_b": {},
111
+ "version": 1
112
+ },
113
+ "name": "populated_to_empty_object",
114
+ "why": "every member of the old state is a removal"
115
+ },
116
+ {
117
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[],\"state_b\":[1,2],\"version\":1}",
118
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":1},{\"path\":[{\"Index\":1}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
119
+ "input": {
120
+ "contract": "feltdb.state.diff",
121
+ "state_a": [],
122
+ "state_b": [
123
+ 1,
124
+ 2
125
+ ],
126
+ "version": 1
127
+ },
128
+ "name": "empty_to_populated_array",
129
+ "why": "array growth from nothing"
130
+ },
131
+ {
132
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2],\"state_b\":[],\"version\":1}",
133
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Removed\",\"old_value\":1,\"new_value\":null},{\"path\":[{\"Index\":1}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
134
+ "input": {
135
+ "contract": "feltdb.state.diff",
136
+ "state_a": [
137
+ 1,
138
+ 2
139
+ ],
140
+ "state_b": [],
141
+ "version": 1
142
+ },
143
+ "name": "populated_to_empty_array",
144
+ "why": "array shrinkage to nothing"
145
+ },
146
+ {
147
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
148
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
149
+ "input": {
150
+ "contract": "feltdb.state.diff",
151
+ "state_a": {
152
+ "x": 1
153
+ },
154
+ "state_b": {
155
+ "x": 2
156
+ },
157
+ "version": 1
158
+ },
159
+ "name": "single_scalar_replacement",
160
+ "why": "the simplest change"
161
+ },
162
+ {
163
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":1,\"state_b\":2,\"version\":1}",
164
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
165
+ "input": {
166
+ "contract": "feltdb.state.diff",
167
+ "state_a": 1,
168
+ "state_b": 2,
169
+ "version": 1
170
+ },
171
+ "name": "top_level_scalar_replacement",
172
+ "why": "a change at the empty path"
173
+ },
174
+ {
175
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":[],\"version\":1}",
176
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[],\"kind\":\"Changed\",\"old_value\":{},\"new_value\":[]}],\"is_read_only\":false},\"version\":1}",
177
+ "input": {
178
+ "contract": "feltdb.state.diff",
179
+ "state_a": {},
180
+ "state_b": [],
181
+ "version": 1
182
+ },
183
+ "name": "top_level_type_transition",
184
+ "why": "the states themselves change type"
185
+ },
186
+ {
187
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":\"s\",\"state_b\":{\"x\":1},\"version\":1}",
188
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[],\"kind\":\"Changed\",\"old_value\":\"s\",\"new_value\":{\"x\":1}}],\"is_read_only\":false},\"version\":1}",
189
+ "input": {
190
+ "contract": "feltdb.state.diff",
191
+ "state_a": "s",
192
+ "state_b": {
193
+ "x": 1
194
+ },
195
+ "version": 1
196
+ },
197
+ "name": "top_level_scalar_to_object",
198
+ "why": "a scalar state becoming a structured one"
199
+ },
200
+ {
201
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":1},\"state_b\":{\"a\":1,\"b\":2},\"version\":1}",
202
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
203
+ "input": {
204
+ "contract": "feltdb.state.diff",
205
+ "state_a": {
206
+ "a": 1
207
+ },
208
+ "state_b": {
209
+ "a": 1,
210
+ "b": 2
211
+ },
212
+ "version": 1
213
+ },
214
+ "name": "object_addition",
215
+ "why": "a new member"
216
+ },
217
+ {
218
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":1,\"b\":2},\"state_b\":{\"a\":1},\"version\":1}",
219
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
220
+ "input": {
221
+ "contract": "feltdb.state.diff",
222
+ "state_a": {
223
+ "a": 1,
224
+ "b": 2
225
+ },
226
+ "state_b": {
227
+ "a": 1
228
+ },
229
+ "version": 1
230
+ },
231
+ "name": "object_removal",
232
+ "why": "a dropped member"
233
+ },
234
+ {
235
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":1},\"state_b\":{\"a\":2},\"version\":1}",
236
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
237
+ "input": {
238
+ "contract": "feltdb.state.diff",
239
+ "state_a": {
240
+ "a": 1
241
+ },
242
+ "state_b": {
243
+ "a": 2
244
+ },
245
+ "version": 1
246
+ },
247
+ "name": "object_replacement",
248
+ "why": "a changed member"
249
+ },
250
+ {
251
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":1}},\"state_b\":{\"o\":{\"a\":1,\"b\":2}},\"version\":1}",
252
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"b\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
253
+ "input": {
254
+ "contract": "feltdb.state.diff",
255
+ "state_a": {
256
+ "o": {
257
+ "a": 1
258
+ }
259
+ },
260
+ "state_b": {
261
+ "o": {
262
+ "a": 1,
263
+ "b": 2
264
+ }
265
+ },
266
+ "version": 1
267
+ },
268
+ "name": "nested_addition",
269
+ "why": "a new member one level down"
270
+ },
271
+ {
272
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":1,\"b\":2}},\"state_b\":{\"o\":{\"a\":1}},\"version\":1}",
273
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"b\"}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
274
+ "input": {
275
+ "contract": "feltdb.state.diff",
276
+ "state_a": {
277
+ "o": {
278
+ "a": 1,
279
+ "b": 2
280
+ }
281
+ },
282
+ "state_b": {
283
+ "o": {
284
+ "a": 1
285
+ }
286
+ },
287
+ "version": 1
288
+ },
289
+ "name": "nested_removal",
290
+ "why": "a dropped member one level down"
291
+ },
292
+ {
293
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":1}},\"state_b\":{\"o\":{\"a\":2}},\"version\":1}",
294
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
295
+ "input": {
296
+ "contract": "feltdb.state.diff",
297
+ "state_a": {
298
+ "o": {
299
+ "a": 1
300
+ }
301
+ },
302
+ "state_b": {
303
+ "o": {
304
+ "a": 2
305
+ }
306
+ },
307
+ "version": 1
308
+ },
309
+ "name": "nested_replacement",
310
+ "why": "a changed member one level down"
311
+ },
312
+ {
313
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":1,\"m\":1,\"z\":1},\"state_b\":{\"a\":2,\"m\":2,\"z\":2},\"version\":1}",
314
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"m\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"z\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
315
+ "input": {
316
+ "contract": "feltdb.state.diff",
317
+ "state_a": {
318
+ "a": 1,
319
+ "m": 1,
320
+ "z": 1
321
+ },
322
+ "state_b": {
323
+ "a": 2,
324
+ "m": 2,
325
+ "z": 2
326
+ },
327
+ "version": 1
328
+ },
329
+ "name": "multiple_independent_changes",
330
+ "why": "several changes are reported and ordered together"
331
+ },
332
+ {
333
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"drop\":2,\"edit\":3,\"keep\":1},\"state_b\":{\"edit\":4,\"keep\":1,\"new\":5},\"version\":1}",
334
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"drop\"}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null},{\"path\":[{\"Key\":\"edit\"}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":4},{\"path\":[{\"Key\":\"new\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":5}],\"is_read_only\":false},\"version\":1}",
335
+ "input": {
336
+ "contract": "feltdb.state.diff",
337
+ "state_a": {
338
+ "drop": 2,
339
+ "edit": 3,
340
+ "keep": 1
341
+ },
342
+ "state_b": {
343
+ "edit": 4,
344
+ "keep": 1,
345
+ "new": 5
346
+ },
347
+ "version": 1
348
+ },
349
+ "name": "simultaneous_add_remove_change",
350
+ "why": "all three kinds in one diff"
351
+ },
352
+ {
353
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":{\"b\":{\"c\":{\"d\":{\"e\":{\"f\":{\"g\":{\"h\":{\"i\":{\"j\":1}}}}}}}}}},\"state_b\":{\"a\":{\"b\":{\"c\":{\"d\":{\"e\":{\"f\":{\"g\":{\"h\":{\"i\":{\"j\":2}}}}}}}}}},\"version\":1}",
354
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"},{\"Key\":\"b\"},{\"Key\":\"c\"},{\"Key\":\"d\"},{\"Key\":\"e\"},{\"Key\":\"f\"},{\"Key\":\"g\"},{\"Key\":\"h\"},{\"Key\":\"i\"},{\"Key\":\"j\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
355
+ "input": {
356
+ "contract": "feltdb.state.diff",
357
+ "state_a": {
358
+ "a": {
359
+ "b": {
360
+ "c": {
361
+ "d": {
362
+ "e": {
363
+ "f": {
364
+ "g": {
365
+ "h": {
366
+ "i": {
367
+ "j": 1
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+ },
378
+ "state_b": {
379
+ "a": {
380
+ "b": {
381
+ "c": {
382
+ "d": {
383
+ "e": {
384
+ "f": {
385
+ "g": {
386
+ "h": {
387
+ "i": {
388
+ "j": 2
389
+ }
390
+ }
391
+ }
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ }
398
+ },
399
+ "version": 1
400
+ },
401
+ "name": "deeply_nested_change",
402
+ "why": "a change at depth ten"
403
+ },
404
+ {
405
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":1,\"b\":{\"c\":2}}},\"state_b\":{\"o\":\"flat\"},\"version\":1}",
406
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"}],\"kind\":\"Changed\",\"old_value\":{\"a\":1,\"b\":{\"c\":2}},\"new_value\":\"flat\"}],\"is_read_only\":false},\"version\":1}",
407
+ "input": {
408
+ "contract": "feltdb.state.diff",
409
+ "state_a": {
410
+ "o": {
411
+ "a": 1,
412
+ "b": {
413
+ "c": 2
414
+ }
415
+ }
416
+ },
417
+ "state_b": {
418
+ "o": "flat"
419
+ },
420
+ "version": 1
421
+ },
422
+ "name": "whole_subtree_replaced",
423
+ "why": "a subtree replaced by a scalar is one change at its root"
424
+ },
425
+ {
426
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":{\"o\":{\"a\":1,\"b\":{\"c\":[1,2]}}},\"version\":1}",
427
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":{\"a\":1,\"b\":{\"c\":[1,2]}}}],\"is_read_only\":false},\"version\":1}",
428
+ "input": {
429
+ "contract": "feltdb.state.diff",
430
+ "state_a": {},
431
+ "state_b": {
432
+ "o": {
433
+ "a": 1,
434
+ "b": {
435
+ "c": [
436
+ 1,
437
+ 2
438
+ ]
439
+ }
440
+ }
441
+ },
442
+ "version": 1
443
+ },
444
+ "name": "whole_subtree_added",
445
+ "why": "an added subtree is one change carrying the whole value"
446
+ },
447
+ {
448
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"l\":{\"x\":1},\"r\":{\"y\":1}},\"state_b\":{\"l\":{\"x\":2},\"r\":{\"y\":2}},\"version\":1}",
449
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"l\"},{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"r\"},{\"Key\":\"y\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
450
+ "input": {
451
+ "contract": "feltdb.state.diff",
452
+ "state_a": {
453
+ "l": {
454
+ "x": 1
455
+ },
456
+ "r": {
457
+ "y": 1
458
+ }
459
+ },
460
+ "state_b": {
461
+ "l": {
462
+ "x": 2
463
+ },
464
+ "r": {
465
+ "y": 2
466
+ }
467
+ },
468
+ "version": 1
469
+ },
470
+ "name": "sibling_subtrees_change_independently",
471
+ "why": "changes at unrelated paths do not interact"
472
+ },
473
+ {
474
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"\":2,\"0\":3,\"[0]\":4,\"a b\":6,\"a.b\":1,\"a/b\":5},\"state_b\":{\"\":9,\"0\":9,\"[0]\":9,\"a b\":9,\"a.b\":9,\"a/b\":9},\"version\":1}",
475
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"\"}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":9},{\"path\":[{\"Key\":\"0\"}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":9},{\"path\":[{\"Key\":\"[0]\"}],\"kind\":\"Changed\",\"old_value\":4,\"new_value\":9},{\"path\":[{\"Key\":\"a b\"}],\"kind\":\"Changed\",\"old_value\":6,\"new_value\":9},{\"path\":[{\"Key\":\"a.b\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":9},{\"path\":[{\"Key\":\"a/b\"}],\"kind\":\"Changed\",\"old_value\":5,\"new_value\":9}],\"is_read_only\":false},\"version\":1}",
476
+ "input": {
477
+ "contract": "feltdb.state.diff",
478
+ "state_a": {
479
+ "": 2,
480
+ "0": 3,
481
+ "[0]": 4,
482
+ "a b": 6,
483
+ "a.b": 1,
484
+ "a/b": 5
485
+ },
486
+ "state_b": {
487
+ "": 9,
488
+ "0": 9,
489
+ "[0]": 9,
490
+ "a b": 9,
491
+ "a.b": 9,
492
+ "a/b": 9
493
+ },
494
+ "version": 1
495
+ },
496
+ "name": "unusual_object_keys",
497
+ "why": "keys that look like paths, indices and punctuation are opaque"
498
+ },
499
+ {
500
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"10\":1,\"2\":1,\"A\":1,\"Z\":1,\"a\":1,\"b\":1},\"state_b\":{\"10\":2,\"2\":2,\"A\":2,\"Z\":2,\"a\":2,\"b\":2},\"version\":1}",
501
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"10\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"2\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"A\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"Z\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
502
+ "input": {
503
+ "contract": "feltdb.state.diff",
504
+ "state_a": {
505
+ "10": 1,
506
+ "2": 1,
507
+ "A": 1,
508
+ "Z": 1,
509
+ "a": 1,
510
+ "b": 1
511
+ },
512
+ "state_b": {
513
+ "10": 2,
514
+ "2": 2,
515
+ "A": 2,
516
+ "Z": 2,
517
+ "a": 2,
518
+ "b": 2
519
+ },
520
+ "version": 1
521
+ },
522
+ "name": "key_ordering_is_byte_order",
523
+ "why": "result order follows byte order, not insertion order"
524
+ },
525
+ {
526
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"café\":\"naïve\",\"☕\":\"🔥\"},\"state_b\":{\"café\":\"naif\",\"☕\":\"💧\"},\"version\":1}",
527
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"café\"}],\"kind\":\"Changed\",\"old_value\":\"naïve\",\"new_value\":\"naif\"},{\"path\":[{\"Key\":\"☕\"}],\"kind\":\"Changed\",\"old_value\":\"🔥\",\"new_value\":\"💧\"}],\"is_read_only\":false},\"version\":1}",
528
+ "input": {
529
+ "contract": "feltdb.state.diff",
530
+ "state_a": {
531
+ "café": "naïve",
532
+ "☕": "🔥"
533
+ },
534
+ "state_b": {
535
+ "café": "naif",
536
+ "☕": "💧"
537
+ },
538
+ "version": 1
539
+ },
540
+ "name": "unicode_keys_and_values",
541
+ "why": "non-ASCII survives parsing, diffing and re-encoding"
542
+ },
543
+ {
544
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"z\":1,\"é\":1,\"☕\":1},\"state_b\":{\"z\":2,\"é\":2,\"☕\":2},\"version\":1}",
545
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"z\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"é\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"☕\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
546
+ "input": {
547
+ "contract": "feltdb.state.diff",
548
+ "state_a": {
549
+ "z": 1,
550
+ "é": 1,
551
+ "☕": 1
552
+ },
553
+ "state_b": {
554
+ "z": 2,
555
+ "é": 2,
556
+ "☕": 2
557
+ },
558
+ "version": 1
559
+ },
560
+ "name": "unicode_key_ordering",
561
+ "why": "non-ASCII keys order by UTF-8 bytes"
562
+ },
563
+ {
564
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"\\\"\\\\\\n\\t\\b\\f\\u0001\"},\"state_b\":{\"s\":\"other\"},\"version\":1}",
565
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"s\"}],\"kind\":\"Changed\",\"old_value\":\"\\\"\\\\\\n\\t\\b\\f\\u0001\",\"new_value\":\"other\"}],\"is_read_only\":false},\"version\":1}",
566
+ "input": {
567
+ "contract": "feltdb.state.diff",
568
+ "state_a": {
569
+ "s": "\"\\\n\t\b\f\u0001"
570
+ },
571
+ "state_b": {
572
+ "s": "other"
573
+ },
574
+ "version": 1
575
+ },
576
+ "name": "escaped_characters_in_values",
577
+ "why": "values needing escapes re-encode identically"
578
+ },
579
+ {
580
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"
\"},\"state_b\":{\"s\":\"other\"},\"version\":1}",
581
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"s\"}],\"kind\":\"Changed\",\"old_value\":\"
\",\"new_value\":\"other\"}],\"is_read_only\":false},\"version\":1}",
582
+ "input": {
583
+ "contract": "feltdb.state.diff",
584
+ "state_a": {
585
+ "s": "
"
586
+ },
587
+ "state_b": {
588
+ "s": "other"
589
+ },
590
+ "version": 1
591
+ },
592
+ "name": "unescaped_characters_in_values",
593
+ "why": "DEL and U+2028 are emitted raw, as serde_json emits them"
594
+ },
595
+ {
596
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"\\nk\":1,\"\\\"k\":1},\"state_b\":{\"\\nk\":2,\"\\\"k\":2},\"version\":1}",
597
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"\\nk\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"\\\"k\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
598
+ "input": {
599
+ "contract": "feltdb.state.diff",
600
+ "state_a": {
601
+ "\nk": 1,
602
+ "\"k": 1
603
+ },
604
+ "state_b": {
605
+ "\nk": 2,
606
+ "\"k": 2
607
+ },
608
+ "version": 1
609
+ },
610
+ "name": "escaped_characters_in_keys",
611
+ "why": "keys needing escapes re-encode identically"
612
+ },
613
+ {
614
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"k00\":0,\"k01\":1,\"k02\":2,\"k03\":3,\"k04\":4,\"k05\":5,\"k06\":6,\"k07\":7,\"k08\":8,\"k09\":9,\"k10\":10,\"k11\":11,\"k12\":12,\"k13\":13,\"k14\":14,\"k15\":15,\"k16\":16,\"k17\":17,\"k18\":18,\"k19\":19,\"k20\":20,\"k21\":21,\"k22\":22,\"k23\":23,\"k24\":24,\"k25\":25,\"k26\":26,\"k27\":27,\"k28\":28,\"k29\":29,\"k30\":30,\"k31\":31,\"k32\":32,\"k33\":33,\"k34\":34,\"k35\":35,\"k36\":36,\"k37\":37,\"k38\":38,\"k39\":39},\"state_b\":{\"k00\":100,\"k01\":1,\"k02\":2,\"k03\":103,\"k04\":4,\"k05\":5,\"k06\":106,\"k07\":7,\"k08\":8,\"k09\":109,\"k10\":10,\"k11\":11,\"k12\":112,\"k13\":13,\"k14\":14,\"k15\":115,\"k16\":16,\"k17\":17,\"k18\":118,\"k19\":19,\"k20\":20,\"k21\":121,\"k22\":22,\"k23\":23,\"k24\":124,\"k25\":25,\"k26\":26,\"k27\":127,\"k28\":28,\"k29\":29,\"k30\":130,\"k31\":31,\"k32\":32,\"k33\":133,\"k34\":34,\"k35\":35,\"k36\":136,\"k37\":37,\"k38\":38,\"k39\":139},\"version\":1}",
615
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"k00\"}],\"kind\":\"Changed\",\"old_value\":0,\"new_value\":100},{\"path\":[{\"Key\":\"k03\"}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":103},{\"path\":[{\"Key\":\"k06\"}],\"kind\":\"Changed\",\"old_value\":6,\"new_value\":106},{\"path\":[{\"Key\":\"k09\"}],\"kind\":\"Changed\",\"old_value\":9,\"new_value\":109},{\"path\":[{\"Key\":\"k12\"}],\"kind\":\"Changed\",\"old_value\":12,\"new_value\":112},{\"path\":[{\"Key\":\"k15\"}],\"kind\":\"Changed\",\"old_value\":15,\"new_value\":115},{\"path\":[{\"Key\":\"k18\"}],\"kind\":\"Changed\",\"old_value\":18,\"new_value\":118},{\"path\":[{\"Key\":\"k21\"}],\"kind\":\"Changed\",\"old_value\":21,\"new_value\":121},{\"path\":[{\"Key\":\"k24\"}],\"kind\":\"Changed\",\"old_value\":24,\"new_value\":124},{\"path\":[{\"Key\":\"k27\"}],\"kind\":\"Changed\",\"old_value\":27,\"new_value\":127},{\"path\":[{\"Key\":\"k30\"}],\"kind\":\"Changed\",\"old_value\":30,\"new_value\":130},{\"path\":[{\"Key\":\"k33\"}],\"kind\":\"Changed\",\"old_value\":33,\"new_value\":133},{\"path\":[{\"Key\":\"k36\"}],\"kind\":\"Changed\",\"old_value\":36,\"new_value\":136},{\"path\":[{\"Key\":\"k39\"}],\"kind\":\"Changed\",\"old_value\":39,\"new_value\":139}],\"is_read_only\":false},\"version\":1}",
616
+ "input": {
617
+ "contract": "feltdb.state.diff",
618
+ "state_a": {
619
+ "k00": 0,
620
+ "k01": 1,
621
+ "k02": 2,
622
+ "k03": 3,
623
+ "k04": 4,
624
+ "k05": 5,
625
+ "k06": 6,
626
+ "k07": 7,
627
+ "k08": 8,
628
+ "k09": 9,
629
+ "k10": 10,
630
+ "k11": 11,
631
+ "k12": 12,
632
+ "k13": 13,
633
+ "k14": 14,
634
+ "k15": 15,
635
+ "k16": 16,
636
+ "k17": 17,
637
+ "k18": 18,
638
+ "k19": 19,
639
+ "k20": 20,
640
+ "k21": 21,
641
+ "k22": 22,
642
+ "k23": 23,
643
+ "k24": 24,
644
+ "k25": 25,
645
+ "k26": 26,
646
+ "k27": 27,
647
+ "k28": 28,
648
+ "k29": 29,
649
+ "k30": 30,
650
+ "k31": 31,
651
+ "k32": 32,
652
+ "k33": 33,
653
+ "k34": 34,
654
+ "k35": 35,
655
+ "k36": 36,
656
+ "k37": 37,
657
+ "k38": 38,
658
+ "k39": 39
659
+ },
660
+ "state_b": {
661
+ "k00": 100,
662
+ "k01": 1,
663
+ "k02": 2,
664
+ "k03": 103,
665
+ "k04": 4,
666
+ "k05": 5,
667
+ "k06": 106,
668
+ "k07": 7,
669
+ "k08": 8,
670
+ "k09": 109,
671
+ "k10": 10,
672
+ "k11": 11,
673
+ "k12": 112,
674
+ "k13": 13,
675
+ "k14": 14,
676
+ "k15": 115,
677
+ "k16": 16,
678
+ "k17": 17,
679
+ "k18": 118,
680
+ "k19": 19,
681
+ "k20": 20,
682
+ "k21": 121,
683
+ "k22": 22,
684
+ "k23": 23,
685
+ "k24": 124,
686
+ "k25": 25,
687
+ "k26": 26,
688
+ "k27": 127,
689
+ "k28": 28,
690
+ "k29": 29,
691
+ "k30": 130,
692
+ "k31": 31,
693
+ "k32": 32,
694
+ "k33": 133,
695
+ "k34": 34,
696
+ "k35": 35,
697
+ "k36": 136,
698
+ "k37": 37,
699
+ "k38": 38,
700
+ "k39": 139
701
+ },
702
+ "version": 1
703
+ },
704
+ "name": "many_members",
705
+ "why": "an object wide enough that ordering is load-bearing"
706
+ },
707
+ {
708
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":{\"x\":1},\"version\":1}",
709
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
710
+ "input": {
711
+ "contract": "feltdb.state.diff",
712
+ "state_a": {},
713
+ "state_b": {
714
+ "x": 1
715
+ },
716
+ "version": 1
717
+ },
718
+ "name": "missing_to_value",
719
+ "why": "an absent member becoming present is Added"
720
+ },
721
+ {
722
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{},\"version\":1}",
723
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Removed\",\"old_value\":1,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
724
+ "input": {
725
+ "contract": "feltdb.state.diff",
726
+ "state_a": {
727
+ "x": 1
728
+ },
729
+ "state_b": {},
730
+ "version": 1
731
+ },
732
+ "name": "value_to_missing",
733
+ "why": "a present member becoming absent is Removed"
734
+ },
735
+ {
736
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{},\"state_b\":{\"x\":null},\"version\":1}",
737
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
738
+ "input": {
739
+ "contract": "feltdb.state.diff",
740
+ "state_a": {},
741
+ "state_b": {
742
+ "x": null
743
+ },
744
+ "version": 1
745
+ },
746
+ "name": "missing_to_null",
747
+ "why": "absent to JSON null is Added carrying null"
748
+ },
749
+ {
750
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":null},\"state_b\":{},\"version\":1}",
751
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Removed\",\"old_value\":null,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
752
+ "input": {
753
+ "contract": "feltdb.state.diff",
754
+ "state_a": {
755
+ "x": null
756
+ },
757
+ "state_b": {},
758
+ "version": 1
759
+ },
760
+ "name": "null_to_missing",
761
+ "why": "JSON null to absent is Removed carrying null"
762
+ },
763
+ {
764
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":null},\"state_b\":{\"x\":1},\"version\":1}",
765
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":null,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
766
+ "input": {
767
+ "contract": "feltdb.state.diff",
768
+ "state_a": {
769
+ "x": null
770
+ },
771
+ "state_b": {
772
+ "x": 1
773
+ },
774
+ "version": 1
775
+ },
776
+ "name": "null_to_value",
777
+ "why": "null to a value is Changed, not Added"
778
+ },
779
+ {
780
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":null},\"version\":1}",
781
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
782
+ "input": {
783
+ "contract": "feltdb.state.diff",
784
+ "state_a": {
785
+ "x": 1
786
+ },
787
+ "state_b": {
788
+ "x": null
789
+ },
790
+ "version": 1
791
+ },
792
+ "name": "value_to_null",
793
+ "why": "a value to null is Changed, not Removed"
794
+ },
795
+ {
796
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":null},\"state_b\":{\"x\":null},\"version\":1}",
797
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
798
+ "input": {
799
+ "contract": "feltdb.state.diff",
800
+ "state_a": {
801
+ "x": null
802
+ },
803
+ "state_b": {
804
+ "x": null
805
+ },
806
+ "version": 1
807
+ },
808
+ "name": "null_to_null",
809
+ "why": "null against null reports nothing"
810
+ },
811
+ {
812
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":null},\"state_b\":{\"x\":false},\"version\":1}",
813
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":null,\"new_value\":false}],\"is_read_only\":false},\"version\":1}",
814
+ "input": {
815
+ "contract": "feltdb.state.diff",
816
+ "state_a": {
817
+ "x": null
818
+ },
819
+ "state_b": {
820
+ "x": false
821
+ },
822
+ "version": 1
823
+ },
824
+ "name": "null_to_false",
825
+ "why": "null and false are different values"
826
+ },
827
+ {
828
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":null},\"state_b\":{\"x\":{}},\"version\":1}",
829
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":null,\"new_value\":{}}],\"is_read_only\":false},\"version\":1}",
830
+ "input": {
831
+ "contract": "feltdb.state.diff",
832
+ "state_a": {
833
+ "x": null
834
+ },
835
+ "state_b": {
836
+ "x": {}
837
+ },
838
+ "version": 1
839
+ },
840
+ "name": "null_to_empty_object",
841
+ "why": "null to an empty object is a type transition"
842
+ },
843
+ {
844
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":null,\"b\":1,\"c\":null}},\"state_b\":{\"o\":{\"a\":1,\"b\":null,\"d\":null}},\"version\":1}",
845
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":null,\"new_value\":1},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"b\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":null},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"c\"}],\"kind\":\"Removed\",\"old_value\":null,\"new_value\":null},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"d\"}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
846
+ "input": {
847
+ "contract": "feltdb.state.diff",
848
+ "state_a": {
849
+ "o": {
850
+ "a": null,
851
+ "b": 1,
852
+ "c": null
853
+ }
854
+ },
855
+ "state_b": {
856
+ "o": {
857
+ "a": 1,
858
+ "b": null,
859
+ "d": null
860
+ }
861
+ },
862
+ "version": 1
863
+ },
864
+ "name": "nested_null_transitions",
865
+ "why": "the null and missing cases together one level down"
866
+ },
867
+ {
868
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1],\"state_b\":[1,2],\"version\":1}",
869
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":1}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
870
+ "input": {
871
+ "contract": "feltdb.state.diff",
872
+ "state_a": [
873
+ 1
874
+ ],
875
+ "state_b": [
876
+ 1,
877
+ 2
878
+ ],
879
+ "version": 1
880
+ },
881
+ "name": "array_append_one",
882
+ "why": "a longer array adds at the new index"
883
+ },
884
+ {
885
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1],\"state_b\":[1,2,3,4],\"version\":1}",
886
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":1}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2},{\"path\":[{\"Index\":2}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":3},{\"path\":[{\"Index\":3}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":4}],\"is_read_only\":false},\"version\":1}",
887
+ "input": {
888
+ "contract": "feltdb.state.diff",
889
+ "state_a": [
890
+ 1
891
+ ],
892
+ "state_b": [
893
+ 1,
894
+ 2,
895
+ 3,
896
+ 4
897
+ ],
898
+ "version": 1
899
+ },
900
+ "name": "array_append_many",
901
+ "why": "several appended elements"
902
+ },
903
+ {
904
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2],\"state_b\":[1],\"version\":1}",
905
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":1}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
906
+ "input": {
907
+ "contract": "feltdb.state.diff",
908
+ "state_a": [
909
+ 1,
910
+ 2
911
+ ],
912
+ "state_b": [
913
+ 1
914
+ ],
915
+ "version": 1
916
+ },
917
+ "name": "array_remove_tail",
918
+ "why": "a shorter array removes at the dropped index"
919
+ },
920
+ {
921
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2,3,4],\"state_b\":[1],\"version\":1}",
922
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":1}],\"kind\":\"Removed\",\"old_value\":2,\"new_value\":null},{\"path\":[{\"Index\":2}],\"kind\":\"Removed\",\"old_value\":3,\"new_value\":null},{\"path\":[{\"Index\":3}],\"kind\":\"Removed\",\"old_value\":4,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
923
+ "input": {
924
+ "contract": "feltdb.state.diff",
925
+ "state_a": [
926
+ 1,
927
+ 2,
928
+ 3,
929
+ 4
930
+ ],
931
+ "state_b": [
932
+ 1
933
+ ],
934
+ "version": 1
935
+ },
936
+ "name": "array_remove_many",
937
+ "why": "several removed elements"
938
+ },
939
+ {
940
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2,3],\"state_b\":[1,9,3],\"version\":1}",
941
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":9}],\"is_read_only\":false},\"version\":1}",
942
+ "input": {
943
+ "contract": "feltdb.state.diff",
944
+ "state_a": [
945
+ 1,
946
+ 2,
947
+ 3
948
+ ],
949
+ "state_b": [
950
+ 1,
951
+ 9,
952
+ 3
953
+ ],
954
+ "version": 1
955
+ },
956
+ "name": "array_index_replacement",
957
+ "why": "an element changed in place"
958
+ },
959
+ {
960
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2,3],\"state_b\":[9,2,8],\"version\":1}",
961
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":9},{\"path\":[{\"Index\":2}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":8}],\"is_read_only\":false},\"version\":1}",
962
+ "input": {
963
+ "contract": "feltdb.state.diff",
964
+ "state_a": [
965
+ 1,
966
+ 2,
967
+ 3
968
+ ],
969
+ "state_b": [
970
+ 9,
971
+ 2,
972
+ 8
973
+ ],
974
+ "version": 1
975
+ },
976
+ "name": "array_multiple_index_changes",
977
+ "why": "several elements changed in place"
978
+ },
979
+ {
980
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2],\"state_b\":[2,1],\"version\":1}",
981
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
982
+ "input": {
983
+ "contract": "feltdb.state.diff",
984
+ "state_a": [
985
+ 1,
986
+ 2
987
+ ],
988
+ "state_b": [
989
+ 2,
990
+ 1
991
+ ],
992
+ "version": 1
993
+ },
994
+ "name": "array_reorder_is_positional",
995
+ "why": "a reorder is reported per index, never as a move"
996
+ },
997
+ {
998
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2,3],\"state_b\":[3,1,2],\"version\":1}",
999
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":3},{\"path\":[{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":1},{\"path\":[{\"Index\":2}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1000
+ "input": {
1001
+ "contract": "feltdb.state.diff",
1002
+ "state_a": [
1003
+ 1,
1004
+ 2,
1005
+ 3
1006
+ ],
1007
+ "state_b": [
1008
+ 3,
1009
+ 1,
1010
+ 2
1011
+ ],
1012
+ "version": 1
1013
+ },
1014
+ "name": "array_reorder_three",
1015
+ "why": "a rotation reports every position that differs"
1016
+ },
1017
+ {
1018
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2],\"state_b\":[0,1,2],\"version\":1}",
1019
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":0},{\"path\":[{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":1},{\"path\":[{\"Index\":2}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1020
+ "input": {
1021
+ "contract": "feltdb.state.diff",
1022
+ "state_a": [
1023
+ 1,
1024
+ 2
1025
+ ],
1026
+ "state_b": [
1027
+ 0,
1028
+ 1,
1029
+ 2
1030
+ ],
1031
+ "version": 1
1032
+ },
1033
+ "name": "array_prepend_shifts_everything",
1034
+ "why": "a prepend is positional, so every index changes"
1035
+ },
1036
+ {
1037
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[{\"a\":1}],\"state_b\":[{\"a\":2}],\"version\":1}",
1038
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0},{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1039
+ "input": {
1040
+ "contract": "feltdb.state.diff",
1041
+ "state_a": [
1042
+ {
1043
+ "a": 1
1044
+ }
1045
+ ],
1046
+ "state_b": [
1047
+ {
1048
+ "a": 2
1049
+ }
1050
+ ],
1051
+ "version": 1
1052
+ },
1053
+ "name": "array_nested_change",
1054
+ "why": "a change inside an array element"
1055
+ },
1056
+ {
1057
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[[1,2]],\"state_b\":[[1,3]],\"version\":1}",
1058
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0},{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":3}],\"is_read_only\":false},\"version\":1}",
1059
+ "input": {
1060
+ "contract": "feltdb.state.diff",
1061
+ "state_a": [
1062
+ [
1063
+ 1,
1064
+ 2
1065
+ ]
1066
+ ],
1067
+ "state_b": [
1068
+ [
1069
+ 1,
1070
+ 3
1071
+ ]
1072
+ ],
1073
+ "version": 1
1074
+ },
1075
+ "name": "array_of_arrays",
1076
+ "why": "nesting through two array levels"
1077
+ },
1078
+ {
1079
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2],\"state_b\":[9,2,3],\"version\":1}",
1080
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":9},{\"path\":[{\"Index\":2}],\"kind\":\"Added\",\"old_value\":null,\"new_value\":3}],\"is_read_only\":false},\"version\":1}",
1081
+ "input": {
1082
+ "contract": "feltdb.state.diff",
1083
+ "state_a": [
1084
+ 1,
1085
+ 2
1086
+ ],
1087
+ "state_b": [
1088
+ 9,
1089
+ 2,
1090
+ 3
1091
+ ],
1092
+ "version": 1
1093
+ },
1094
+ "name": "array_grows_and_element_changes",
1095
+ "why": "a positional change and an append together"
1096
+ },
1097
+ {
1098
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[1,2,3],\"state_b\":[9,2],\"version\":1}",
1099
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":9},{\"path\":[{\"Index\":2}],\"kind\":\"Removed\",\"old_value\":3,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
1100
+ "input": {
1101
+ "contract": "feltdb.state.diff",
1102
+ "state_a": [
1103
+ 1,
1104
+ 2,
1105
+ 3
1106
+ ],
1107
+ "state_b": [
1108
+ 9,
1109
+ 2
1110
+ ],
1111
+ "version": 1
1112
+ },
1113
+ "name": "array_shrinks_and_element_changes",
1114
+ "why": "a positional change and a removal together"
1115
+ },
1116
+ {
1117
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":[1]},\"state_b\":{\"x\":{\"0\":1}},\"version\":1}",
1118
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":[1],\"new_value\":{\"0\":1}}],\"is_read_only\":false},\"version\":1}",
1119
+ "input": {
1120
+ "contract": "feltdb.state.diff",
1121
+ "state_a": {
1122
+ "x": [
1123
+ 1
1124
+ ]
1125
+ },
1126
+ "state_b": {
1127
+ "x": {
1128
+ "0": 1
1129
+ }
1130
+ },
1131
+ "version": 1
1132
+ },
1133
+ "name": "array_to_object",
1134
+ "why": "an array replaced by an object is one Changed"
1135
+ },
1136
+ {
1137
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":{\"0\":1}},\"state_b\":{\"x\":[1]},\"version\":1}",
1138
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":{\"0\":1},\"new_value\":[1]}],\"is_read_only\":false},\"version\":1}",
1139
+ "input": {
1140
+ "contract": "feltdb.state.diff",
1141
+ "state_a": {
1142
+ "x": {
1143
+ "0": 1
1144
+ }
1145
+ },
1146
+ "state_b": {
1147
+ "x": [
1148
+ 1
1149
+ ]
1150
+ },
1151
+ "version": 1
1152
+ },
1153
+ "name": "object_to_array",
1154
+ "why": "an object replaced by an array is one Changed"
1155
+ },
1156
+ {
1157
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":[1,2]},\"state_b\":{\"x\":1},\"version\":1}",
1158
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":[1,2],\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
1159
+ "input": {
1160
+ "contract": "feltdb.state.diff",
1161
+ "state_a": {
1162
+ "x": [
1163
+ 1,
1164
+ 2
1165
+ ]
1166
+ },
1167
+ "state_b": {
1168
+ "x": 1
1169
+ },
1170
+ "version": 1
1171
+ },
1172
+ "name": "array_to_scalar",
1173
+ "why": "an array replaced by a scalar"
1174
+ },
1175
+ {
1176
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":[1,2]},\"version\":1}",
1177
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":[1,2]}],\"is_read_only\":false},\"version\":1}",
1178
+ "input": {
1179
+ "contract": "feltdb.state.diff",
1180
+ "state_a": {
1181
+ "x": 1
1182
+ },
1183
+ "state_b": {
1184
+ "x": [
1185
+ 1,
1186
+ 2
1187
+ ]
1188
+ },
1189
+ "version": 1
1190
+ },
1191
+ "name": "scalar_to_array",
1192
+ "why": "a scalar replaced by an array"
1193
+ },
1194
+ {
1195
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":[]},\"state_b\":{\"x\":{}},\"version\":1}",
1196
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":[],\"new_value\":{}}],\"is_read_only\":false},\"version\":1}",
1197
+ "input": {
1198
+ "contract": "feltdb.state.diff",
1199
+ "state_a": {
1200
+ "x": []
1201
+ },
1202
+ "state_b": {
1203
+ "x": {}
1204
+ },
1205
+ "version": 1
1206
+ },
1207
+ "name": "empty_array_to_empty_object",
1208
+ "why": "two empty containers of different type"
1209
+ },
1210
+ {
1211
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[null,1],\"state_b\":[1,null],\"version\":1}",
1212
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":null,\"new_value\":1},{\"path\":[{\"Index\":1}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":null}],\"is_read_only\":false},\"version\":1}",
1213
+ "input": {
1214
+ "contract": "feltdb.state.diff",
1215
+ "state_a": [
1216
+ null,
1217
+ 1
1218
+ ],
1219
+ "state_b": [
1220
+ 1,
1221
+ null
1222
+ ],
1223
+ "version": 1
1224
+ },
1225
+ "name": "array_element_null_handling",
1226
+ "why": "null elements are values, not absences"
1227
+ },
1228
+ {
1229
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":[{\"a\":[{\"b\":1}]}],\"state_b\":[{\"a\":[{\"b\":2}]}],\"version\":1}",
1230
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Index\":0},{\"Key\":\"a\"},{\"Index\":0},{\"Key\":\"b\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1231
+ "input": {
1232
+ "contract": "feltdb.state.diff",
1233
+ "state_a": [
1234
+ {
1235
+ "a": [
1236
+ {
1237
+ "b": 1
1238
+ }
1239
+ ]
1240
+ }
1241
+ ],
1242
+ "state_b": [
1243
+ {
1244
+ "a": [
1245
+ {
1246
+ "b": 2
1247
+ }
1248
+ ]
1249
+ }
1250
+ ],
1251
+ "version": 1
1252
+ },
1253
+ "name": "nested_array_in_object_in_array",
1254
+ "why": "alternating container types"
1255
+ },
1256
+ {
1257
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":1},\"state_b\":{\"n\":2},\"version\":1}",
1258
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1259
+ "input": {
1260
+ "contract": "feltdb.state.diff",
1261
+ "state_a": {
1262
+ "n": 1
1263
+ },
1264
+ "state_b": {
1265
+ "n": 2
1266
+ },
1267
+ "version": 1
1268
+ },
1269
+ "name": "integer_change",
1270
+ "why": "integers compare by value"
1271
+ },
1272
+ {
1273
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":42},\"state_b\":{\"n\":42.0},\"version\":1}",
1274
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":42,\"new_value\":42.0}],\"is_read_only\":false},\"version\":1}",
1275
+ "input": {
1276
+ "contract": "feltdb.state.diff",
1277
+ "state_a": {
1278
+ "n": 42
1279
+ },
1280
+ "state_b": {
1281
+ "n": 42.0
1282
+ },
1283
+ "version": 1
1284
+ },
1285
+ "name": "integer_to_float_is_a_change",
1286
+ "why": "42 and 42.0 are different values"
1287
+ },
1288
+ {
1289
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":42.0},\"state_b\":{\"n\":42},\"version\":1}",
1290
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":42.0,\"new_value\":42}],\"is_read_only\":false},\"version\":1}",
1291
+ "input": {
1292
+ "contract": "feltdb.state.diff",
1293
+ "state_a": {
1294
+ "n": 42.0
1295
+ },
1296
+ "state_b": {
1297
+ "n": 42
1298
+ },
1299
+ "version": 1
1300
+ },
1301
+ "name": "float_to_integer_is_a_change",
1302
+ "why": "and the comparison is symmetric"
1303
+ },
1304
+ {
1305
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":0.125},\"state_b\":{\"n\":0.25},\"version\":1}",
1306
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":0.125,\"new_value\":0.25}],\"is_read_only\":false},\"version\":1}",
1307
+ "input": {
1308
+ "contract": "feltdb.state.diff",
1309
+ "state_a": {
1310
+ "n": 0.125
1311
+ },
1312
+ "state_b": {
1313
+ "n": 0.25
1314
+ },
1315
+ "version": 1
1316
+ },
1317
+ "name": "float_change",
1318
+ "why": "floats compare by value"
1319
+ },
1320
+ {
1321
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":3.141592653589793},\"state_b\":{\"n\":3.141592653589793},\"version\":1}",
1322
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1323
+ "input": {
1324
+ "contract": "feltdb.state.diff",
1325
+ "state_a": {
1326
+ "n": 3.141592653589793
1327
+ },
1328
+ "state_b": {
1329
+ "n": 3.141592653589793
1330
+ },
1331
+ "version": 1
1332
+ },
1333
+ "name": "float_unchanged",
1334
+ "why": "an equal float reports nothing"
1335
+ },
1336
+ {
1337
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":0},\"state_b\":{\"n\":1},\"version\":1}",
1338
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":0,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
1339
+ "input": {
1340
+ "contract": "feltdb.state.diff",
1341
+ "state_a": {
1342
+ "n": 0
1343
+ },
1344
+ "state_b": {
1345
+ "n": 1
1346
+ },
1347
+ "version": 1
1348
+ },
1349
+ "name": "zero_to_positive",
1350
+ "why": "zero is an ordinary value"
1351
+ },
1352
+ {
1353
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-7},\"state_b\":{\"n\":-8},\"version\":1}",
1354
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":-7,\"new_value\":-8}],\"is_read_only\":false},\"version\":1}",
1355
+ "input": {
1356
+ "contract": "feltdb.state.diff",
1357
+ "state_a": {
1358
+ "n": -7
1359
+ },
1360
+ "state_b": {
1361
+ "n": -8
1362
+ },
1363
+ "version": 1
1364
+ },
1365
+ "name": "negative_integers",
1366
+ "why": "negative integers are their own variant"
1367
+ },
1368
+ {
1369
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":18446744073709551615},\"state_b\":{\"n\":18446744073709551614},\"version\":1}",
1370
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":18446744073709551615,\"new_value\":18446744073709551614}],\"is_read_only\":false},\"version\":1}",
1371
+ "input": {
1372
+ "contract": "feltdb.state.diff",
1373
+ "state_a": {
1374
+ "n": 18446744073709551615
1375
+ },
1376
+ "state_b": {
1377
+ "n": 18446744073709551614
1378
+ },
1379
+ "version": 1
1380
+ },
1381
+ "name": "large_unsigned",
1382
+ "why": "a u64 near the top of the range survives the round trip"
1383
+ },
1384
+ {
1385
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-9223372036854775808},\"state_b\":{\"n\":-9223372036854775807},\"version\":1}",
1386
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":-9223372036854775808,\"new_value\":-9223372036854775807}],\"is_read_only\":false},\"version\":1}",
1387
+ "input": {
1388
+ "contract": "feltdb.state.diff",
1389
+ "state_a": {
1390
+ "n": -9223372036854775808
1391
+ },
1392
+ "state_b": {
1393
+ "n": -9223372036854775807
1394
+ },
1395
+ "version": 1
1396
+ },
1397
+ "name": "smallest_signed",
1398
+ "why": "i64::MIN survives the round trip"
1399
+ },
1400
+ {
1401
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":3.141592653589793},\"state_b\":{\"n\":2.718281828459045},\"version\":1}",
1402
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":3.141592653589793,\"new_value\":2.718281828459045}],\"is_read_only\":false},\"version\":1}",
1403
+ "input": {
1404
+ "contract": "feltdb.state.diff",
1405
+ "state_a": {
1406
+ "n": 3.141592653589793
1407
+ },
1408
+ "state_b": {
1409
+ "n": 2.718281828459045
1410
+ },
1411
+ "version": 1
1412
+ },
1413
+ "name": "float_precision",
1414
+ "why": "floats needing full precision re-encode identically"
1415
+ },
1416
+ {
1417
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":100000000000000.0,\"b\":1000000000000000.0,\"c\":1e+16,\"d\":0.0001,\"e\":0.00001,\"f\":1e-6},\"state_b\":{\"a\":200000000000000.0,\"b\":2000000000000000.0,\"c\":2e+16,\"d\":0.0002,\"e\":0.00002,\"f\":2e-6},\"version\":1}",
1418
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":100000000000000.0,\"new_value\":200000000000000.0},{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Changed\",\"old_value\":1000000000000000.0,\"new_value\":2000000000000000.0},{\"path\":[{\"Key\":\"c\"}],\"kind\":\"Changed\",\"old_value\":1e+16,\"new_value\":2e+16},{\"path\":[{\"Key\":\"d\"}],\"kind\":\"Changed\",\"old_value\":0.0001,\"new_value\":0.0002},{\"path\":[{\"Key\":\"e\"}],\"kind\":\"Changed\",\"old_value\":0.00001,\"new_value\":0.00002},{\"path\":[{\"Key\":\"f\"}],\"kind\":\"Changed\",\"old_value\":1e-6,\"new_value\":2e-6}],\"is_read_only\":false},\"version\":1}",
1419
+ "input": {
1420
+ "contract": "feltdb.state.diff",
1421
+ "state_a": {
1422
+ "a": 100000000000000.0,
1423
+ "b": 1000000000000000.0,
1424
+ "c": 1e+16,
1425
+ "d": 0.0001,
1426
+ "e": 0.00001,
1427
+ "f": 1e-6
1428
+ },
1429
+ "state_b": {
1430
+ "a": 200000000000000.0,
1431
+ "b": 2000000000000000.0,
1432
+ "c": 2e+16,
1433
+ "d": 0.0002,
1434
+ "e": 0.00002,
1435
+ "f": 2e-6
1436
+ },
1437
+ "version": 1
1438
+ },
1439
+ "name": "float_fixed_scientific_boundary",
1440
+ "why": "every value on both sides of the boundary is emitted, not just compared"
1441
+ },
1442
+ {
1443
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"hi\":1500000000000000.0,\"lo\":0.000015},\"state_b\":{\"hi\":2500000000000000.0,\"lo\":0.000025},\"version\":1}",
1444
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"hi\"}],\"kind\":\"Changed\",\"old_value\":1500000000000000.0,\"new_value\":2500000000000000.0},{\"path\":[{\"Key\":\"lo\"}],\"kind\":\"Changed\",\"old_value\":0.000015,\"new_value\":0.000025}],\"is_read_only\":false},\"version\":1}",
1445
+ "input": {
1446
+ "contract": "feltdb.state.diff",
1447
+ "state_a": {
1448
+ "hi": 1500000000000000.0,
1449
+ "lo": 0.000015
1450
+ },
1451
+ "state_b": {
1452
+ "hi": 2500000000000000.0,
1453
+ "lo": 0.000025
1454
+ },
1455
+ "version": 1
1456
+ },
1457
+ "name": "float_boundary_exponents_as_changed_values",
1458
+ "why": "the exponents where ryu switches notation appear as emitted old and new values"
1459
+ },
1460
+ {
1461
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"max\":1.7976931348623157e+308,\"min\":5e-324},\"state_b\":{\"max\":1.7976931348623157e+308,\"min\":1e-323},\"version\":1}",
1462
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"min\"}],\"kind\":\"Changed\",\"old_value\":5e-324,\"new_value\":1e-323}],\"is_read_only\":false},\"version\":1}",
1463
+ "input": {
1464
+ "contract": "feltdb.state.diff",
1465
+ "state_a": {
1466
+ "max": 1.7976931348623157e+308,
1467
+ "min": 5e-324
1468
+ },
1469
+ "state_b": {
1470
+ "max": 1.7976931348623157e+308,
1471
+ "min": 1e-323
1472
+ },
1473
+ "version": 1
1474
+ },
1475
+ "name": "float_extremes",
1476
+ "why": "the extremes of the double range"
1477
+ },
1478
+ {
1479
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":810553441865041.2,\"b\":-878105248543.0312},\"state_b\":{\"a\":810553441865041.2,\"b\":-280974579863322.12},\"version\":1}",
1480
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"b\"}],\"kind\":\"Changed\",\"old_value\":-878105248543.0312,\"new_value\":-280974579863322.12}],\"is_read_only\":false},\"version\":1}",
1481
+ "input": {
1482
+ "contract": "feltdb.state.diff",
1483
+ "state_a": {
1484
+ "a": 810553441865041.2,
1485
+ "b": -878105248543.0312
1486
+ },
1487
+ "state_b": {
1488
+ "a": 810553441865041.2,
1489
+ "b": -280974579863322.12
1490
+ },
1491
+ "version": 1
1492
+ },
1493
+ "name": "float_tie_break_values",
1494
+ "why": "values where two shortest representations differ in the last digit"
1495
+ },
1496
+ {
1497
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":\"1\"},\"state_b\":{\"n\":1},\"version\":1}",
1498
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":\"1\",\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
1499
+ "input": {
1500
+ "contract": "feltdb.state.diff",
1501
+ "state_a": {
1502
+ "n": "1"
1503
+ },
1504
+ "state_b": {
1505
+ "n": 1
1506
+ },
1507
+ "version": 1
1508
+ },
1509
+ "name": "numeric_string_is_not_a_number",
1510
+ "why": "a quoted digit and a number are a type transition"
1511
+ },
1512
+ {
1513
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":true},\"state_b\":{\"n\":1},\"version\":1}",
1514
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":true,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
1515
+ "input": {
1516
+ "contract": "feltdb.state.diff",
1517
+ "state_a": {
1518
+ "n": true
1519
+ },
1520
+ "state_b": {
1521
+ "n": 1
1522
+ },
1523
+ "version": 1
1524
+ },
1525
+ "name": "bool_is_not_a_number",
1526
+ "why": "true and 1 are a type transition"
1527
+ },
1528
+ {
1529
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"k0\":0,\"k1\":1,\"k10\":10,\"k11\":11,\"k2\":2,\"k3\":3,\"k4\":4,\"k5\":5,\"k6\":6,\"k7\":7,\"k8\":8,\"k9\":9}},\"state_b\":{\"o\":{\"k0\":0,\"k1\":2,\"k10\":20,\"k11\":22,\"k2\":4,\"k3\":6,\"k4\":8,\"k5\":10,\"k6\":12,\"k7\":14,\"k8\":16,\"k9\":18}},\"version\":1}",
1530
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k1\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k10\"}],\"kind\":\"Changed\",\"old_value\":10,\"new_value\":20},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k11\"}],\"kind\":\"Changed\",\"old_value\":11,\"new_value\":22},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k2\"}],\"kind\":\"Changed\",\"old_value\":2,\"new_value\":4},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k3\"}],\"kind\":\"Changed\",\"old_value\":3,\"new_value\":6},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k4\"}],\"kind\":\"Changed\",\"old_value\":4,\"new_value\":8},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k5\"}],\"kind\":\"Changed\",\"old_value\":5,\"new_value\":10},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k6\"}],\"kind\":\"Changed\",\"old_value\":6,\"new_value\":12},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k7\"}],\"kind\":\"Changed\",\"old_value\":7,\"new_value\":14},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k8\"}],\"kind\":\"Changed\",\"old_value\":8,\"new_value\":16},{\"path\":[{\"Key\":\"o\"},{\"Key\":\"k9\"}],\"kind\":\"Changed\",\"old_value\":9,\"new_value\":18}],\"is_read_only\":false},\"version\":1}",
1531
+ "input": {
1532
+ "contract": "feltdb.state.diff",
1533
+ "state_a": {
1534
+ "o": {
1535
+ "k0": 0,
1536
+ "k1": 1,
1537
+ "k10": 10,
1538
+ "k11": 11,
1539
+ "k2": 2,
1540
+ "k3": 3,
1541
+ "k4": 4,
1542
+ "k5": 5,
1543
+ "k6": 6,
1544
+ "k7": 7,
1545
+ "k8": 8,
1546
+ "k9": 9
1547
+ }
1548
+ },
1549
+ "state_b": {
1550
+ "o": {
1551
+ "k0": 0,
1552
+ "k1": 2,
1553
+ "k10": 20,
1554
+ "k11": 22,
1555
+ "k2": 4,
1556
+ "k3": 6,
1557
+ "k4": 8,
1558
+ "k5": 10,
1559
+ "k6": 12,
1560
+ "k7": 14,
1561
+ "k8": 16,
1562
+ "k9": 18
1563
+ }
1564
+ },
1565
+ "version": 1
1566
+ },
1567
+ "name": "repeated_nested_modifications",
1568
+ "why": "many changes under one subtree"
1569
+ },
1570
+ {
1571
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"o\":{\"a\":1},\"o2\":1},\"state_b\":{\"o\":{\"a\":2},\"o2\":2},\"version\":1}",
1572
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"o\"},{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"o2\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1573
+ "input": {
1574
+ "contract": "feltdb.state.diff",
1575
+ "state_a": {
1576
+ "o": {
1577
+ "a": 1
1578
+ },
1579
+ "o2": 1
1580
+ },
1581
+ "state_b": {
1582
+ "o": {
1583
+ "a": 2
1584
+ },
1585
+ "o2": 2
1586
+ },
1587
+ "version": 1
1588
+ },
1589
+ "name": "changes_at_related_paths",
1590
+ "why": "a member and its sibling subtree both change"
1591
+ },
1592
+ {
1593
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"arr\":[1],\"key\":1},\"state_b\":{\"arr\":[2],\"key\":2},\"version\":1}",
1594
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"arr\"},{\"Index\":0}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"key\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1595
+ "input": {
1596
+ "contract": "feltdb.state.diff",
1597
+ "state_a": {
1598
+ "arr": [
1599
+ 1
1600
+ ],
1601
+ "key": 1
1602
+ },
1603
+ "state_b": {
1604
+ "arr": [
1605
+ 2
1606
+ ],
1607
+ "key": 2
1608
+ },
1609
+ "version": 1
1610
+ },
1611
+ "name": "key_sorts_before_index_at_same_depth",
1612
+ "why": "a Key path component orders before an Index one"
1613
+ },
1614
+ {
1615
+ "canonical_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"a\":[{\"b\":[{\"c\":1}]}]},\"state_b\":{\"a\":[{\"b\":[{\"c\":2}]}]},\"version\":1}",
1616
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"},{\"Index\":0},{\"Key\":\"b\"},{\"Index\":0},{\"Key\":\"c\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1617
+ "input": {
1618
+ "contract": "feltdb.state.diff",
1619
+ "state_a": {
1620
+ "a": [
1621
+ {
1622
+ "b": [
1623
+ {
1624
+ "c": 1
1625
+ }
1626
+ ]
1627
+ }
1628
+ ]
1629
+ },
1630
+ "state_b": {
1631
+ "a": [
1632
+ {
1633
+ "b": [
1634
+ {
1635
+ "c": 2
1636
+ }
1637
+ ]
1638
+ }
1639
+ ]
1640
+ },
1641
+ "version": 1
1642
+ },
1643
+ "name": "mixed_container_shapes_at_depth",
1644
+ "why": "objects and arrays interleaved five deep"
1645
+ },
1646
+ {
1647
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"a\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2},{\"path\":[{\"Key\":\"z\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1648
+ "name": "unsorted_input_keys_are_normalised",
1649
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"z\":1,\"a\":1},\"state_b\":{\"z\":2,\"a\":2},\"version\":1}",
1650
+ "why": "canonical member order is how FeltDB emits input, not a parsing requirement"
1651
+ },
1652
+ {
1653
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1654
+ "name": "whitespace_around_document",
1655
+ "raw_input": " {\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1} ",
1656
+ "why": "insignificant whitespace does not change the result"
1657
+ },
1658
+ {
1659
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"x\"}],\"kind\":\"Changed\",\"old_value\":1,\"new_value\":2}],\"is_read_only\":false},\"version\":1}",
1660
+ "name": "envelope_members_in_any_order",
1661
+ "raw_input": "{\"version\":1,\"state_b\":{\"x\":2},\"state_a\":{\"x\":1},\"contract\":\"feltdb.state.diff\"}",
1662
+ "why": "the envelope is an object, so its member order is not semantic"
1663
+ },
1664
+ {
1665
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1666
+ "name": "duplicate_member_inside_state_resolves_last_wins",
1667
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1,\"x\":2},\"state_b\":{\"x\":2},\"version\":1}",
1668
+ "why": "a repeated member inside a state collapses to its last value, as a map-backed decoder does"
1669
+ },
1670
+ {
1671
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1672
+ "name": "non_canonical_number_is_normalised",
1673
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":1e2},\"state_b\":{\"n\":100.0},\"version\":1}",
1674
+ "why": "1e2 and 100.0 are the same float, so both sides normalise to the same encoding"
1675
+ },
1676
+ {
1677
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":100.0,\"new_value\":100}],\"is_read_only\":false},\"version\":1}",
1678
+ "name": "non_canonical_number_against_integer",
1679
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":1e2},\"state_b\":{\"n\":100},\"version\":1}",
1680
+ "why": "1e2 is a float and 100 is an integer, so they are a change"
1681
+ },
1682
+ {
1683
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":-0.0,\"new_value\":0}],\"is_read_only\":false},\"version\":1}",
1684
+ "name": "negative_zero_int_against_zero",
1685
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-0},\"state_b\":{\"n\":0},\"version\":1}",
1686
+ "why": "-0 is a float and never equals the integer 0"
1687
+ },
1688
+ {
1689
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1690
+ "name": "negative_zero_float_against_zero_float",
1691
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-0.0},\"state_b\":{\"n\":0.0},\"version\":1}",
1692
+ "why": "float equality is IEEE equality, under which -0.0 equals 0.0"
1693
+ },
1694
+ {
1695
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":-0.0,\"new_value\":1}],\"is_read_only\":false},\"version\":1}",
1696
+ "name": "negative_zero_is_re_encoded_with_its_sign",
1697
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-0},\"state_b\":{\"n\":1},\"version\":1}",
1698
+ "why": "-0 re-encodes as -0.0, keeping the sign an integer cannot hold"
1699
+ },
1700
+ {
1701
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1702
+ "name": "escaped_unicode_equals_literal_unicode",
1703
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"caf\\u00e9\"},\"state_b\":{\"s\":\"café\"},\"version\":1}",
1704
+ "why": "a \\u escape and literal UTF-8 decode to the same string, so no change is reported"
1705
+ },
1706
+ {
1707
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[],\"is_read_only\":false},\"version\":1}",
1708
+ "name": "surrogate_pair_escape_decodes",
1709
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"\\ud83d\\udd25\"},\"state_b\":{\"s\":\"🔥\"},\"version\":1}",
1710
+ "why": "an astral character written as a surrogate pair equals the literal one"
1711
+ },
1712
+ {
1713
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":1.8446744073709552e+19,\"new_value\":18446744073709551615}],\"is_read_only\":false},\"version\":1}",
1714
+ "name": "integer_beyond_u64_becomes_a_float",
1715
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":18446744073709551616},\"state_b\":{\"n\":18446744073709551615},\"version\":1}",
1716
+ "why": "an integer literal too large for u64 decodes as a float"
1717
+ },
1718
+ {
1719
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"diff\":{\"changes\":[{\"path\":[{\"Key\":\"n\"}],\"kind\":\"Changed\",\"old_value\":-9.223372036854776e+18,\"new_value\":-9223372036854775808}],\"is_read_only\":false},\"version\":1}",
1720
+ "name": "negative_integer_beyond_i64_becomes_a_float",
1721
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":-9223372036854775809},\"state_b\":{\"n\":-9223372036854775808},\"version\":1}",
1722
+ "why": "a negative literal too small for i64 decodes as a float"
1723
+ },
1724
+ {
1725
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1726
+ "name": "malformed_not_json",
1727
+ "raw_input": "not json at all",
1728
+ "why": "bytes that are not JSON at all"
1729
+ },
1730
+ {
1731
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1732
+ "name": "malformed_empty_input",
1733
+ "raw_input": "",
1734
+ "why": "zero bytes"
1735
+ },
1736
+ {
1737
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1738
+ "name": "malformed_truncated_object",
1739
+ "raw_input": "{\"state_a\":",
1740
+ "why": "a document that ends mid-value"
1741
+ },
1742
+ {
1743
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1744
+ "name": "malformed_trailing_content",
1745
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1} trailing",
1746
+ "why": "a complete document followed by more bytes"
1747
+ },
1748
+ {
1749
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1750
+ "name": "malformed_trailing_comma",
1751
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1,},\"state_b\":{\"x\":2},\"version\":1}",
1752
+ "why": "a trailing comma is not JSON"
1753
+ },
1754
+ {
1755
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1756
+ "name": "malformed_single_quotes",
1757
+ "raw_input": "{'contract':'feltdb.state.diff'}",
1758
+ "why": "single-quoted strings are not JSON"
1759
+ },
1760
+ {
1761
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1762
+ "name": "malformed_top_level_array",
1763
+ "raw_input": "[]",
1764
+ "why": "the envelope must be an object"
1765
+ },
1766
+ {
1767
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1768
+ "name": "malformed_top_level_string",
1769
+ "raw_input": "\"feltdb.state.diff\"",
1770
+ "why": "the envelope must be an object"
1771
+ },
1772
+ {
1773
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1774
+ "name": "malformed_missing_state_a",
1775
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_b\":{\"x\":2},\"version\":1}",
1776
+ "why": "a required member is absent"
1777
+ },
1778
+ {
1779
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1780
+ "name": "malformed_missing_state_b",
1781
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"version\":1}",
1782
+ "why": "a required member is absent"
1783
+ },
1784
+ {
1785
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1786
+ "name": "malformed_missing_contract",
1787
+ "raw_input": "{\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1788
+ "why": "a required member is absent"
1789
+ },
1790
+ {
1791
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1792
+ "name": "malformed_unknown_envelope_member",
1793
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"extra\":true,\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1794
+ "why": "the contract denies unknown members"
1795
+ },
1796
+ {
1797
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1798
+ "name": "malformed_duplicate_envelope_member",
1799
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1800
+ "why": "a repeated envelope member is rejected"
1801
+ },
1802
+ {
1803
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1804
+ "name": "malformed_version_is_float",
1805
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1.0}",
1806
+ "why": "version is an integer"
1807
+ },
1808
+ {
1809
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1810
+ "name": "malformed_version_is_negative",
1811
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":-1}",
1812
+ "why": "version is unsigned"
1813
+ },
1814
+ {
1815
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1816
+ "name": "malformed_contract_is_not_string",
1817
+ "raw_input": "{\"contract\":7,\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1818
+ "why": "contract identity is a string"
1819
+ },
1820
+ {
1821
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1822
+ "name": "malformed_leading_zero_number",
1823
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":01},\"state_b\":{\"n\":1},\"version\":1}",
1824
+ "why": "01 is not a JSON number"
1825
+ },
1826
+ {
1827
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1828
+ "name": "malformed_nan_literal",
1829
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":NaN},\"state_b\":{\"n\":1},\"version\":1}",
1830
+ "why": "NaN is not a JSON value"
1831
+ },
1832
+ {
1833
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1834
+ "name": "malformed_infinity_literal",
1835
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"n\":Infinity},\"state_b\":{\"n\":1},\"version\":1}",
1836
+ "why": "Infinity is not a JSON value"
1837
+ },
1838
+ {
1839
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1840
+ "name": "malformed_raw_control_character_in_string",
1841
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"a\nb\"},\"state_b\":{\"s\":\"x\"},\"version\":1}",
1842
+ "why": "an unescaped control character is not legal in a JSON string"
1843
+ },
1844
+ {
1845
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1846
+ "name": "malformed_lone_surrogate_escape",
1847
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"s\":\"\\ud83d\"},\"state_b\":{\"s\":\"x\"},\"version\":1}",
1848
+ "why": "an unpaired surrogate does not name a character"
1849
+ },
1850
+ {
1851
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1852
+ "name": "malformed_bare_key",
1853
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{n:1},\"state_b\":{\"n\":1},\"version\":1}",
1854
+ "why": "object keys must be quoted"
1855
+ },
1856
+ {
1857
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_ID_MISMATCH\"},\"version\":1}",
1858
+ "name": "contract_id_mismatch",
1859
+ "raw_input": "{\"contract\":\"feltdb.state.other\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1860
+ "why": "a well-formed input addressed to another contract"
1861
+ },
1862
+ {
1863
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_VERSION_UNSUPPORTED\"},\"version\":1}",
1864
+ "name": "contract_version_unsupported",
1865
+ "raw_input": "{\"contract\":\"feltdb.state.diff\",\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":2}",
1866
+ "why": "a well-formed input at an unimplemented version"
1867
+ },
1868
+ {
1869
+ "expected_output": "{\"contract\":\"feltdb.state.diff\",\"error\":{\"code\":\"CONTRACT_INPUT_INVALID\"},\"version\":1}",
1870
+ "name": "malformed_and_misaddressed",
1871
+ "raw_input": "{\"contract\":\"feltdb.state.other\",\"extra\":1,\"state_a\":{\"x\":1},\"state_b\":{\"x\":2},\"version\":1}",
1872
+ "why": "shape is validated before identity, so this is an input error"
1873
+ }
1874
+ ],
1875
+ "contract": "feltdb.state.diff",
1876
+ "contract_version": 1,
1877
+ "corpus_version": 1
1878
+ }