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`.
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`.