Screen share 7: fluxer-proto streams, limits, capability adverts; fluxer-api preview endpoints #154

Closed
opened 2026-11-12 02:06:54 +00:00 by charles · 0 comments
Owner

Serialised across two crates (proto first, then api) because the endpoints are thin.

Files:

  • Create: crates/fluxer-proto/src/{stream.rs,limits.rs}, crates/fluxer-api/src/streams.rs, fixtures crates/fluxer-proto/fixtures/{gateway/voice_stream_*.json,rest/stream_preview_*.json,instance/limits_*.json}
  • Modify: crates/fluxer-proto/src/{lib.rs,rtc.rs,gateway/voice.rs,models/instance.rs}, crates/fluxer-proto/tests/spec_contract.rs, crates/fluxer-api/src/lib.rs
  • Test: crates/fluxer-proto/tests/{stream.rs,limits.rs,rtc.rs}, crates/fluxer-api/tests/streams.rs

Interfaces:

  • Produces (proto): StreamKey { scope: StreamScope::{Guild(Snowflake), Dm, Orphan}, channel_id: Option<Snowflake>, connection_id: String } with StreamKey::new(guild_id: Option<Snowflake>, channel_id, connection_id), FromStr, Display (spec §5); VoiceState.viewer_stream_keys: Option<Vec<String>> (absent ≠ empty; update existing users); rtc::SelectProtocol::with_capabilities(rtc_connection_id, encode: &[CodecName], decode: &[CodecName]) (voice_only = both empty, unchanged output); rtc::SessionUpdate::new(video_codec: CodecName, media_session_id: String, reason: NegotiationReason, codecs: Vec<CodecAdvert>); rtc::{MIGRATION_TOPIC, MigrationMessage::{Candidate, Ready, Commit, Abort, Break, Unknown}, MigrationMessage::parse} (≤ 4096 bytes, limits of spec §3.4); limits::{LimitConfig, LimitRule, LimitFilter, resolve(&LimitConfig, key: &str, traits: &Traits, guild_features: &BTreeSet<String>) -> Option<f64>} following packages/limits/src/LimitResolver.ts; WellKnown.limits: Option<LimitConfig>; StreamPreviewUploadUrl { upload_url: SecretString, method, content_type, expires_at, expires_in, max_bytes } (Debug hides the URL).

  • Produces (api): ApiClient::{stream_preview(&StreamKey) -> Result<Option<Bytes>, ApiError>, stream_preview_upload_url(&StreamKey, channel_id) -> Result<StreamPreviewUploadUrl, ApiError>, put_stream_preview(&StreamPreviewUploadUrl, jpeg: Bytes) -> Result<(), ApiError> (no auth header), post_stream_preview(&StreamKey, channel_id, jpeg: &[u8])}.

  • Step 1: Write failing tests: stream_key_forms_round_trip, orphan_key_parses_but_is_flagged, viewer_keys_absent_vs_empty, op4_sharer_and_viewer_fixtures_serialise_like_the_fork, capability_advert_flags_follow_arguments, voice_only_unchanged, session_update_shape, migration_messages_parse_and_oversize_rejected, limits_resolve_rules_with_filters, well_known_without_limits_still_parses, upload_url_debug_hides_url; wiremock preview_get_404_is_none, upload_url_then_put_without_auth, post_preview_sends_base64.

  • Step 2–5: FAIL → implement → PASS → commit feat(proto,api): stream keys, instance limits, capability adverts and preview endpoints.

Depends on: nothing (can start at once)

Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-screenshare.md
Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-screenshare-design.md

Serialised across two crates (proto first, then api) because the endpoints are thin. **Files:** - Create: `crates/fluxer-proto/src/{stream.rs,limits.rs}`, `crates/fluxer-api/src/streams.rs`, fixtures `crates/fluxer-proto/fixtures/{gateway/voice_stream_*.json,rest/stream_preview_*.json,instance/limits_*.json}` - Modify: `crates/fluxer-proto/src/{lib.rs,rtc.rs,gateway/voice.rs,models/instance.rs}`, `crates/fluxer-proto/tests/spec_contract.rs`, `crates/fluxer-api/src/lib.rs` - Test: `crates/fluxer-proto/tests/{stream.rs,limits.rs,rtc.rs}`, `crates/fluxer-api/tests/streams.rs` **Interfaces:** - Produces (proto): `StreamKey { scope: StreamScope::{Guild(Snowflake), Dm, Orphan}, channel_id: Option<Snowflake>, connection_id: String }` with `StreamKey::new(guild_id: Option<Snowflake>, channel_id, connection_id)`, `FromStr`, `Display` (spec §5); `VoiceState.viewer_stream_keys: Option<Vec<String>>` (absent ≠ empty; update existing users); `rtc::SelectProtocol::with_capabilities(rtc_connection_id, encode: &[CodecName], decode: &[CodecName])` (`voice_only` = both empty, unchanged output); `rtc::SessionUpdate::new(video_codec: CodecName, media_session_id: String, reason: NegotiationReason, codecs: Vec<CodecAdvert>)`; `rtc::{MIGRATION_TOPIC, MigrationMessage::{Candidate, Ready, Commit, Abort, Break, Unknown}, MigrationMessage::parse}` (≤ 4096 bytes, limits of spec §3.4); `limits::{LimitConfig, LimitRule, LimitFilter, resolve(&LimitConfig, key: &str, traits: &Traits, guild_features: &BTreeSet<String>) -> Option<f64>}` following `packages/limits/src/LimitResolver.ts`; `WellKnown.limits: Option<LimitConfig>`; `StreamPreviewUploadUrl { upload_url: SecretString, method, content_type, expires_at, expires_in, max_bytes }` (`Debug` hides the URL). - Produces (api): `ApiClient::{stream_preview(&StreamKey) -> Result<Option<Bytes>, ApiError>, stream_preview_upload_url(&StreamKey, channel_id) -> Result<StreamPreviewUploadUrl, ApiError>, put_stream_preview(&StreamPreviewUploadUrl, jpeg: Bytes) -> Result<(), ApiError>` (no auth header), `post_stream_preview(&StreamKey, channel_id, jpeg: &[u8])`}. - [ ] **Step 1: Write failing tests**: `stream_key_forms_round_trip`, `orphan_key_parses_but_is_flagged`, `viewer_keys_absent_vs_empty`, `op4_sharer_and_viewer_fixtures_serialise_like_the_fork`, `capability_advert_flags_follow_arguments`, `voice_only_unchanged`, `session_update_shape`, `migration_messages_parse_and_oversize_rejected`, `limits_resolve_rules_with_filters`, `well_known_without_limits_still_parses`, `upload_url_debug_hides_url`; wiremock `preview_get_404_is_none`, `upload_url_then_put_without_auth`, `post_preview_sends_base64`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(proto,api): stream keys, instance limits, capability adverts and preview endpoints`. Depends on: nothing (can start at once) Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-screenshare.md Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-screenshare-design.md
charles added this to the Screen share milestone 2026-11-12 02:06:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#154
No description provided.