-
Notifications
You must be signed in to change notification settings - Fork 274
auto-trigger a/b #4961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto-trigger a/b #4961
Conversation
bd19e86 to
db17201
Compare
54710a6 to
d994940
Compare
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererInvocationStatusNew.getInstance().documentChanged() | ||
| } else { | ||
| CodeWhispererInvocationStatus.getInstance().documentChanged() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for all these singleton service, I think we can do
fun getInstance(): CodeWhispererService = if (newUX) CodeWhispererServiceNew.getInstance() else service()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeWhispererServiceNew.getInstance() is of type CodeWhispererServiceNew, so the getInstance() will have a type of Any then
| val manager = CodeWhispererCodeReferenceManager.getInstance(sessionContext.project) | ||
| manager.insertCodeReference(states, previews, sessionContext.selectedIndex) | ||
| manager.addListeners(sessionContext.editor) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we have the new implementation in the existing class, shouldnt we just use the existing CodeWhispererCodeReferenceActionListener above and override?
rli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see lots of code that appears duplicate between old/new so it is difficult to figure out what is new and what is just the same logic but referencing new objects
| if (!( | ||
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererServiceNew.getInstance().canDoInvocation(editor, CodewhispererTriggerType.OnDemand) | ||
| } else { | ||
| CodeWhispererService.getInstance().canDoInvocation(editor, CodewhispererTriggerType.OnDemand) | ||
| } | ||
| ) | ||
| ) { | ||
| return | ||
| } | ||
|
|
||
| val triggerType = TriggerTypeInfo(CodewhispererTriggerType.OnDemand, CodeWhispererAutomatedTriggerType.Unknown()) | ||
| val job = CodeWhispererService.getInstance().showRecommendationsInPopup(editor, triggerType, latencyContext) | ||
| val job = if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererServiceNew.getInstance().showRecommendationsInPopup(editor, triggerType, latencyContext) | ||
| } else { | ||
| CodeWhispererService.getInstance().showRecommendationsInPopup(editor, triggerType, latencyContext) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can avoid working around typecast issues if you declare a common interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when can we get rid of this file? it should be possible to have all sigv4/bearer coexist. ideally streamining/non-streaming can share clients too
| } | ||
| } | ||
|
|
||
| fun getMatchingSymbolsFromRecommendation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's not too hard can you pull out the common code so there's less delta and risk
| import java.util.Queue | ||
|
|
||
| @Service | ||
| class CodeWhispererTelemetryServiceNew { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't telemetry will share most of the same logic and only have some new param, if only function parameters are different we can just have overloads
| CodeWhispererPopupManager.CODEWHISPERER_USER_ACTION_PERFORMED, | ||
| object : CodeWhispererUserActionListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like these 2 lines are shared, so we just need one listener with 2 afterAccept?
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererInvocationStatusNew.getInstance().hasExistingServiceInvocation() | ||
| } else { | ||
| CodeWhispererInvocationStatus.getInstance().hasExistingServiceInvocation() | ||
| } | ||
| ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here if we can do
fun getInstqaonce() = if (newUX) CodeWhispererInvocationStatusNew.getInstance() else service()
code here won't need to be changed and can be as it is
CodeWhispererInvocationStatus.getInstance().hasExistingServiceInvocation()
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererTelemetryServiceNew.getInstance().previousUserTriggerDecision | ||
| } else { | ||
| CodeWhispererTelemetryService.getInstance().previousUserTriggerDecision |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel telemetryService can be shared, and have likely maintain 2 previousUserTriggerDecision
class CwsprTelemetryService {
private val previousUserTriggerDecisionOld: Queue<Decision>
private val previousUserTrigerDecisionNew: Queue<Decision>
val previousUserTriggerDecision: Decision
get() {
if (newUX) {} else {}
}
}
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererServiceNew.getInstance().canDoInvocation(editor, CodewhispererTriggerType.AutoTrigger) | ||
| } else { | ||
| CodeWhispererService.getInstance().canDoInvocation(editor, CodewhispererTriggerType.AutoTrigger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
fun getInstance() = if (newUX) newService.getInstance() else service()
then we won't need change here
CodeWhispererService.getInstance().canDoInvocation(editor, CodewhispererTriggerType.AutoTrigger)
| if (CodeWhispererFeatureConfigService.getInstance().getNewAutoTriggerUX()) { | ||
| CodeWhispererServiceNew.getInstance().showRecommendationsInPopup(editor, triggerTypeInfo, latencyContext) | ||
| } else { | ||
| CodeWhispererService.getInstance().showRecommendationsInPopup(editor, triggerTypeInfo, latencyContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
fun getInstance() = if (newUX) newService.getInstance() else service()
then we won't need change here
CodeWhispererService.getInstance().showRecommendationsInPopup(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QDJVMC found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
|
Most of the comments are around refactoring old/new classses into having a common interface and implementations to implement the diffs, there's some work for the refactor, will be pushing the current version as is since it also does the job and revisit the refactor later |
xxxNewclasses that will be used for new auto-trigger UX, old UX will continue to use the classes without theNewsuffix.Types of changes
Description
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.