Skip to content

Conversation

@leigaol
Copy link
Contributor

@leigaol leigaol commented Sep 2, 2025

Problem

Solution


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions
Copy link

github-actions bot commented Sep 2, 2025

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores the TelemetryHelper class functionality by removing placeholder implementations and adding back the actual telemetry recording methods for CodeWhisperer. The PR addresses the "fix(amazonq): add telemetryHelper back" objective by replacing stub methods with complete implementations.

  • Replaces method stubs that threw "Method not implemented" errors with full implementations
  • Adds comprehensive telemetry data collection and emission for user decisions and trigger events
  • Integrates with various utility modules and telemetry services for complete functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


private resetUserTriggerDecisionTelemetry() {
this.sessionDecisions = []
this.triggerChar = ''
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting triggerChar to empty string instead of undefined is inconsistent with its type declaration (line 51) and initialization (line 51). This should be this.triggerChar = undefined to maintain type consistency.

Suggested change
this.triggerChar = ''
this.triggerChar = undefined

Copilot uses AI. Check for mistakes.
Comment on lines +252 to +257
let acceptedRecommendationContent
if (acceptIndex !== -1 && recommendations[acceptIndex] !== undefined) {
acceptedRecommendationContent = recommendations[acceptIndex].content
} else {
acceptedRecommendationContent = ''
}
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The TODO comment suggests using a ternary operator, which would make this code more concise and readable: const acceptedRecommendationContent = (acceptIndex !== -1 && recommendations[acceptIndex]) ? recommendations[acceptIndex].content : ''

Suggested change
let acceptedRecommendationContent
if (acceptIndex !== -1 && recommendations[acceptIndex] !== undefined) {
acceptedRecommendationContent = recommendations[acceptIndex].content
} else {
acceptedRecommendationContent = ''
}
const acceptedRecommendationContent =
acceptIndex !== -1 && recommendations[acceptIndex]
? recommendations[acceptIndex].content
: ''

Copilot uses AI. Check for mistakes.
Comment on lines +506 to +509
private getAggregatedSuggestionReferenceCount(
events: CodewhispererUserDecision[]
// if there is reference for accepted recommendation within the session, mark the reference number
// as 1, otherwise mark the session as 0
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function documentation comment is incorrectly placed after the parameter list instead of before the function declaration. Move the comment above line 506 and format it as a proper JSDoc comment.

Suggested change
private getAggregatedSuggestionReferenceCount(
events: CodewhispererUserDecision[]
// if there is reference for accepted recommendation within the session, mark the reference number
// as 1, otherwise mark the session as 0
/**
* If there is reference for accepted recommendation within the session, mark the reference number
* as 1, otherwise mark the session as 0.
*/
private getAggregatedSuggestionReferenceCount(
events: CodewhispererUserDecision[]

Copilot uses AI. Check for mistakes.
Comment on lines +475 to +479
private getAggregatedSuggestionState(
// if there is any Accept within the session, mark the session as Accept
// if there is any Reject within the session, mark the session as Reject
// if all recommendations within the session are empty, mark the session as Empty
// otherwise mark the session as Discard
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function documentation comment is incorrectly placed before the parameter list instead of before the function declaration. Move the comment above line 475 and format it as a proper JSDoc comment.

Suggested change
private getAggregatedSuggestionState(
// if there is any Accept within the session, mark the session as Accept
// if there is any Reject within the session, mark the session as Reject
// if all recommendations within the session are empty, mark the session as Empty
// otherwise mark the session as Discard
/**
* Aggregates the suggestion states for a session:
* - If there is any Accept within the session, marks the session as Accept.
* - If there is any Reject within the session, marks the session as Reject.
* - If all recommendations within the session are empty, marks the session as Empty.
* - Otherwise, marks the session as Discard.
*/
private getAggregatedSuggestionState(

Copilot uses AI. Check for mistakes.
@leigaol leigaol merged commit 1f691a8 into aws:feature/inline-rollback Sep 3, 2025
17 of 22 checks passed
andrewyuq pushed a commit that referenced this pull request Sep 10, 2025
## Problem

add back test file for telemetryHelper.ts

Test file for #7975

Ref: #7906

## Solution


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants