Skip to content

Refactor connection-level command dispatch #26

Description

@mack42

Source: Audit finding M8

`src/server/connection.rs` contains many `if cmd_name == "SUBSCRIBE"` / `"MULTI"` / `"WATCH"` / `"CLIENT"` etc. branches scattered through `execute_command`. These are commands whose handling depends on per-connection state (subscription set, transaction queue, tracking flag) and so cannot live in the global `CommandRegistry`. The current pattern is fragile: silent fallthrough on misspellings, hard to audit which commands are connection-level vs registry-level.

Suggested approach: Introduce a `ConnectionCommand` enum + dispatch table, similar to `CommandRegistry` but with access to `&mut self`. Move the inlined branches into typed handlers. Keep the registry for stateless commands.

Scope: ~400 lines of dispatch logic in `connection.rs`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttier-3Differentiator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions