Skip to content

cleanup: ~1.3k lines of kept-dead modules, phantom Makefile targets, 7 TODOs, docs drift #10

Description

@vibechoom

Split out of #5. Measured on main @ c9f292c.

Dead modules kept under #[allow(dead_code)] (~1.3k lines)

  • v1bectl_cli/src/client.rs (88) + http_client.rs (100): main.rs:1-10 calls them "supported, not-yet-wired transports"
  • v1bectl_tui/src/dashboard.rs (525): main.rs:1-4 says it's "superseded by the scrollview dashboard … retained as reference/fallback"
  • v1bectl_web/src/websocket_simple.rs (348): superseded by websocket_reconnect.rs, but both are still declared. lib.rs:2 labels the simple one "NEW RECONNECTING WEBSOCKET", which is backwards
  • v1bectl_web "Legacy modules (keep for now)" (main.rs:12-17): pages/, context/, favorites, hooks, router, now behind cyber_app

These are also the bulk of the 44 web clippy errors in #9. Git history keeps them, so they don't need to live in the tree.

Dead fields that hide unfinished features

  • lib/v1bectl_sync/src/sync.rs:26 max_per_second is never read. Is the per-device rate limit actually enforced? (test_rate_limit.sh exists, so it was meant to be.) Needs a check, not just a delete.
  • v1bectl_tui/src/main.rs:132-140 brightness_slider, color_temp_slider, show_create_virtual, virtual_device_name: the "TUI virtual device creation not fully implemented" item in CLAUDE.md
  • lib/v1bectl_api/src/server.rs:5 port, lib/v1bectl_virtual/src/button_controller.rs:38-45, scene_controller.rs:36, lib/v1bectl_gateway/src/dirigera.rs:29,111,113

Makefile targets that don't do what they say

  • Makefile:198-204 docker-build / docker-run run docker build ., but there's no Dockerfile in the repo
  • Makefile:212 runs test-scenario SCENARIO=unreliable_network, but lib/v1bectl_virtual/src/dummy.rs:107 maps "unreliable_network" straight to load_basic_home_scenario_static. It's a silent alias with no unreliability

