Commit Graph
2 Commits
Author SHA1 Message Date
faumarayandClaude Opus 4.8 30884ad0b5 Decompose Core: split RPC/event setup into files + dedupe init guards
Move Core::setupRpcHandlers (→ CoreRpcHandlers.cpp) and
Core::setupEventBusSubscriptions (→ CoreEventRelay.cpp) out of the
2100-line Core.cpp (now ~1535). They stay Core member functions —
definitions live in dedicated translation units — which gives the
file-decomposition without a risky 500-line this→core rewrite into separate
classes. The RpcAuthRequest struct moves to RpcDtos.hpp as Dto::AuthRequest;
the toJson<T> helper also moves there so both units share it.

Add Core::requireInitialized() and collapse the 28 identical
`if (!initialized_) return fail(ServiceUnavailable,…)` guards into
`if (auto r = requireInitialized(); !r) return std::unexpected(r.error());`.

Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:26:26 +03:00
faumarayandClaude Opus 4.8 0779fdcf20 Serialize RPC responses + event payloads via Void::Json (RpcDtos)
Replace the ~37 hand-built JSON strings in setupRpcHandlers and
setupEventBusSubscriptions (and broadcastEvent) with reflectable DTOs in a
new RpcDtos.hpp, serialized through Void::Json. This fixes a real
correctness bug — track titles/artists, nicknames, playlist IDs, and play
messages containing " or \ produced invalid JSON before; they are now
correctly escaped (verified: `My "Song" \o/` -> `My \"Song\" \\o/`).

Shapes preserved (same keys/order); the only change is absent optionals now
serialize as null instead of being omitted. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:20:13 +03:00