refactor: quick chat state machines POC
Description
This MR is a POC of introducing State Machine into Quick Chat to simplify the Quick Chat logics by having clear finite states and transitions.
In this MR, only the 'happy path' has been integrated with the State Service. The happy path refers to opening a quick chat, sending a message, and receiving a response.
The diagram below shows the states and state transitions the state service follows.
stateDiagram
direction TB
state DocumentStates {
direction TB
[*] --> InCurrentDocument
InCurrentDocument --> InDifferentDocument: switches document
InDifferentDocument --> InCurrentDocument: returns to original document
[*] InCurrentDocument
InDifferentDocument
}
[*] --> NoQuickChat: extension initialized
NoQuickChat --> PendingUserInput: triggers Quick Chat (input box)
PendingUserInput --> ProcessingRequest: sends message
PendingUserInput --> NoQuickChat: closes Quick Chat (input box)
ProcessingRequest --> DisplayingResponse: response received
DisplayingResponse --> PendingUserInput: triggers Quick Chat (input box)
DisplayingResponse --> QuickChatCollapsed: collapses chat
QuickChatCollapsed --> DisplayingResponse: expands chat
DisplayingResponse --> DisplayingResponse: sends special command
DisplayingResponse --> ProcessingRequest: sends message (thread comment)
ProcessingRequest --> Error:network error/timeout
Error --> ProcessingRequest: sends message (thread comment)
Error --> PendingUserInput: triggers Quick Chat (input box)
Related Issues
How has this been tested?
-
If src/browserorsrc/commonhas been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE. -
Consider an end-to-end test for significant new features that aren't covered by integration tests.
Run the extension locally
- select a block of codes
- press
option + cto open Quick Chat prompt - Type
explainand hit enter - A comment thread is created and the response is streamed.
You can also check the status transitioning accordingly in the output panel > GitLab Workflow
Screenshots (if appropriate)
State Machines Shadowing Quick Chat.mov
What CHANGELOG entry will this MR create?
-
fix:Bug fix fixes - a user-facing issue in production - included in changelog -
feature:New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog -
None - other non-user-facing changes
Edited by Juhee Lee