Repository navigation
test(compat): cross-platform .graph file compatibility tests (closes #150) - #154
Merged
Merged
Conversation
Add two native integration tests and one browser wasm-bindgen-test verifying that .graph bytes are readable across the native ↔ browser WASM boundary. Native side (tests/cross_platform_compat_test.rs): - native_raw_page_bytes_round_trip: transact facts, checkpoint, read raw bytes, write to a second file, reload — mirrors export_graph / import_graph page concatenation semantics - fixture_readable_by_native: loads tests/fixtures/compat.graph (the committed binary fixture) via Minigraf::open and asserts known facts Browser side (src/browser/mod.rs): - native_fixture_readable_by_browser_db: embeds the same fixture via include_bytes!, calls BrowserDb::import_graph, asserts same facts — the native → browser direction of the cross-boundary test Fixture (tests/fixtures/compat.graph): - Generated by examples/generate_compat_fixture.rs - v7 format, two facts: :alice :name "Alice", :alice :age 30 - Committed so wasm-pack tests can embed it without a build step Closes #150 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
wasm-pack compiles integration tests for the browser target too. Minigraf::open() is not available on wasm32, causing compile errors. Add #![cfg(not(target_arch = "wasm32"))] to exclude the file entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #154 +/- ##
=======================================
Coverage 83.41% 83.41%
=======================================
Files 26 26
Lines 4837 4837
=======================================
Hits 4035 4035
Misses 802 802 🚀 New features to boost your workflow:
|
wasm-pack compiles examples when running browser tests. Add a no-op wasm32 main() so the example compiles cleanly under wasm-pack, while keeping the native implementation under cfg(not(target_arch = "wasm32")). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds tests for the native ↔ browser WASM
.graphfile format compatibility invariant documented inBrowserDb::export_graph/import_graph.tests/fixtures/compat.graph— committed binary fixture (v7, 28KB) with two known facts::alice :name "Alice"and:alice :age 30. Generated bycargo run --example generate_compat_fixture; regenerate only if the v7 format changes.examples/generate_compat_fixture.rs— documents how the fixture was produced and how to regenerate it.tests/cross_platform_compat_test.rs— two native integration tests:native_raw_page_bytes_round_trip: transacts facts, checkpoints, reads raw file bytes, writes them to a second path, reopens — mirrorsexport_graph/import_graphpage-concatenation semantics nativelyfixture_readable_by_native: loads the committed fixture viaMinigraf::open, asserts known factssrc/browser/mod.rs— addsnative_fixture_readable_by_browser_dbwasm-bindgen-test: embeds the same fixture viainclude_bytes!, callsBrowserDb::import_graph, asserts facts — the native → browser directionTest plan
cargo test --test cross_platform_compat_testpasses (native side)wasm-pack test --headless --chrome --features browserpasses (browser side, includingnative_fixture_readable_by_browser_db)🤖 Generated with Claude Code