Skip to content

chore: remove dead code - #897

Open
wagenet wants to merge 7 commits into
Eyevinn:mainfrom
wagenet:wagenet/dead-code-removal
Open

wagenet wants to merge 7 commits into
Eyevinn:mainfrom
wagenet:wagenet/dead-code-removal

Conversation

@wagenet

@wagenet wagenet commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Written by Claude (Claude Code), not by a human.

Deletes about 1,770 lines with no callers: no refactoring, no behaviour change. Each item was grep-checked across backend, frontend and types, then confirmed by clippy -D warnings on native and wasm. One commit per area:

  • gst: the unused video_frame.rs module. From discovery.rs: the discovery skip list (always empty, so its branch never ran), the empty element blacklist, clear_cache, and two unused property-introspection helpers. classify_media_type is used; only its stale allow goes.
  • state: AppState::{thread_registry, pipelines_write, get_flow_state, get_element_property, get_pad_property}. The same-named PipelineManager methods stay.
  • whip: the SDP redundancy stripping behind if false, plus strip_redundancy_codecs and its tests. It stays in git history if "No streams to output" errors return. Also drops the ingest page's discarded list_all().
  • registries: unused lookups on WhepRegistry, WhipRegistry and ChannelRegistry, and the tests that were their only callers. WhipEndpointEntry.port goes too: always 0, read only by the dead get_port.
  • backend: other zero-caller items, listed in the b2c1f2b0 commit message, including Config::new/from_env/Default, used only by one legacy test.
  • frontend: StromApp::new_with_shutdown, both expire_stale helpers, and write-only fields (ws_client, WebSocketClient.connected, LogEntry.timestamp, PadToRender.template_name). Dropping ws_client does not close the socket: connect() spawns a detached loop that owns everything it uses, and the handle has no Drop. canvas_rect's allow becomes #[cfg(target_arch = "wasm32")], its only caller's target.
  • deps: crossterm, dev-dep http-body-util (backend), and hostname (frontend). urlencoding stays: upstream test(auth): cover auth_middleware, and accept a percent-encoded ?auth_token= #908 decodes a percent-encoded ?auth_token= with it.
  • tests: channel_registry loses its test module. Upstream test: make backend unit tests guard real code, prune the rest #910 pruned test_default, and this PR removes every method the remaining tests called.

Not removed, and why

  • BlockBuildContext::whip_registry(): removing it leaves the field unread, and removing the field changes PipelineManager::new at ~40 call sites. More than a deletion.
  • QoSElementData's unread fields: CLAUDE.md explicitly allows dead_code on event fields that mirror the backend but are not yet shown.
  • tempfile in backend [dependencies]: not test-only; aes67.rs writes its SDP file with it.

Noticed, out of scope

Correction: an earlier version said ChannelRegistry::register/unregister had no production callers. Wrong: start_flow and stop_flow call them. Nothing here depended on it.

Related Issue

None.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Code removal only.

Checklist

  • I have run cargo fmt --all
  • I have run cargo clippy --workspace --all-targets -- -D warnings
  • I have run cargo test --workspace
  • I have updated documentation as needed (n/a)
  • I have added tests for new functionality (n/a)

Checks run (macOS, arm64)

All passed:

  • cargo fmt --all, cargo check --workspace
  • cargo clippy --workspace --all-targets -- -D warnings, with and without --features efp,nvidia
  • wasm: cargo clippy --target wasm32-unknown-unknown --all-features -- -D warnings and trunk build (debug) in frontend/
  • cargo test --test openapi_test: passes with no snapshot change
  • cargo test --workspace: 1044 passed, 0 failed, 2 ignored

Not run: the Linux and Windows CI jobs. Tests that skip when a GStreamer element is missing may have skipped on this machine; I did not audit which ones.

🤖 Generated with Claude Code

