Voice 1: fluxer-proto voice gateway types (#62) #102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "voice-1-proto-voice-gateway"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
The gateway half of voice in
fluxer-proto(spec §4, facts §1), in the new modulegateway::voice:VoiceStateUpdateParams—dof op 4, withjoin(..),leave(..)andinto_envelope(). Every member is written (connection_id: nullon a fresh join),p2pis never sent.VoiceState—VOICE_STATE_UPDATEand the entries ofvoice_states. Onlyuser_idandconnection_idare required; absent andnullmembers read the same; an unreadablememberis dropped, not the state.VoiceServerUpdate::{Sfu { token, endpoint, connection_id, guild_id, channel_id, e2ee_key }, P2p}—token/e2ee_keyareSecretString, there is noSerialize, andDebugprints<redacted>(also throughGatewayEvent'sDebugand throughProtoError).CallData(aliasesCallCreate,CallUpdate),CallDelete,CallVoiceState.GatewayErrorCodeandGatewayError { code, message }(dof op 12).GatewayEvent::{VoiceStateUpdate, VoiceServerUpdate, CallCreate, CallUpdate, CallDelete}; the five names moved fromUNTYPED_IN_FOUNDATIONtoTYPED_DISPATCH_NAMES.GuildReadyData::voice_statesis nowVec<VoiceState>(it serves bothREADY.guildsandGUILD_CREATE). An entry that does not parse is skipped so one bad voice state cannot fail aREADY.fixtures/gateway/voice_*.json(eight frames), README section "Voice".How it was tested
crates/fluxer-proto/tests/voice.rs, written first and seen failing:op4_join_serialises_like_the_fork,op4_leave_form,voice_state_minimal_and_full_fixture,voice_server_update_sfu_and_p2p,voice_server_update_debug_hides_secrets,call_events_roundtrip,ready_with_voice_states,unknown_voice_error_code_is_tolerated. The existingall_84_dispatch_names_are_classifiedcovers the moved names.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally.Deviations from the plan
voice/1-proto-voice-gatewaycannot be pushed: the remote has the branchvoice, and git refusesvoice/<anything>beside it (refname conflict). This branch isvoice-1-proto-voice-gateway. Every later Voice task will hit the same thing.GatewayErrorCode::Unknown(String), notUnknown(u32). On the wire the codes are strings ("VOICE_CHANNEL_FULL";GatewayConstants.ts:49-75,gateway_handler_dispatch.erl:126-131), so au32cannot hold an unknown one. The enum is thereforeClonebut notCopy. A numeric code is still accepted and kept as its digits.fixtures/gateway/at the repo root, notcrates/fluxer-proto/fixtures/gateway/: that is where the merged tests and the devserver read gateway fixtures from.ClientProperties, notIdentifyProperties. The merged type already haspub e2ee_capable: booldefaulting tofalse; only its documentation changed.crates/fluxer-proto/Cargo.toml(+Cargo.lock), outside the Files list:secrecy.workspace = true, needed forSecretString. It is already a workspace dependency (used byfluxer-coreandfluxer-api);cargo denyis unchanged. Alsocrates/fluxer-proto/README.md, per CLAUDE.md.ready_with_voice_statesbuilds its payload from the existingready.json/guild_create.jsonplus the voice-state fixtures instead of adding a second fullREADYfixture.connection_idofVoiceStateis required (the server's default map allowsnull, but a state without one cannot be keyed); such a dispatch isProtoError::Malformedand such a list entry is skipped.VoiceStateUpdateParams::{join, leave},VoiceServerUpdate::connection_id(),GatewayError,GatewayErrorCode::as_str().Closes #62
🤖 Generated with Claude Code
Independent review: Voice 1 (proto voice gateway types), commit
2be0cffReviewed
8b37da4..origin/voice-1-proto-voice-gatewaycold, against the plan's Task 1, facts §1 and the fork (GatewayConstants.ts,GatewaySocket.ts,gateway_errors.erl,voice_state_utils.erl).Local gate:
cargo xtask ciin a fresh worktree with its own target dir: all steps passed (fmt, clippy, deny, core-isolation, parity, test;tests/voice.rs8/8). The screenshot step was skipped because I ran it withoutFLUXER_SCREENSHOT_TESTS=1; this diff touches no UI.Checked and fine
op4_join_serialises_like_the_forkcompares the whole frame with facts §1's join form (connection_id: null, nop2p);op4_leave_formmatchessendVoiceStateDisconnect; the Debug test also coversGatewayEvent's Debug and theProtoErrorof a malformed payload.VoiceStateUpdateParams(fields andinto_envelope, op 4),VoiceState(guild_id: Option<Snowflake>,version: Option<u64>),VoiceServerUpdate::{Sfu {..}, P2p}withSecretStringsecrets,CallCreate/CallUpdate/CallData,CallDelete,CallVoiceState, the fiveGatewayEventvariants,voice_states: Vec<VoiceState>onGuildReadyData(serves both READY and GUILD_CREATE),e2ee_capabledefaulting tofalse. All re-exported fromfluxer_proto::gateway.Error a dropped list entry).VoiceServerUpdatehas noSerializeand a redactingDebug. Fixture secrets are placeholders (fixture.livekit.jwt,fixture-shared-key), host isfluxer.example.secrecywas already a workspace dependency; deny is green.GatewayErrorCodesplus the gateway-only ones ingateway_errors.erl; wire strings match.voice_stateslists (the implementer asked): confirmed as the right call. One unreadable entry must not cost a READY, and it matches howproperties: Option<Guild>already treats an unavailable guild.--record, is tested in Voice 14; this type's part of it is done).Findings
GatewayErrorCode::Unknown(String)instead of the plan'sUnknown(u32); the enum isClone, notCopy. The deviation is correct: the fork sends codes as strings (GatewayConstants.ts:49-75,gateway_errors.erl), soUnknown(u32)could not hold one. Voice 7'sVoiceFailure::Gateway(GatewayErrorCode)still compiles but cannot deriveCopy; the plan's Task 1 Interfaces line should be corrected so Voice 7/23 build against the merged type.voice_statesentries are silent.lenient_vecdiscards unreadable entries with no count or signal, so a server-side shape change would show up as people missing from voice with nothing in the log. The crate is pure and cannot log; worth a follow-up only if it ever bites (e.g. return the number dropped for Voice 6 to log).fixtures/gateway/voice_*.json, notcrates/fluxer-proto/fixtures/; the type isClientProperties, notIdentifyProperties; the branch isvoice-1-proto-voice-gatewaybecause the remote cannot holdvoice/<x>beside avoicebranch. Every later Voice task will hit the same branch-name conflict, so the plan's Global Constraints should sayvoice-N-<slug>.VoiceState.connection_idis required, although the fork's default map spells itnull. Every broadcast path I read sets it, and there is nothing to key a state on without it, so aMalformed(logged, skipped) dispatch is acceptable. Noting it so Voice 6 does not assume otherwise.Verdict: APPROVE — 0 blocking, 4 minor; local ci green.