Screen share 20: fluxer-devserver screenshare scenario (#167) #222

Manually merged
charles merged 0 commits from screenshare-20-devserver-screenshare into screenshare 2026-11-12 07:59:55 +00:00
Owner

What this builds

The fluxer-devserver screenshare scenario (plan Task 20, spec §3.2, §3.6, §12):

  • Scenario fixtures/scenarios/screenshare.toml + fixtures/gateway/screenshare_ready.json (the voice guild, owned by relay so the signed-in Moderator is bound by overwrites; @everyone has SPEAK + STREAM except in Gaming, which denies STREAM; ada streams in Hangout with her own key, grace and hedy watch her) + fixtures/media/stream_preview.jpg served for ada's key.
  • Op 4 viewer keys, as the gateway (guild_voice_connection_util.erl, dm_voice_state.erl): the field left out keeps the list (DMs read it as empty), null clears it, a non-list is VOICE_INVALID_STATE; every key must be a 3-part key of the op 4's channel and scope naming a connection in that channel, otherwise the whole op 4 fails (VOICE_CONNECTION_NOT_FOUND for an unknown connection, VOICE_INVALID_STATE otherwise) and nothing changes. A move starts with no keys. gateway.rs takes viewer_stream_keys out of the raw d (new ViewerKeys) before decoding the rest, so absent / null / wrong stay distinguishable.
  • STREAM per channel: self_stream / self_video forced off without it (permission computed like the fork's computePermissions: owner, roles, ADMINISTRATOR, overwrites).
  • Previews: GET /streams/{key}/preview (JPEG, no-store, or 404), POST .../preview/upload-url (local presigned PUT /stream-previews/{token}, 1 day, max_bytes 1 000 000), POST .../preview (base64). Mutations check key format, channel match, scope, STREAM (MISSING_PERMISSIONS) and ownership (ACCESS_DENIED); bodies must be JPEG and at most 1 000 000 bytes (PREVIEW_MUST_BE_JPEG, FILE_SIZE_TOO_LARGE).
  • Scripted steps: start_stream, stop_stream, viewer_join, viewer_leave, revoke_stream_permission (CHANNEL_UPDATE, then self_stream/self_video cleared for everyone there who lost it, the signed-in user included). VoiceScript::streams() returns LiveStream { user_id, guild_id, channel_id, connection_id, key, viewers } with identity() = user_<user>_<connection>: what the app's fake room follows to publish a test-pattern screen_share per remote stream.

How it was tested

crates/fluxer-devserver/tests/screenshare.rs, against the real fluxer-api and fluxer-gateway: the plan's five (op4_with_valid_keys_updates_state, op4_with_foreign_key_is_rejected_whole, self_stream_forced_false_without_permission, preview_upload_url_put_then_get, non_jpeg_preview_rejected) plus screenshare_scenario_starts_with_ada_streaming_to_two_viewers, stream_steps_change_the_streamer_and_viewers, revoking_stream_permission_stops_every_stream_in_the_channel. The existing basic/voice tests still pass. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No capture/encoder/device tests apply to this task.

Deviations from the plan

  • The scenario lives in fixtures/scenarios/ (the crate's format), not crates/fluxer-devserver/scenarios/.
  • Preview bodies are checked more strictly than the API: the bytes must look like JPEG and a given content type must name JPEG (the API accepts either), to catch client mistakes. Documented in the README.
  • VoiceStep::user_id() now returns Option<Snowflake> (revoke_stream_permission is about a channel); the one caller in tests/voice.rs is updated.
  • Wiring streams() into the app's --devserver fake room (apps/fluxer/src/runtime.rs follow_script) is left to Screen share 21, which owns runtime.rs; this task stays inside fluxer-devserver plus fixtures.

Closes #167

🤖 Generated with Claude Code

## What this builds The `fluxer-devserver` `screenshare` scenario (plan Task 20, spec §3.2, §3.6, §12): - **Scenario** `fixtures/scenarios/screenshare.toml` + `fixtures/gateway/screenshare_ready.json` (the voice guild, owned by relay so the signed-in Moderator is bound by overwrites; `@everyone` has SPEAK + STREAM except in Gaming, which denies STREAM; ada streams in Hangout with her own key, grace and hedy watch her) + `fixtures/media/stream_preview.jpg` served for ada's key. - **Op 4 viewer keys, as the gateway** (`guild_voice_connection_util.erl`, `dm_voice_state.erl`): the field left out keeps the list (DMs read it as empty), `null` clears it, a non-list is `VOICE_INVALID_STATE`; every key must be a 3-part key of the op 4's channel and scope naming a connection in that channel, otherwise the **whole op 4** fails (`VOICE_CONNECTION_NOT_FOUND` for an unknown connection, `VOICE_INVALID_STATE` otherwise) and nothing changes. A move starts with no keys. `gateway.rs` takes `viewer_stream_keys` out of the raw `d` (new `ViewerKeys`) before decoding the rest, so absent / null / wrong stay distinguishable. - **STREAM per channel**: `self_stream` / `self_video` forced off without it (permission computed like the fork's `computePermissions`: owner, roles, ADMINISTRATOR, overwrites). - **Previews**: `GET /streams/{key}/preview` (JPEG, `no-store`, or 404), `POST .../preview/upload-url` (local presigned `PUT /stream-previews/{token}`, 1 day, `max_bytes` 1 000 000), `POST .../preview` (base64). Mutations check key format, channel match, scope, STREAM (`MISSING_PERMISSIONS`) and ownership (`ACCESS_DENIED`); bodies must be JPEG and at most 1 000 000 bytes (`PREVIEW_MUST_BE_JPEG`, `FILE_SIZE_TOO_LARGE`). - **Scripted steps**: `start_stream`, `stop_stream`, `viewer_join`, `viewer_leave`, `revoke_stream_permission` (CHANNEL_UPDATE, then self_stream/self_video cleared for everyone there who lost it, the signed-in user included). `VoiceScript::streams()` returns `LiveStream { user_id, guild_id, channel_id, connection_id, key, viewers }` with `identity()` = `user_<user>_<connection>`: what the app's fake room follows to publish a test-pattern `screen_share` per remote stream. ## How it was tested `crates/fluxer-devserver/tests/screenshare.rs`, against the real `fluxer-api` and `fluxer-gateway`: the plan's five (`op4_with_valid_keys_updates_state`, `op4_with_foreign_key_is_rejected_whole`, `self_stream_forced_false_without_permission`, `preview_upload_url_put_then_get`, `non_jpeg_preview_rejected`) plus `screenshare_scenario_starts_with_ada_streaming_to_two_viewers`, `stream_steps_change_the_streamer_and_viewers`, `revoking_stream_permission_stops_every_stream_in_the_channel`. The existing `basic`/`voice` tests still pass. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No capture/encoder/device tests apply to this task. ## Deviations from the plan - The scenario lives in `fixtures/scenarios/` (the crate's format), not `crates/fluxer-devserver/scenarios/`. - Preview bodies are checked more strictly than the API: the bytes must look like JPEG **and** a given content type must name JPEG (the API accepts either), to catch client mistakes. Documented in the README. - `VoiceStep::user_id()` now returns `Option<Snowflake>` (`revoke_stream_permission` is about a channel); the one caller in `tests/voice.rs` is updated. - Wiring `streams()` into the app's `--devserver` fake room (`apps/fluxer/src/runtime.rs` `follow_script`) is left to Screen share 21, which owns `runtime.rs`; this task stays inside `fluxer-devserver` plus fixtures. Closes #167 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(voice): screen share over the room trait
All checks were successful
ci / Linux (x86_64) (push) Successful in 36m38s
ci / Windows (x64) (push) Successful in 30m16s
8ac5e7571b
Refs #163

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `screenshare` scenario: ada streaming in Hangout with grace and hedy
watching, Gaming without STREAM for @everyone, a bundled preview JPEG.
Op 4 viewer keys are checked as the gateway checks them (absent keeps,
null clears, one bad key fails the whole op 4 with VOICE_INVALID_STATE
or VOICE_CONNECTION_NOT_FOUND); self_stream/self_video are forced off
without STREAM; preview GET, upload-url, presigned PUT and inline POST
with the API's ownership, permission, JPEG and 1 MB rules; scripted
start_stream, stop_stream, viewer_join, viewer_leave and
revoke_stream_permission steps; VoiceScript::streams() for the fake room.

Refs #167

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Screen share 20 (devserver screenshare scenario)

Reviewed git diff 21a3b65..bb392aa cold, then checked it against plan Task 20, spec §3.2/§3.6/§12 and the fork gateway (guild_voice_connection_util.erl resolve/validate_viewer_stream_keys, dm_voice_state.erl validate_dm_viewer_stream_keys, guild_voice_connection_move.erl).

(1) Plan tests: all 5 named tests exist (op4_with_valid_keys_updates_state, op4_with_foreign_key_is_rejected_whole, self_stream_forced_false_without_permission, preview_upload_url_put_then_get, non_jpeg_preview_rejected). They assert what the plan asks with the spec's values: an absent field keeps the list, null clears it, a non-list is VOICE_INVALID_STATE; one bad key rejects the whole op 4 with VOICE_CONNECTION_NOT_FOUND/VOICE_INVALID_STATE and nothing changes; JPEG only; 1 000 000 bytes is accepted and 1 000 001 is rejected; max_bytes, method: PUT, image/jpeg. There are 3 extra tests (initial READY, scripted steps, permission revoke).

(2) Interfaces: the scenario, the op 4 key validation, STREAM per channel (Gaming denies it), the preview GET/upload-url/PUT/POST and the five steps start_stream/stop_stream/revoke_stream_permission/viewer_join/viewer_leave all exist. Key validation matches the gateway clause for clause: parse, then channel, then scope, then connection lookup (not found means voice_connection_not_found), then channel. In DMs an absent field reads as empty. A move resets the keys to [], which matches guild_voice_connection_move.erl. VoiceStep::user_id() now returns Option<Snowflake>; its only caller is updated, and apps/fluxer does not call it.

(3) Invariants: the devserver crate only, with bytes added as a dev-dep (it was already a workspace dep). No core, ui or video changes. Server data that reaches the client is not touched. There is no secret in the fixtures (voice token = "dev" is the existing fake-room placeholder). Upload tokens are not logged.

(4) Review Focus 2: covered. A foreign-channel key, an unknown connection, another guild, a DM key, an orphan stream: key, garbage, a non-string and a non-list each reject the whole op 4, and a fresh join with a bad key creates no connection.

(5) Local CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: fmt, clippy, deny, isolation, parity and every test step passed, including the 8 screenshare and the voice devserver tests. The screenshot-tests step failed once with a SIGSEGV in fluxer-ui --test screenshots (lavapipe; this PR does not touch that crate). Re-running that step (cargo test --workspace -- --ignored with the same env) passed twice with exit 0. I count it as green with a flaky renderer.

Findings

  • minor: the plan's "FakeRoom script that matches (remote test pattern on the streamer's screen_share)" and spec §12's screen-audio tone are only half delivered. The devserver exposes VoiceScript::streams()/LiveStream::identity(), but apps/fluxer/src/runtime.rs follow_script (Task 21's file) still publishes nothing for streams. Also, follow_script reacts only to steps, so ada's stream that is live from the start needs a streams() read at startup. Task 21's Interfaces block does not mention this. Please open a follow-up issue linked to #168 and link it from this PR, so Task 21 picks it up. Until then the README and the LiveStream doc comment describe behaviour that does not exist yet.
  • minor: the preview checks are stricter than the API: a content type is enforced as well as the bytes. This is documented and deliberate. The client always sends image/jpeg, so it causes no harm.
  • minor: upload_urls is never pruned. That is fine for a devserver.
  • minor (not this PR): an intermittent SIGSEGV in the lavapipe fluxer-ui screenshot tests. It is worth a ci issue if it shows up on the runner.

Verdict: APPROVED. No blocking findings, and local CI is green; the one failure was the flaky fluxer-ui screenshot SIGSEGV above, which passed on re-run.

## Independent review: Screen share 20 (devserver screenshare scenario) Reviewed `git diff 21a3b65..bb392aa` cold, then checked it against plan Task 20, spec §3.2/§3.6/§12 and the fork gateway (`guild_voice_connection_util.erl` resolve/validate_viewer_stream_keys, `dm_voice_state.erl` validate_dm_viewer_stream_keys, `guild_voice_connection_move.erl`). **(1) Plan tests:** all 5 named tests exist (`op4_with_valid_keys_updates_state`, `op4_with_foreign_key_is_rejected_whole`, `self_stream_forced_false_without_permission`, `preview_upload_url_put_then_get`, `non_jpeg_preview_rejected`). They assert what the plan asks with the spec's values: an absent field keeps the list, null clears it, a non-list is `VOICE_INVALID_STATE`; one bad key rejects the whole op 4 with `VOICE_CONNECTION_NOT_FOUND`/`VOICE_INVALID_STATE` and nothing changes; JPEG only; 1 000 000 bytes is accepted and 1 000 001 is rejected; `max_bytes`, `method: PUT`, `image/jpeg`. There are 3 extra tests (initial READY, scripted steps, permission revoke). **(2) Interfaces:** the scenario, the op 4 key validation, STREAM per channel (Gaming denies it), the preview GET/upload-url/PUT/POST and the five steps `start_stream`/`stop_stream`/`revoke_stream_permission`/`viewer_join`/`viewer_leave` all exist. Key validation matches the gateway clause for clause: parse, then channel, then scope, then connection lookup (not found means `voice_connection_not_found`), then channel. In DMs an absent field reads as empty. A move resets the keys to `[]`, which matches `guild_voice_connection_move.erl`. `VoiceStep::user_id()` now returns `Option<Snowflake>`; its only caller is updated, and `apps/fluxer` does not call it. **(3) Invariants:** the devserver crate only, with `bytes` added as a dev-dep (it was already a workspace dep). No core, ui or video changes. Server data that reaches the client is not touched. There is no secret in the fixtures (voice `token = "dev"` is the existing fake-room placeholder). Upload tokens are not logged. **(4) Review Focus 2:** covered. A foreign-channel key, an unknown connection, another guild, a DM key, an orphan `stream:` key, garbage, a non-string and a non-list each reject the whole op 4, and a fresh join with a bad key creates no connection. **(5) Local CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci`: fmt, clippy, deny, isolation, parity and every test step passed, including the 8 screenshare and the voice devserver tests. The `screenshot-tests` step failed once with a SIGSEGV in `fluxer-ui --test screenshots` (lavapipe; this PR does not touch that crate). Re-running that step (`cargo test --workspace -- --ignored` with the same env) passed twice with exit 0. I count it as green with a flaky renderer. ### Findings - **minor**: the plan's "FakeRoom script that matches (remote test pattern on the streamer's `screen_share`)" and spec §12's screen-audio tone are only half delivered. The devserver exposes `VoiceScript::streams()`/`LiveStream::identity()`, but `apps/fluxer/src/runtime.rs` `follow_script` (Task 21's file) still publishes nothing for streams. Also, `follow_script` reacts only to steps, so ada's stream that is live from the start needs a `streams()` read at startup. Task 21's Interfaces block does not mention this. Please open a `follow-up` issue linked to #168 and link it from this PR, so Task 21 picks it up. Until then the README and the `LiveStream` doc comment describe behaviour that does not exist yet. - **minor**: the preview checks are stricter than the API: a content type is enforced as well as the bytes. This is documented and deliberate. The client always sends `image/jpeg`, so it causes no harm. - **minor**: `upload_urls` is never pruned. That is fine for a devserver. - **minor (not this PR)**: an intermittent SIGSEGV in the lavapipe `fluxer-ui` screenshot tests. It is worth a `ci` issue if it shows up on the runner. **Verdict: APPROVED.** No blocking findings, and local CI is green; the one failure was the flaky fluxer-ui screenshot SIGSEGV above, which passed on re-run.
Author
Owner

Independent review: Screen share 20 (devserver screenshare), HEAD 89d4eda

I reviewed 61a073c..origin/screenshare-20-devserver-screenshare cold and checked it against the fork's gateway (guild_voice_connection_util.erl, guild_voice_connection_apply.erl, dm_voice_connect.erl, dm_voice_state.erl).

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passed (exit 0) in a fresh worktree. livekit-interop was skipped because FLUXER_LIVEKIT_TESTS is not set.

What I checked

  1. Plan tests: all five exist in crates/fluxer-devserver/tests/screenshare.rs: op4_with_valid_keys_updates_state, op4_with_foreign_key_is_rejected_whole, self_stream_forced_false_without_permission, preview_upload_url_put_then_get and non_jpeg_preview_rejected. They assert the spec's values: whole op 4 rejected with VOICE_INVALID_STATE / VOICE_CONNECTION_NOT_FOUND, nothing changed after a refusal, STREAM forced off in Gaming, upload-url {method: PUT, content_type: image/jpeg, max_bytes: 1000000, expires_in: 86400}, latest upload wins, the 1 000 000-byte limit at exactly the boundary, non-JPEG returns 400, and a forged URL returns 403. Three more tests cover the starting state, the steps and the revoke.
  2. Interfaces: the screenshare scenario, the five steps (start_stream, stop_stream, viewer_join, viewer_leave, revoke_stream_permission), the STREAM check per channel (Gaming has none), the preview endpoints and VoiceScript::streams() / LiveStream::identity() are all present. VoiceStep::user_id() now returns Option<Snowflake>; its only caller in the workspace is tests/voice.rs, which was updated.
  3. Invariants: this task touches only fluxer-devserver plus fixtures. It adds one dev-dependency (bytes, already in the workspace). There are no secrets in the fixtures: token = "dev" is the existing fake voice token. The new paths have no unwrap or index that client input could make panic. Request paths are not logged, so upload tokens do not reach logs.

Findings

[blocking] An op 4 that moves channels skips the viewer-key check (Review Focus 2).
In voice.rs op4, when moving is true the code sets viewer_stream_keys = Vec::new() and never calls resolve_viewer_keys. The gateway does the opposite. proceed_after_restore and handle_existing_connection call resolve_viewer_stream_keys before branching on IsChannelChange, and apply_with_viewer_key(Update, {error, _}) refuses the whole op 4 even on a move. Only when the result is {ok, _} are the keys dropped (apply_channel_move).
I confirmed this with a throwaway test, which I did not commit: join Hangout with [ADA_KEY], then send an op 4 moving to Gaming that still carries [ADA_KEY]. The devserver moves the connection and sends no error. The real gateway answers voice_invalid_state, because ada's connection is in a different channel.
This is the exact case Review Focus 2 names: keys of another channel, which a client can easily send stale when it moves while watching. The Interfaces block also promises "op 4 viewer-key validation with the gateway's rules". As it stands, a Screen share 9/21 bug that sends stale keys on a move would pass every devserver test and fail live.
Fix: validate keys on a move too, against the target channel (resolve_viewer_keys(..., channel), with Keep resolving to the existing keys as the gateway does), return the error if any key is bad, and only then reset to [] for the move. Add a test: a move carrying a key of the old channel is refused whole and the connection stays where it was.

[minor] A DM op 4 that leaves out the keys on an existing connection should keep them, not clear them.
resolve_viewer_keys maps Keep to an empty list whenever guild is None. In the gateway, dm_voice_connect:apply_existing_update → resolve_existing_viewer_stream_keys(undefined, …) keeps the existing keys. Only a new DM connection (validate_dm_viewer_stream_keys(undefined)) gets []. The README sentence "(a DM reads it as empty)" carries the same imprecision. Today this is low impact, because our op 4 always sends a list.

[minor] Track the FakeRoom wiring that was handed on.
Deviation (4) gives the FakeRoom script, which the Interfaces block lists as produced by this task, to Screen share 21. That is reasonable, since it lives in runtime.rs. Please add a note on #168, or open a follow-up issue linked from this PR, so that the work is not lost.

Verdict: changes requested. There is 1 blocking finding (the op 4 move path skips viewer-key validation). CI is green locally.

🤖 Generated with Claude Code

## Independent review: Screen share 20 (devserver screenshare), HEAD 89d4eda I reviewed `61a073c..origin/screenshare-20-devserver-screenshare` cold and checked it against the fork's gateway (`guild_voice_connection_util.erl`, `guild_voice_connection_apply.erl`, `dm_voice_connect.erl`, `dm_voice_state.erl`). **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passed (exit 0) in a fresh worktree. livekit-interop was skipped because `FLUXER_LIVEKIT_TESTS` is not set. ### What I checked 1. **Plan tests:** all five exist in `crates/fluxer-devserver/tests/screenshare.rs`: `op4_with_valid_keys_updates_state`, `op4_with_foreign_key_is_rejected_whole`, `self_stream_forced_false_without_permission`, `preview_upload_url_put_then_get` and `non_jpeg_preview_rejected`. They assert the spec's values: whole op 4 rejected with `VOICE_INVALID_STATE` / `VOICE_CONNECTION_NOT_FOUND`, nothing changed after a refusal, STREAM forced off in Gaming, upload-url `{method: PUT, content_type: image/jpeg, max_bytes: 1000000, expires_in: 86400}`, latest upload wins, the 1 000 000-byte limit at exactly the boundary, non-JPEG returns 400, and a forged URL returns 403. Three more tests cover the starting state, the steps and the revoke. 2. **Interfaces:** the `screenshare` scenario, the five steps (`start_stream`, `stop_stream`, `viewer_join`, `viewer_leave`, `revoke_stream_permission`), the STREAM check per channel (Gaming has none), the preview endpoints and `VoiceScript::streams()` / `LiveStream::identity()` are all present. `VoiceStep::user_id()` now returns `Option<Snowflake>`; its only caller in the workspace is `tests/voice.rs`, which was updated. 3. **Invariants:** this task touches only fluxer-devserver plus fixtures. It adds one dev-dependency (`bytes`, already in the workspace). There are no secrets in the fixtures: `token = "dev"` is the existing fake voice token. The new paths have no `unwrap` or index that client input could make panic. Request paths are not logged, so upload tokens do not reach logs. ### Findings **[blocking] An op 4 that moves channels skips the viewer-key check (Review Focus 2).** In `voice.rs` `op4`, when `moving` is true the code sets `viewer_stream_keys = Vec::new()` and never calls `resolve_viewer_keys`. The gateway does the opposite. `proceed_after_restore` and `handle_existing_connection` call `resolve_viewer_stream_keys` before branching on `IsChannelChange`, and `apply_with_viewer_key(Update, {error, _})` refuses the whole op 4 even on a move. Only when the result is `{ok, _}` are the keys dropped (`apply_channel_move`). I confirmed this with a throwaway test, which I did not commit: join Hangout with `[ADA_KEY]`, then send an op 4 moving to Gaming that still carries `[ADA_KEY]`. The devserver moves the connection and sends no error. The real gateway answers `voice_invalid_state`, because ada's connection is in a different channel. This is the exact case Review Focus 2 names: keys of another channel, which a client can easily send stale when it moves while watching. The Interfaces block also promises "op 4 viewer-key validation with the gateway's rules". As it stands, a Screen share 9/21 bug that sends stale keys on a move would pass every devserver test and fail live. Fix: validate keys on a move too, against the target channel (`resolve_viewer_keys(..., channel)`, with `Keep` resolving to the existing keys as the gateway does), return the error if any key is bad, and only then reset to `[]` for the move. Add a test: a move carrying a key of the old channel is refused whole and the connection stays where it was. **[minor] A DM op 4 that leaves out the keys on an existing connection should keep them, not clear them.** `resolve_viewer_keys` maps `Keep` to an empty list whenever `guild` is `None`. In the gateway, `dm_voice_connect:apply_existing_update` → `resolve_existing_viewer_stream_keys(undefined, …)` keeps the existing keys. Only a new DM connection (`validate_dm_viewer_stream_keys(undefined)`) gets `[]`. The README sentence "(a DM reads it as empty)" carries the same imprecision. Today this is low impact, because our op 4 always sends a list. **[minor] Track the FakeRoom wiring that was handed on.** Deviation (4) gives the `FakeRoom` script, which the Interfaces block lists as produced by this task, to Screen share 21. That is reasonable, since it lives in `runtime.rs`. Please add a note on #168, or open a `follow-up` issue linked from this PR, so that the work is not lost. **Verdict: changes requested.** There is 1 blocking finding (the op 4 move path skips viewer-key validation). CI is green locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A move to another channel now checks viewer_stream_keys against the
target channel like the gateway (a bad key refuses the whole op 4) and
then resets the list. A DM op 4 without the field keeps the existing
keys, as dm_voice_connect:apply_existing_update does.

Refs #167

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Review round 1, fixed in aef1739:

  • Blocking, move skips viewer-key check (voice.rs): fixed. op4 now always runs resolve_viewer_keys against the target channel, before the move check, as resolve_viewer_stream_keys does ahead of apply_with_viewer_key. A bad key refuses the whole op 4, and an accepted move then resets the list to []. If the field is left out, the existing keys are still not checked, as in the gateway. New test op4_move_checks_keys_against_the_target_channel: Hangout to Gaming with ADA_KEY gives voice_invalid_state, a key naming nobody gives voice_connection_not_found, a move with the field left out is accepted with [], and a move back with a key valid in the target channel is accepted with []. The test failed before the fix.
  • Minor, DM Keep (voice.rs): fixed. A left-out field now keeps the existing keys for a DM as well (dm_voice_connect:apply_existing_update / resolve_existing_viewer_stream_keys). A new connection has no keys to keep, so it still starts with []. New test dm_op4_without_keys_keeps_them, which failed before the fix. The README line is corrected, and it now also describes how a move handles keys.
  • Minor, FakeRoom script (README / deviation 4): follow-up issue #227 opened, which links #167 and #168.

FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally.

Review round 1, fixed in aef1739: - **Blocking, move skips viewer-key check (voice.rs):** fixed. `op4` now always runs `resolve_viewer_keys` against the target channel, before the move check, as `resolve_viewer_stream_keys` does ahead of `apply_with_viewer_key`. A bad key refuses the whole op 4, and an accepted move then resets the list to `[]`. If the field is left out, the existing keys are still not checked, as in the gateway. New test `op4_move_checks_keys_against_the_target_channel`: Hangout to Gaming with `ADA_KEY` gives `voice_invalid_state`, a key naming nobody gives `voice_connection_not_found`, a move with the field left out is accepted with `[]`, and a move back with a key valid in the target channel is accepted with `[]`. The test failed before the fix. - **Minor, DM `Keep` (voice.rs):** fixed. A left-out field now keeps the existing keys for a DM as well (`dm_voice_connect:apply_existing_update` / `resolve_existing_viewer_stream_keys`). A new connection has no keys to keep, so it still starts with `[]`. New test `dm_op4_without_keys_keeps_them`, which failed before the fix. The README line is corrected, and it now also describes how a move handles keys. - **Minor, FakeRoom script (README / deviation 4):** follow-up issue #227 opened, which links #167 and #168. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally.
Author
Owner

Independent review: Screen share 20 (devserver screenshare), HEAD aef1739

I reviewed git diff 61a073c..origin/screenshare-20-devserver-screenshare cold. I checked it against plan Task 20 and spec §3.2, §3.6 and §12, and against the fork's gateway: guild_voice_connection_util.erl (resolve/validate_viewer_stream_keys), guild_voice_connection_update.erl (both callers resolve against the target channel before normal_update), guild_voice_connection_move.erl (viewer_stream_keys => []), dm_voice_state.erl and dm_voice_connect.erl.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes (exit 0) in a fresh worktree. All 10 tests in crates/fluxer-devserver/tests/screenshare.rs pass. livekit-interop is skipped because FLUXER_LIVEKIT_TESTS is not set. I did not check the remote runners.

Checks

  1. Plan tests: all five named tests exist, and they assert the spec's values.
    • Whole op 4 rejected with VOICE_INVALID_STATE / VOICE_CONNECTION_NOT_FOUND, and nothing changes after a refusal (the next accepted state shows it).
    • Absent field keeps the list, null clears it, a non-list is refused.
    • STREAM is forced off in Gaming.
    • The upload URL comes back as {PUT, image/jpeg, max_bytes 1000000, expires_in 86400}, and the latest upload wins.
    • The JPEG limit is exact at 1 000 000 / 1 000 001.
    • A forged URL gets 403.
      The round-1 fixes have their own tests (op4_move_checks_keys_against_the_target_channel, dm_op4_without_keys_keeps_them), and both match the fork. A move resolves the keys against the target first, so a bad key refuses the whole op 4, and an accepted move then resets to []. A DM op 4 without the field keeps the existing keys.
  2. Interfaces: these are present: the screenshare scenario, the op 4 key validation, the per-channel STREAM check (Gaming has none), preview GET / upload-url / PUT / POST, and the steps start_stream, stop_stream, revoke_stream_permission, viewer_join, viewer_leave. Two additions are present as well: VoiceScript::streams() / LiveStream::identity(). VoiceStep::user_id() now returns Option<Snowflake>. Its only caller in the workspace (tests/voice.rs) is updated, and no open screenshare-* branch calls it under apps/.
  3. Invariants: the change is in fluxer-devserver and fixtures only, plus bytes as a dev-dependency (it is already in the workspace). No core, ui, video or capture crate is touched. There are no tokens or secrets in the fixtures; the scenario's token = "dev" is the existing fake. The upload token is minted locally and is never logged. The extra GUILD_CREATE (guild ...393) does not clobber the directory entry of the streaming guild.
  4. Review Focus 2: covered. The test sends an own key (accepted while the own connection is in the channel), a pruned or missing connection (VOICE_CONNECTION_NOT_FOUND), and keys from another channel, another guild, DM scope and orphan form (VOICE_INVALID_STATE). Each one fails the whole op 4, including a fresh join.

Findings

  • minor: the FakeRoom script listed in the Interfaces block (remote test pattern on the streamer's screen_share) is not produced here. It is deferred to Screen share 21 via follow-up #227, which is linked. VoiceScript::streams() gives #168 what it needs to drive it. This is acceptable as tracked, but #168 must pick it up.
  • minor: VoiceStep::user_id() changed its public signature (Snowflake became Option<Snowflake>). It has no other consumers today. A task that later matches on it should expect the Option.

Verdict: approved. There are no blocking findings, and local ci is green.

## Independent review: Screen share 20 (devserver screenshare), HEAD aef1739 I reviewed `git diff 61a073c..origin/screenshare-20-devserver-screenshare` cold. I checked it against plan Task 20 and spec §3.2, §3.6 and §12, and against the fork's gateway: `guild_voice_connection_util.erl` (resolve/validate_viewer_stream_keys), `guild_voice_connection_update.erl` (both callers resolve against the target channel before `normal_update`), `guild_voice_connection_move.erl` (`viewer_stream_keys => []`), `dm_voice_state.erl` and `dm_voice_connect.erl`. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes (exit 0) in a fresh worktree. All 10 tests in `crates/fluxer-devserver/tests/screenshare.rs` pass. livekit-interop is skipped because `FLUXER_LIVEKIT_TESTS` is not set. I did not check the remote runners. ### Checks 1. **Plan tests:** all five named tests exist, and they assert the spec's values. - Whole op 4 rejected with `VOICE_INVALID_STATE` / `VOICE_CONNECTION_NOT_FOUND`, and nothing changes after a refusal (the next accepted state shows it). - Absent field keeps the list, `null` clears it, a non-list is refused. - STREAM is forced off in Gaming. - The upload URL comes back as `{PUT, image/jpeg, max_bytes 1000000, expires_in 86400}`, and the latest upload wins. - The JPEG limit is exact at 1 000 000 / 1 000 001. - A forged URL gets 403. The round-1 fixes have their own tests (`op4_move_checks_keys_against_the_target_channel`, `dm_op4_without_keys_keeps_them`), and both match the fork. A move resolves the keys against the target first, so a bad key refuses the whole op 4, and an accepted move then resets to `[]`. A DM op 4 without the field keeps the existing keys. 2. **Interfaces:** these are present: the `screenshare` scenario, the op 4 key validation, the per-channel STREAM check (Gaming has none), preview GET / upload-url / PUT / POST, and the steps `start_stream`, `stop_stream`, `revoke_stream_permission`, `viewer_join`, `viewer_leave`. Two additions are present as well: `VoiceScript::streams()` / `LiveStream::identity()`. `VoiceStep::user_id()` now returns `Option<Snowflake>`. Its only caller in the workspace (`tests/voice.rs`) is updated, and no open screenshare-* branch calls it under `apps/`. 3. **Invariants:** the change is in `fluxer-devserver` and fixtures only, plus `bytes` as a dev-dependency (it is already in the workspace). No core, ui, video or capture crate is touched. There are no tokens or secrets in the fixtures; the scenario's `token = "dev"` is the existing fake. The upload token is minted locally and is never logged. The extra `GUILD_CREATE` (guild ...393) does not clobber the directory entry of the streaming guild. 4. **Review Focus 2:** covered. The test sends an own key (accepted while the own connection is in the channel), a pruned or missing connection (`VOICE_CONNECTION_NOT_FOUND`), and keys from another channel, another guild, DM scope and orphan form (`VOICE_INVALID_STATE`). Each one fails the whole op 4, including a fresh join. ### Findings - **minor:** the `FakeRoom` script listed in the Interfaces block (remote test pattern on the streamer's `screen_share`) is not produced here. It is deferred to Screen share 21 via follow-up #227, which is linked. `VoiceScript::streams()` gives #168 what it needs to drive it. This is acceptable as tracked, but #168 must pick it up. - **minor:** `VoiceStep::user_id()` changed its public signature (`Snowflake` became `Option<Snowflake>`). It has no other consumers today. A task that later matches on it should expect the `Option`. **Verdict: approved.** There are no blocking findings, and local ci is green.
charles manually merged commit 5096dd1ee4 into screenshare 2026-11-12 07:59:55 +00:00
Sign in to join this conversation.
No description provided.