@wagenet
wagenet marked this pull request as ready for review September 28, 2026 23:02
@srperens srperens mentioned this pull request Sep 29, 2026
wagenet added a commit to wagenet/strom that referenced this pull request Sep 29, 2026
Eyevinn#897 dropped urlencoding as unreferenced; upstream Eyevinn#908 decodes a
percent-encoded ?auth_token= with it. Also drop channel_registry's last
test: Eyevinn#910 pruned test_default upstream, and Eyevinn#897 removes every method
the remaining upstream tests called.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wagenet added a commit to wagenet/strom that referenced this pull request Oct 1, 2026
Eyevinn#897 dropped urlencoding as unreferenced; upstream Eyevinn#908 decodes a
percent-encoded ?auth_token= with it. Also drop channel_registry's last
test: Eyevinn#910 pruned test_default upstream, and Eyevinn#897 removes every method
the remaining upstream tests called.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wagenet
wagenet force-pushed the wagenet/dead-code-removal branch from 76dd975 to 185ca69 Compare October 1, 2026 19:17
srperens
srperens previously approved these changes Oct 2, 2026

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approve. A deletion-only diff. Linux and WASM compile it green, and no removed item still has a caller in code those jobs don't compile.

Claims

Claim Verdict Evidence
The removed items have no callers, including platform-gated code CONFIRMED Check (Linux) and Check & Build (WASM) are green at 185ca69. For the macOS/Windows code CI skipped, I grepped the PR tree for every removed fn, field and module name. The only hits are different symbols with the same name: the thread_registry module, WhepRegistry::get_port, AuthConfig::from_env, local ws_client/template_name bindings. The get_element_property and get_pad_property callers that remain are PipelineManager's (backend/src/gst/pipeline/properties.rs:339 — if let Ok(value) = self.get_element_property(element_id, &name) {)
The discovery skip list was always empty CONFIRMED On main, get_discovery_skip_list() returns a vec![] holding only comments, so the removed branch never ran
The SDP redundancy strip was unreachable CONFIRMED Main's backend/src/api/whip_ingest.rs, line 227: let body_bytes = if false {
Dropping ws_client does not close the socket CONFIRMED frontend/src/ws.rs:41 — pub fn connect(&mut self, tx: Sender<AppMessage>, ctx: egui::Context) { spawns the loop detached (tokio::spawn / spawn_local), and WebSocketClient has no Drop. The logout leak this reveals is filed as #913
canvas_rect is WASM-only CONFIRMED Its only caller, frontend/src/app/update.rs:127, sits inside the #[cfg(target_arch = "wasm32")] block that opens at line 90. This swaps an allow(dead_code) for a target cfg, as CLAUDE.md asks

Diagnosis. No behaviour change, and the call-site counts confirm it. Each allow(dead_code) that goes takes its item with it, except QoSElementData's, which CLAUDE.md permits for event fields that mirror the backend.

Radius. SHARED. It touches 37 files across the backend, frontend and Cargo manifests, but removes only items with no callers. The hostname crate goes from the frontend only; the backend keeps its own (backend/Cargo.toml:132 — hostname = "0.4" # Cross-platform hostname detection), which #879's new cef_profiles.rs relies on.

Overlaps.

  • #854 (draft, the whip split) moves whip_session_manager.rs into sub-modules and carries get_session_info and list_endpoints along, both deleted here. Land this first. #854's rebase must then drop them, or they come back as pub items that clippy won't flag.
  • #924 (deps) and this PR both rewrite Cargo.lock. Whichever lands second regenerates it.
  • No other open PR's added lines reference a removed name. I grepped every open diff.

Tests & CI. Check (Linux), both Linux builds, WASM, API Contract Check and Static JS Tests passed at 185ca69, which is level with main. Build (macOS) and Build (Windows) were skipped. Merging on Linux-green is reasonable here: the grep above covers what those jobs would add, and the main-branch run builds both. The tests removed (strip_redundancy_codecs_*, channel_registry, video_frame) exercised only the deleted code.

Confidence: HIGH

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This supersedes my Approve of 2026-10-02 at 185ca69, which was dismissed by the push. The verdict stands.

Verdict: Approve. The new head is a pure rebase. The patch is line-for-line the one I reviewed, except for extra deleted lines in backend/src/config.rs's removed Config::new/Default, which main had grown (data_dir, cef_debug_port, cef_full_devtools). I posted this as a COMMENT review because GitHub refuses APPROVE from the account this stage runs under.

Claims

Claim Verdict Evidence
The removed items have no callers at this head CONFIRMED My 2026-10-02 review confirmed this at 185ca69, and the patch is unchanged. PipelineManager still has its own property readers: backend/src/gst/pipeline/properties.rs:354 — if let Ok(value) = self.get_element_property(element_id, &name) {
Nothing merged to main since then calls a removed item CONFIRMED The branch is 25 commits behind main. I trial-merged it onto origin/main; it merged with no conflict. I grepped every .rs line main added since the merge base for all 70 removed names. The only hits are different symbols: MEDIA_PLAYER_REGISTRY.unregister_flow and MediaPlayerState::pause (backend/src/blocks/builtin/mediaplayer/state.rs:325 — pub fn pause(&self) -> Result<(), String> {)
Dropping hostname from the frontend leaves the backend's use intact CONFIRMED backend/Cargo.toml:136 — hostname = "0.4" # Cross-platform hostname detection. The merged tree uses it at backend/src/cef_profiles.rs:173 — let Ok(host) = hostname::get() else {

The remaining rows of my 2026-10-02 review (empty discovery skip list, the if false SDP strip, ws_client, canvas_rect) are untouched by the rebase, and I carry them unchanged.

Radius. SHARED, unchanged: 37 files, deletions only.

Overlaps. I grepped every open PR's added lines for the removed names.

  • #854 (draft, whip split) still carries get_session_info and list_endpoints, which this PR deletes. Land this first. #854's rebase must then drop them.
  • #1002 (monthly deps) rewrites Cargo.lock and the root Cargo.toml. This is a text conflict only: #1002 touches none of crossterm, http-body-util or hostname. Whichever lands second regenerates the lock.
  • These are false positives, not overlaps. #922 calls PipelineManager::get_pad_property, which survives; only AppState's copy goes. #755 calls MediaPlayerState::pause, not the removed PipelineManager::pause.

Tests & CI. At f092411 these passed: Check (Linux), Build (Linux x86_64/ARM64), Check & Build (WASM), API Contract Check and Static JS Tests. Build (macOS) and Build (Windows) were skipping. That run predates the 25 main commits. The trial merge plus the grep above is my evidence that the merged tree still compiles. It is static, not a build, so if you want certainty before merging, rebase and let CI run. Merging on the current green is the call I would make: a deletion-only diff fails loudly at compile time on main if I am wrong.

Confidence: HIGH

wagenet and others added 7 commits October 9, 2026 08:52
video_frame.rs was declared but never used. In discovery.rs, drop the
skip list (always empty, so its branch never ran), the empty element
blacklist, clear_cache, and the unused property introspection helpers.
classify_media_type is used, so only its stale allow and comment go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thread_registry, pipelines_write, get_flow_state, get_element_property
and get_pad_property. The PipelineManager methods of the same names stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The strip_redundancy_codecs call sat behind 'if false'. Remove the block,
the function and its tests; it remains in git history if 'No streams to
output' errors return. Also drop the ingest page's discarded list_all().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WhepRegistry: get, contains. WhipRegistry: get_port, get and
update_port_sync, plus the port field that was always registered as 0
and read only by get_port. ChannelRegistry: generate_channel_name,
unregister_flow, get, list_by_flow and is_active, which only their own
tests called, along with those tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PipelineManager::pause, element_id_for_gst_name and get_pad_caps; the
PTP monitor's broadcaster setter, its never-read field and three
getters; two WHIP session manager lookups; cleanup_old_transitions;
unconstructed ThumbnailError variants; the thumbnail tap's cache_ttl
and tee_element; two mDNS helpers; get_gst_device; the commented-out
deprioritize_nv_decoders; SystemMonitor's Default impl; the deprecated
BusWatchSetupFn alias and register_dynamic_webrtcbin;
error_with_data; invalidate_cache; and Config::new, Config::from_env
and Config's Default impl, used only by one legacy test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StromApp::new_with_shutdown (the backend uses the _and_auth variant),
both expire_stale helpers, the write-only ws_client and
WebSocketClient.connected fields, LogEntry.timestamp and
PadToRender.template_name. Dropping ws_client does not stop the socket:
connect() spawns a detached loop that owns everything it uses, and the
handle has no Drop. Also replace two stale dead_code allows: palette
elements is read, and canvas_rect is called only from wasm, so it is
now gated on wasm32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crossterm and the http-body-util dev-dependency from the backend, and
hostname from the frontend. urlencoding stays: auth decodes a
percent-encoded ?auth_token= with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wagenet
wagenet force-pushed the wagenet/dead-code-removal branch from f092411 to 2b8c60d Compare October 9, 2026 16:18
@wagenet

wagenet commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Claude (Claude Code), writing on behalf of @wagenet: rebased onto current main (dcccdd70) and force-pushed. The PR is mergeable again.

Checked locally on macOS arm64: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, wasm32 clippy with --all-features, and cargo test --workspace all exit 0. Not run: the Linux and Windows CI jobs, and clippy with --features efp,nvidia.

🤖 Generated with Claude Code

wagenet added a commit to wagenet/strom that referenced this pull request Oct 9, 2026

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approve. This supersedes my Approve at f092411 (2026-10-06), and the verdict stands. The new head 2b8c60d is a rebase onto dcccdd7, the run at this head is green, and a trial merge onto today's main (b127864) is clean.

What moved since f092411

  • git range-diff: commits 1-4 and 6 are =.
  • Commit 5 now also deletes the three media_download_* field initialisers that main added to the removed Config::new and Default for Config. The fields themselves stay: backend/src/config.rs:316 — pub media_download_max_bytes: u64,. It no longer deletes ThumbnailError::UnsupportedFormat, which main has since given a caller: backend/src/gst/thumbnail_tap.rs:232 — return Err(ThumbnailError::UnsupportedFormat(format!(. The whip_session_manager.rs hunks differ only in context.
  • Commit 7 differs only in Cargo.lock context (main added dunce).

Claims

Claim Verdict Evidence
Nothing on main since the merge base calls a removed item CONFIRMED Six commits, #1060-#1070. I grepped their added .rs lines for all 67 removed fn names. The only hits are generic names (new, get, contains, default) on other types, e.g. MEDIA_PLAYER_REGISTRY.get. Config::default(), Config::new(, video_frame:: and the removed ThumbnailError variants appear nowhere in the merged tree
Survivors of the same name are other types CONFIRMED backend/src/gst/pipeline/properties.rs:499 — if let Ok(value) = self.get_pad_property(element_id, pad_name, &name) { is PipelineManager's copy. The one removed is AppState's. whip_ingest_page is kept without its unused State: backend/src/api/whip_ingest.rs:25 — pub async fn whip_ingest_page() -> impl IntoResponse {
Dropped deps are unreferenced CONFIRMED crossterm and http_body_util appear in no .rs file. hostname leaves only the frontend. The backend keeps backend/Cargo.toml:139 — hostname = "0.4" # Cross-platform hostname detection, used at backend/src/cef_profiles.rs:173 — let Ok(host) = hostname::get() else {

Radius: SHARED, unchanged: 37 files, 13 insertions, 1738 deletions.

Overlaps: I grepped every open PR's added lines for the removed names. The only hit is #922's manager.get_pad_property(...) in enum_property_read_test.rs, which is on PipelineManager and survives. #854 (named last time) is no longer open. #1002 rewrites Cargo.lock and the root Cargo.toml only, so it is a lockfile text conflict, not a semantic one. Whichever lands second regenerates the lock.

Tests & CI: run 37958180817 at 2b8c60d: Check (Linux), both Linux builds, WASM, API Contract and Static JS pass. macOS and Windows are skipping. The removed code includes no cfg(target_os) paths of its own. A deletion-only diff that is wrong fails to compile on main, so merging on this green is reasonable. My merged-tree evidence is a trial merge plus grep. I did not build it or run anything locally.

Confidence: HIGH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants