[codex] fix(graphql): bind live chat service at runtime#511
Conversation
Merging this PR will improve performance by 18.75%
Performance Changes
Comparing Footnotes
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR fixes a late-binding bug where GraphQL was holding a frozen Key changes:
Minor note: After this refactor Confidence Score: 5/5Safe to merge; the proxy pattern is correct, all 16 ChatService methods are forwarded, and the integration test validates the targeted regression. The only finding is a P2 style observation about a now-unused crates/gateway/src/services.rs — Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant GraphQL Schema
participant GraphqlChatServiceProxy
participant GatewayState
participant LiveChatService
Note over GraphQL Schema, GraphqlChatServiceProxy: Schema built once at startup<br/>(proxy holds Arc<GatewayState>)
Client->>GraphQL Schema: POST /graphql (mutation chat.send)
GraphQL Schema->>GraphqlChatServiceProxy: send(params)
GraphqlChatServiceProxy->>GatewayState: chat() — read lock
GatewayState-->>GraphqlChatServiceProxy: Arc<LiveChatService> (override)
GraphqlChatServiceProxy->>LiveChatService: send(params)
LiveChatService-->>GraphqlChatServiceProxy: ServiceResult
GraphqlChatServiceProxy-->>GraphQL Schema: ServiceResult
GraphQL Schema-->>Client: { data: { chat: { send: ... } } }
Note over GatewayState: Before fix: schema held a frozen<br/>Arc<NoopChatService> snapshot
Reviews (2): Last reviewed commit: "fix(graphql): address review feedback" | Re-trigger Greptile |
Summary
GatewayState::chat()at request time instead of using the frozenservices.chatslotchat_overrideafterwards, and proves GraphQLchat.sendandsessions.activehit the live runtime serviceservices.chatpointer beforeLiveChatServicewas attached, while RPC and WebSocket methods already resolved chat through the late-bound overrideValidation
Completed
cargo +nightly-2025-11-30 test -p moltis-httpd --test graphql_chat_bindingjust formatcargo +nightly-2025-11-30 fmt --all -- --checkRemaining
just lint(started, but stopped after roughly 5 minutes to honor the repo command timeout rule; full workspace clippy status is still pending)Manual QA
chat.sendandsessions.activematch RPC/WebSocket behavior on the same runtime state instead of falling back to the noop chat service.