Code TODOs (7, the full sweep)

  • v1bectl_server/src/main.rs:408 Implement scene controller creation
  • lib/v1bectl_virtual/src/light_group_linear.rs:117 Inverse-map member brightness → group brightness (a group's reported brightness drifts from its members)
  • lib/v1bectl_gateway/src/dirigera.rs:433 rgb_color: None, convert from HSV if available
  • lib/v1bectl_sync/src/sync.rs:988 Extract timestamp from state if available
  • v1bectl_tui/src/main.rs:580 "Need device_id in the state response to match properly". Possibly a real mismatch bug, so check it first
  • v1bectl_web/src/screen_renderer.rs:173 Template substitution
  • v1bectl_web/src/websocket_reconnect.rs:308 CBOR→JSON "for now", switch to pure CBOR

Docs drift

Recommendation

One mechanical PR for the deletes, the Makefile fixes and the docs. Hold the max_per_second and TUI :580 items until someone has looked at them, since they may be bugs rather than dead code. The feature TODOs stay as this checklist until someone picks one up.

Severity: Low. Maintenance drag, no user-facing impact, except possibly the unread rate-limit field.

Activity

  1. vibechoom commented on Sep 27, 2026

    @vibechoom
    ContributorAuthor

    Status: #13 covers the Makefile phantom targets and docs-drift sections. While checking the other targets, its builder fixed a third broken one: run-server / run-server-real never passed the dummy / dirigera subcommand, so make run-server just printed clap usage and exited 2.

    Residual found during #13 (adding it here, same subsystem)

  2. vibechoom commented on Sep 27, 2026

    @vibechoom
    ContributorAuthor

    Update on the two held items (read-only investigation, spot-checked on main @ c9f292c)

    1. max_per_second (sync.rs:26): vestigial. The rate limiter it belongs to doesn't limit anything, but writes are still throttled.

    • RateLimiter::acquire() (lib/v1bectl_sync/src/sync.rs:38-41) takes a semaphore permit and drops it right away when the function returns. So it's neither a per-second limit nor, in practice, a concurrency cap. The comment above the field ("the limit is enforced via the semaphore's permit count") is wrong, and SyncConfig.gateway_rate_limit = 10 ("10 req/s", :169) has no effect.
    • The throttle that does work is coalescing: queue_sync (:255-267) keeps only the latest pending state per device in a HashMap, and start_buffer_worker (:424-428) drains it every 50 ms. A dragged slider produces at most about 20 PATCHes/s per device. That's the behaviour the local test_rate_limit.sh expects.
    • So deleting the field is safe. The better cleanup is to delete RateLimiter entirely, or make it real by wiring the drain interval to gateway_rate_limit. Moved from "hold" to the mechanical list:
    • Remove RateLimiter (or make gateway_rate_limit actually drive the 50 ms drain interval), and fix the misleading comment.

    2. TUI main.rs:580 TODO: a latent bug, currently unreachable.

    • ApiResponse::DeviceState (lib/v1bectl_api/src/axum_server.rs:100-102) carries only state, with no device id. The handler has device_id in scope (:308-317) and doesn't include it.
    • The TUI therefore updates the first device of the same type (v1bectl_tui/src/main.rs:578-597). With two lights, a state response for light B would overwrite light A's row.
    • It's unreachable today because the TUI never sends GetDeviceState; only the CLI (websocket_client.rs:105) and web (sensor_card.rs:31) do, and they match by request, not by row.
    • Add device_id to ApiResponse::DeviceState (a small wire change: CBOR, manual schema) and match on it in the TUI. Low priority, but cheap to do together with test: the core crates (state, sync, api, server, cli, tui) have zero tests #8's API round-trip tests, since those will pin the response shape anyway.
  3. vibechoom commented on Sep 27, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #13 (Docker targets and unreliable_network removed, run-server/run-server-real fixed, crate names in CLAUDE.md/ARCHITECTURE.md corrected) is on main @ 5980bb3. Still open here: the dead-module deletes (web ones held on #5), removing RateLimiter, the inert V1BECTL_* Makefile env vars, make test including gtk, ApiResponse::DeviceState missing device_id, and the 7 TODOs.

  4. vibechoom commented on Sep 27, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #25 removed the web dead modules. Still open here: the CLI client.rs/http_client.rs and TUI dashboard.rs (asked on #5), removing RateLimiter (after #23, same file), the inert V1BECTL_* Makefile env vars and make test's old gtk exclude, ApiResponse::DeviceState device_id, and the code TODOs.

  5. added 2 commits that reference this issue on Sep 27, 2026
  6. vibechoom commented on Sep 28, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #48 is on main @ bfec218. The Makefile no longer sets the inert V1BECTL_GATEWAY_TYPE / V1BECTL_DUMMY_SCENARIO vars, test-real / test-scenario(s) are gone, and test / clippy now run the same commands as CI's native job. There are new test-web / clippy-web targets for the web job. RateLimiter was already removed by #41.

    Still open here (re-swept on bfec218):

  7. vibechoom commented on Sep 28, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #52 (@ 8a34c1b) adds device_id to ApiResponse::DeviceState and fixes the TUI match (v1bectl_tui/src/main.rs, the old :583 TODO is gone). Still open here: the dead-modules question (now also tcp_server.rs, see #5), and 6 code TODOs: dirigera.rs:442, sync.rs:1397, light_group_linear.rs:121, v1bectl_server/src/main.rs:416, screen_renderer.rs:173, websocket_reconnect.rs (pure CBOR).

  8. vibechoom commented on Sep 28, 2026

    @vibechoom
    ContributorAuthor

    A closer look at two of the remaining TODOs (on 07b7bb9):

    • sync.rs:1583 get_state_timestamp always returns "now", so ConflictResolution::TimestampWins can't work: both sides compare the time of the check. Nothing selects it (the only references are in sync.rs), so this is dead code, not a live bug. Recommendation: remove the TimestampWins variant together with get_state_timestamp, instead of adding timestamps to DeviceStateValue. The sync test lane is busy with sync/virtual: after #50 — group writes bypass the engine, the expiry-race remainder, parallel group pushes + rate limit, events.rs doc nits #55, so this goes after it.
    • screen_renderer.rs:173 "Template substitution" has no syntax defined anywhere. The trollshell widget also renders text "…" templates verbatim (v1bectl_widget/src/main.rs:562). This needs a design call before anyone builds it. @annikahannig, do you want text to support placeholders, something like text "Living room: {temperature_living_room.temperature}°"? If yes, the web UI and the widget should share one parser.
  9. added a commit that references this issue on Sep 28, 2026
  10. vibechoom commented on Sep 28, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #59 (@ c5b3a3b) removes ConflictResolution::TimestampWins and get_state_timestamp. The sync.rs TODO is gone. Code TODOs left: dirigera.rs:442 (rgb from HSV, after #30/#37), light_group_linear.rs:121 (inverse brightness map), v1bectl_server/src/main.rs:416 (scene controller creation), screen_renderer.rs:173 (template syntax, a design question above), websocket_reconnect.rs (pure CBOR).

  11. added a commit that references this issue on Sep 29, 2026
  12. vibechoom commented on Sep 29, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #63 (@ d061692). Scene controllers from virtual_devices/*.toml are now created and registered, and the main.rs TODO is gone. The loader was moved unchanged into a testable load_virtual_devices, and there are fixture-driven server tests. The format gaps and follow-ups are in #64. Code TODOs left: dirigera.rs:442 (rgb from HSV, after #30/#37), light_group_linear.rs:121 (being built now), screen_renderer.rs:173 (template syntax, a design question), websocket_reconnect.rs (pure CBOR).

  13. added 2 commits that reference this issue on Sep 29, 2026
  14. vibechoom commented on Sep 29, 2026

    @vibechoom
    ContributorAuthor

    Shipped: #65 (@ 4b6eba1). A LightGroupLinear now inverts each member's [min, max] map before averaging, so a group set to 50 reads back 50 instead of drifting to 77. Dimming a member at the wall re-derives to the level that member implies. After review, the echo-skip guard tests run over a curved LightGroup again (a skip-removed mutant turns 8 tests red). Follow-ups are in #66, including the same drift fix for LightGroup. Code TODOs left: dirigera.rs:442 (rgb from HSV, after #30/#37), screen_renderer.rs:173 (template syntax, a design question), and websocket_reconnect.rs (pure CBOR). Also still waiting on @annikahannig: the dead-modules question (#5).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions