2.5 KiB
2.5 KiB
QA Plan: Community Profile Sync
Scope
Validate that opt-in community membership is correctly persisted, rebuilt on restart, and that signal forwarding routes events to community aggregates without affecting the primary signal write path.
Test Suite
Unit Tests (lib)
| Module | Test | Validates |
|---|---|---|
entities/community.rs |
add_and_get |
add() inserts; get() returns sorted list |
entities/community.rs |
add_idempotent |
Adding same community twice yields one entry |
entities/community.rs |
contains_present_and_absent |
contains() returns true/false correctly |
entities/community.rs |
get_unknown_user_empty |
Returns empty vec for user with no memberships |
entities/community.rs |
entry_count_multiple |
Counts (user, community) pairs correctly |
storage/keys.rs |
tag_byte_never_zero |
CommunityMembership byte != 0x00 |
storage/keys.rs |
all_tags_have_unique_bytes |
No tag byte collision |
storage/keys.rs |
tag_roundtrip_all_variants |
CommunityMembership roundtrips |
Integration Tests (tidal/tests/m9_community_sync.rs)
| Test | Input | Expected |
|---|---|---|
join_and_query_membership |
join_community(1, "jazz") |
is_community_member == true; get_community_memberships == ["jazz"] |
signal_routes_to_community_aggregate |
Member writes signal | Community aggregate shows count=1 |
nonmember_signal_not_forwarded |
Non-member writes signal | Community aggregate shows count=0 |
multiple_communities_independent |
User in 2 communities, one signal | Both aggregates show count=1 |
membership_persists_across_restart |
Close + reopen | Memberships restored from storage |
join_idempotent |
Join twice | One membership in result |
invalid_community_name_empty |
Empty name | TidalError::InvalidInput |
invalid_community_name_too_long |
65-char name | TidalError::InvalidInput |
forwarding_does_not_block_primary_write |
Signal write with community member | Base ledger updated regardless |
community_aggregate_windowed_count |
3 signals from member | Count=3 in community aggregate |
Execution
cargo test --manifest-path tidal/Cargo.toml --lib
cargo test --manifest-path tidal/Cargo.toml --test m9_community_sync
cargo clippy --manifest-path tidal/Cargo.toml --lib -- -D warnings
cargo fmt --manifest-path tidal/Cargo.toml -- --check
Pass criteria: All 10 integration tests pass. All lib tests pass. Clippy clean. Fmt clean.