Repository navigation
Description
Background
BrowserDb::export_graph() documents that its output blob is "byte-for-bit compatible with native .graph files opened by the native binary" (src/browser/mod.rs:171). BrowserDb::import_graph() accepts a native-produced file.
This invariant is currently untested across the boundary. The only existing test (export_import_round_trip in src/browser/mod.rs) round-trips within the browser WASM environment; it does not verify interoperability with the native binary.
What to test
-
Native → Browser: produce a
.graphfile with the native binary (orMemoryBackend+PersistentFactStoragein a native test), serialise it to bytes, feed those bytes toBrowserDb::import_graph(), and assert queries return the expected results. -
Browser → Native: call
BrowserDb::export_graph()on a populated in-browser database, take the returned byte blob, load it viaPersistentFactStorage::<MemoryBackend>::load()(or write it to a temp file and open withMinigraf::open()), and assert the facts are readable.
Suggested approach
- A native integration test (in
tests/) can exercise the native → browser direction by building the.graphbytes using the storage layer directly, then deserialising them using the same layer, confirming the format is self-consistent. This is already implicitly tested via migration tests but not labelled as a cross-platform compat test. - The browser → native direction requires a
wasm-bindgen-testthat exports a blob and a companion native test that reads the same fixed binary fixture. A checked-in binary fixture (a small known.graphfile) could serve both directions. - Consider adding a fixture-based test: a small
.graphfile committed totests/fixtures/produced by the native binary, loaded by the browser WASM test suite viaimport_graph, and asserted to contain known facts.
Acceptance criteria
- At least one test verifies native-produced bytes are readable by
BrowserDb::import_graph() - At least one test verifies
BrowserDb::export_graph()bytes are readable by the native storage layer - Tests run in CI (native tests in
rust.yml; browser tests inwasm-browser.yml) - A format regression note is added to
CHANGELOG.md/TEST_COVERAGE.mdwhen the tests are added
Activity
test(compat): cross-platform .graph compatibility tests (issue #150)
chore(release): bump version to v0.20.0, doc-sync Phase 8.1 complete
chore(release): bump version to v0.20.0, doc-sync Phase 8.1 complete
chore(release): bump version to v0.20.0, doc-sync Phase 8.1 complete (#…