4b34a39745
Bundle all pending repository updates, including plugin context de-globalization, runtime hardening, config validation, boundary tests, and supporting docs/scripts. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2.7 KiB
2.7 KiB
Top 5 Real Architecture Issues
1) Global plugin compatibility registries still exist
Files
src/trx-server/trx-backend/src/lib.rssrc/trx-client/trx-frontend/src/lib.rs
Why this matters
OnceLock<Mutex<...>> registry shims still hold mutable global state. This keeps plugin registration behavior implicit and harder to test.
Fix steps
- Introduce explicit plugin registration API that takes a mutable context.
- Make plugin loader return registration data instead of relying on global side effects.
- Remove global
register_*/snapshot_bootstrap_contextwrappers after migration.
2) No supervised shutdown/lifecycle model
Files
src/trx-server/src/main.rssrc/trx-client/src/main.rs
Why this matters
Many tasks are detached via tokio::spawn and process shutdown mostly waits on Ctrl+C. Task failures and cancellation order are not centrally managed.
Fix steps
- Add shared cancellation token.
- Track tasks in
JoinSet. - On shutdown: stop listeners, cancel workers, await joins with timeout, then exit.
3) Protocol/network hardening gaps
Files
src/trx-client/src/remote_client.rssrc/trx-server/src/listener.rssrc/trx-client/trx-frontend/trx-frontend-http-json/src/server.rs
Why this matters
parse_remote_url is ad-hoc and line-based listeners accept unbounded lines. This risks parsing edge cases and memory pressure.
Fix steps
- Replace string URL parsing with typed address parsing (support IPv4/IPv6/hostnames explicitly).
- Enforce maximum line/frame size for JSON-over-TCP.
- Add read/write/request timeouts and explicit error messages.
4) Config has parse defaults but weak semantic validation
Files
src/trx-server/src/config.rssrc/trx-client/src/config.rs
Why this matters
Config loads successfully even when values are semantically bad (timings, ports, audio params), leading to runtime failures.
Fix steps
- Add
validate()to server/client config models. - Validate ranges and required field combinations.
- Call
validate()in startup before spawning tasks; fail fast with clear path-based errors.
5) Integration coverage is still thin at boundaries
Files
src/trx-server/src/listener.rssrc/trx-client/src/remote_client.rssrc/trx-client/trx-frontend/trx-frontend-http-json/src/server.rssrc/trx-app/src/plugins.rs
Why this matters
Most coverage is unit-level. Critical network/plugin/runtime flows can regress without tests.
Fix steps
- Add integration tests for JSON TCP auth/command flow.
- Add reconnect tests for remote client.
- Add plugin load/failure isolation tests.
- Add shutdown behavior tests once lifecycle supervision is added.