Skip to content

ci: gate the cross-language warden-v1 KAT (Rust/FFI/WASM)#7

Merged
nandal merged 1 commit into
mainfrom
ci/cross-language-kat
Jun 24, 2026
Merged

ci: gate the cross-language warden-v1 KAT (Rust/FFI/WASM)#7
nandal merged 1 commit into
mainfrom
ci/cross-language-kat

Conversation

@nandal

@nandal nandal commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

The warden-v1 envelope is implemented in three places that must stay byte-for-byte identicalcore/ (Rust, reference), ffi/ (the C-ABI Dart calls), and wasm/ (what the TS SDK calls). If any port drifts, a payload sealed by one and a condition evaluated by another never line up and nothing decrypts. The KAT/round-trip tests already exist in-tree, but the only CI workflow was mobile-ci.yml (native build-check) — nothing actually ran the cross-language vectors, so drift could land silently.

Change summary

New kat workflow, two jobs:

  • rust-katcargo test -p warden-core -p warden-ffi (the core/tests/vectors.rs identity/canonical KATs + the ffi/tests/ffi_roundtrip.rs C-ABI cross-language fixture), plus a drift guard: regenerate wasm/test/fixture.json from warden-core and fail if the committed copy is stale — the exact silent-drift case the WASM and FFI ports validate against.
  • wasm-katwasm-pack build --target nodejs + node test/round_trip.cjs, validating the WASM port against the same fixture and the committed identity (47fce3a1…06cdb68e).

Follows mobile-ci.yml conventions: pinned dtolnay/rust-toolchain@1.83.0, Swatinem/rust-cache, --locked, path filters. Prebuilt wasm-pack (no edition2024 tooling build, so the crate compiles under the pinned 1.83).

Tests

Verified locally (Rust 1.83 + wasm-pack + node 24):

  • core KAT: 2/2 pass
  • ffi_matches_the_cross_language_fixture: pass
  • wasm/test/round_trip.cjs: ✓ identity, combine, open_gated, seal→open, noise-tolerant combine
  • drift guard: regenerated fixture is byte-identical to the committed one

Risk

CI-only; no library/runtime change. Worst case is a flaky build job, not a shipped regression. The drift guard is deterministic (seeded RNG + canonical serialization), confirmed reproducible.

Backwards-compat

None affected — adds a workflow, touches no crate.


Closes the warden CI KAT leg of the migration epic (bytesbrains/maktub-app#90).

🤖 Generated with Claude Code

The condition identity and warden-gate-v1 seal/open must be byte-for-byte
identical across every port, or a payload sealed by one and a condition
evaluated by another never line up and nothing decrypts. The tests already
exist in-tree (core/tests/vectors.rs, ffi/tests/ffi_roundtrip.rs,
wasm/test/round_trip.cjs against the core-generated fixture) but nothing ran
them in CI — only mobile-ci.yml (native build-check) existed.

Add a `kat` workflow:
- rust-kat: core identity/canonical KATs + the FFI C-ABI cross-language
  fixture (`cargo test -p warden-core -p warden-ffi`), plus a drift guard that
  regenerates wasm/test/fixture.json from warden-core and fails if the
  committed copy is stale (the silent-drift case the WASM/FFI ports rely on).
- wasm-kat: wasm-pack build (nodejs) + node round_trip.cjs, validating WASM
  against the same fixture and the committed identity.

Verified locally (Rust 1.83 + wasm-pack + node): core KAT 2/2, ffi fixture
test green, wasm round-trip green, fixture regeneration byte-identical.

Closes the warden CI KAT leg of the migration epic (bytesbrains/maktub-app#90).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nandal
nandal merged commit 02ffdaa into main Jun 24, 2026
2 checks passed
@nandal
nandal deleted the ci/cross-language-kat branch June 24, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant