refactor: route all state mutations through process() via system signals#130
refactor: route all state mutations through process() via system signals#130
Conversation
Fix architecture principle violations #1, #3, #4, #7: - Fix #1: Remove dual lifecycle mutation by deleting applyLifecycleFromBackendMessage() which was redundant with reduceLifecycle() - Fix #3: Make transitionLifecycle() private. Add SESSION_CLOSING system signal and route coordinator's direct calls through process() - Fix #7: Route ConsumerGateway's backend:relaunch_needed emission through the runtime as BACKEND_RELAUNCH_NEEDED system signal instead of emitting directly - Fix #4: Route BackendConnector's inline broadcasts and event emissions through the runtime via routeSystemSignal callback: - Part A: Connect/disconnect lifecycle (cli_connected, backend:connected, etc.) - Part B: Slash passthrough results/errors (slash_command_result, slash_command_error) This enforces the core design principle that all state mutations flow through SessionRuntime.process(), which dispatches to the pure reducer and executes effects. All 2902 tests pass, typecheck clean. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Summary of ChangesHello @teng-lin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the application's state management by centralizing all state mutations through a single Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the application to route all state mutations through SessionRuntime.process() using system signals, addressing several architectural principle violations. The changes include removing dual lifecycle mutations, making transitionLifecycle() private, routing ConsumerGateway relaunch signals, and routing BackendConnector broadcasts and events through system signals. The changes involve modifications to several test files and core files, introducing a routeSystemSignal function and ensuring all state transitions are handled via the central process() method.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Fix architecture principle violations #1, #3, #4, #7 by routing all state mutations through
SessionRuntime.process()and the pure reducer.applyLifecycleFromBackendMessage())transitionLifecycle()private, addSESSION_CLOSINGsignalConsumerGatewayrelaunch signal through the runtimeBackendConnectorbroadcasts and events through system signals:Test plan
transitionLifecycle()BackendConnectorno longer callsbroadcaster.broadcast()oremitEvent()directly for scoped casesConsumerGatewayno longer emitsbackend:relaunch_neededdirectly🤖 Generated with Claude Code