refactor(tests): establish Sweettest scaffold (#61)#64
Merged
Conversation
8 tasks
Adds nondominium_sweettest crate at dnas/nondominium/tests/ with a
complete port of all 20 TypeScript test files to Rust Sweettest.
Sweettest runs in-process (no WebSocket round-trip) and directly uses
Holochain types, eliminating the msgpack decode layer. Uses the
Holochain team's recommended test framework for Holochain 0.7+.
## Infrastructure
- Workspace Cargo.toml: add nondominium_sweettest member + holochain/
tokio workspace deps with test_utils feature
- dnas/nondominium/tests/Cargo.toml: 4 [[test]] targets (misc, person,
resource, governance)
- common/ module: conductors (setup_two/three/dual_dna_agents), fixtures
(sample helpers + input structs), mirrors (coordinator output types),
zome_calls (typed wrappers for all 3 zomes)
- flake.nix: add llvmPackages_19.libclang + cmake + pkg-config for
datachannel-sys bindgen step; export LIBCLANG_PATH + BINDGEN_EXTRA_CLANG_ARGS
- package.json: add sweettest / sweettest:verbose / sweettest:only scripts
## Test modules (30 files, ~5500 lines of Rust)
Person: foundation (7), integration (7), hrea_bridge (3), device_foundation
(10), device_integration (4), device_multi (6), device_security (7),
capability_sharing (8), scenarios (4)
Resource: foundation (4), update (1), integration (7), scenarios (4)
Governance: foundation (1), ppr/{foundation (4), cryptography (5),
debug (4), integration (4), scenarios (4)}
Misc: ping (1)
## Status
All 4 test binaries compile with zero errors. TypeScript tests remain
intact during transition. Runtime test execution requires bun run build:happ
first to generate the .dna bundle files.
Error-path tests that require catching zome panics are marked #[ignore]
with explicit reasons. hREA bridge test uses integrity crate types for
entry decoding (PersonMirror -> zome_person_integrity::Person).
Closes #61
…bers The test crate has native-only deps (holochain, tokio, mio) that cannot compile to wasm32-unknown-unknown. Adding default-members ensures that `cargo build --target wasm32-unknown-unknown` only builds the zome crates.
…ol conflict Linking zome_person_integrity, zome_resource_integrity, and zome_gouvernance_integrity into one native test binary causes linker errors: multiple definition of '__num_entry_types' multiple definition of '__num_link_types' These C-level symbols are generated by #[hdk_entry_types]/#[hdk_link_types] macros in each integrity crate, and collide when all three are linked together. Fix: remove all three integrity crate deps. Replace every integrity type reference in the test crate with local mirror structs/enums using serde: - ResourceState, DeviceStatus, ParticipationClaimType local enums - VfAction as String (e.g. "Transfer") - Commitment/EconomicEvent/Claim as serde_json::Value - PersonMirror/ReaAgentMirror get holochain_serialized_bytes::SerializedBytes derive so to_app_option() still works for entry decoding
Remove API-coupled test files (fixtures, mirrors, zome_calls, and all per-zome test modules). The current tests mirror the pre-NDO API which will be torn up in the NDO refactor (ndo_prima_materia.md §10). Keep: - Workspace config (Cargo.toml, flake.nix, package.json, test crate Cargo.toml) - common/conductors.rs — framework-level, API-independent - misc/mod.rs — ping test, validates the full build chain end-to-end Per-zome tests (person/, resource/, governance/) will be co-evolved alongside each NDO refactor implementation PR so tests never become stale by design.
603c35d to
d918c01
Compare
- Cargo.toml: replace tokio features = ["full"] with the three features actually needed by sweettest (rt-multi-thread, time, macros) - conductors.rs: expand HREA_DNA_PATH doc comment — clarifies it is only used by setup_dual_dna_two_agents(), requires hREA submodule initialized and built, and panics at runtime (not compile time) if the .dna is absent
Document that workspace members globs do not carry through to default-members. New zomes added via glob must be listed in default-members explicitly to preserve WASM build isolation.
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.
Intent
Tryorama (
@holochain/tryorama) is officially unmaintained for Holochain 0.7+. We are on the last supported pair (HDK 0.6.0 / Tryorama 0.19.0). This PR establishes the Sweettest scaffold — the workspace config, build tooling, and conductor infrastructure — that unblocks the 0.7 upgrade path.Per-zome tests are not included here. The NDO refactor (
ndo_prima_materia.md§10) will touch every zome API. Writing tests against the current API now means rewriting them immediately after. Instead, each NDO implementation PR will co-evolve its own Sweettest tests alongside the API it introduces.Changes
New test crate at
dnas/nondominium/tests/:Cargo.toml—nondominium_sweettestcrate with[[test]]target formiscsrc/common/conductors.rs— framework-level conductor helpers:setup_two_agents(),setup_three_agents(),setup_dual_dna_two_agents(); API-independent, survives any zome refactorsrc/misc/mod.rs—pingtest: callsmisc::pingand asserts"Pong"; validates the full build chain end-to-endWorkspace changes:
Cargo.toml— addnondominium_sweettestworkspace member +default-membersto exclude the native crate from WASM builds +holochain = "=0.6.0"withtest_utilsfeature +tokioworkspace dep (trimmed tort-multi-thread,time,macros)flake.nix— addllvmPackages_19.libclang,cmake,pkg-config; exportLIBCLANG_PATHandBINDGEN_EXTRA_CLANG_ARGS(required fordatachannel-sysbindgen step)package.json— addsweettest/sweettest:verbose/sweettest:onlyscriptsTypeScript Tryorama tests remain unchanged and are the active test suite during the transition.
Post-review improvements:
conductors.rs: expandedHREA_DNA_PATHdoc comment to document runtime-panic semantics and submodule prerequisitesCargo.toml: added maintenance note warning thatmembersglobs do not carry through todefault-members; new zomes must be listed in both placesDecisions
holochainoncegetrandom_backend— not host-compilablellvmPackages_19is already in nixpkgs; noflake updateneededCARGO_TARGET_DIR=target/native-testsisolates the native Sweettest build from thewasm32-unknown-unknownartifacts thatbun run build:zomesproduces.How to test
Expected output: 1 test (
misc::ping) passing.To verify the crate compiles without running tests:
CARGO_TARGET_DIR=target/native-tests cargo check -p nondominium_sweettest --tests # Expected: 0 errors, 0 warningsDocumentation
Updated
documentation/Testing_Infrastructure.md: added Sweettest scaffold section (location, commands, environment requirements, co-evolution strategy).Updated
documentation/TEST_COMMANDS.md: added Sweettest commands, updated Tryorama section status.Related
Closes #61