talex5/irmin-indexeddb

Irmin's binary format has changed in an incompatible way

talex5 opened this issue · 1 comments

Broken by #2. This is actually detected by the tests, but they're not run automatically as they require a browser:

Irmin-IndexedDB test
Deleting any previous test databases...
Created basic store. Checking it is empty...
Got [], as expected
Added test item. Reading it back...
Got value, as expected
Listing contents...
Got [/key], as expected
Head: fcfbcd4957fe4cfd2b6f43e1ec3dbe8981915f64
Parent: 233509c3580c21aa06502f05b3f9dff985878247
Dumping DB contents...
let ao = [
  "fcfbcd4957fe4cfd2b6f43e1ec3dbe8981915f64", "\020\2313,\190^\031\017\235\150\156\177N\139\001\155\209<\152\243^\000\253\160\208gX\000\004User\001\004test";
  "f32b67c7e26342af42efabc674d441dca0a281c5", "value";
  "e7332cbe5e1f11eb969cb14e8b019bd13c98f35e", "\001\003key\000\020\243+g\199\226cB\175B\239\171\198t\212A\220\160\162\129\197\000";
  "5ba93c9db0cff93f52b521d7420e43f6eda2784f", "\000";
  "47c6285c0e710635ab141fb75d4ee7d20b335e84", "\001\003key\000\020C\247\1709\015\026\002e\252-\231\001\0013\149\028\007\024\166~\000";
  "43f7aa390f1a0265fc2de7010133951c0718a67e", "value2";
  "233509c3580c21aa06502f05b3f9dff985878247", "\020G\198(\\\014q\0065\171\020\031\183]N\231\210\0113^\132\001\020\252\251\205IW\254L\253+oC\225\236=\190\137\129\145_d\253\160\208gX\000\004User\001\004test";
]
let rw = [
  "master", "\020#5\t\195X\012!\170\006P/\005\179\249\223\249\133\135\130G";
]
Testing ability to read v1 format db
ERROR: Ir_hash.Invalid(�)

The problem seems to be due to mirage/irmin#347, which added metadata to the entries. That shouldn't have mattered, since the default is Ir_hum.Unit but unfortunately bin_prot actually writes out data for (): https://github.com/janestreet/bin_prot/blob/b7bc5e0ba96d3df5d0108d0bdcfed67cfcbe63f4/src/size.ml#L89

let bin_size_unit () = 1

And also "Require all commits to have a root node" (mirage/irmin#350) made the root field non-optional, so we don't write out a tag for that any longer either.