Download this file
| 1 | #!/usr/bin/env bash |
| 2 | # The wire-compatibility gate, both directions. This is the CRDT half of the |
| 3 | # spec's §0: two implementations, fixtures as the contract. |
| 4 | set -euo pipefail |
| 5 | cd "$(dirname "$0")/.." |
| 6 | |
| 7 | echo "--- regenerating fixtures from JS yjs" |
| 8 | (cd fixtures && node generate.mjs) |
| 9 | |
| 10 | echo "--- fixtures must be unchanged (they are the contract, not an output)" |
| 11 | if ! git diff --quiet -- fixtures/data; then |
| 12 | echo "wire-gate: fixtures changed. If deliberate, commit them WITH the rule change." >&2 |
| 13 | git diff --stat -- fixtures/data >&2 |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | echo "--- Rust reads what JS wrote" |
| 18 | (cd core && cargo test --test wire_compat) |
| 19 | |
| 20 | echo "--- JS reads what Rust wrote" |
| 21 | (cd core && cargo run --quiet --locked --bin emit_update) | node fixtures/verify-rust.mjs |
| 22 | |
| 23 | echo "wire-gate: ok" |
| 24 | |