Skip to content

Conversation

@atonaamz
Copy link
Contributor

@atonaamz atonaamz commented Oct 1, 2025

Problem

codeWhispereServer.ts has more than 1000 lines which is hard to maintain and test individual components.

Solution

Refactor codeWhispereServer.ts into multiple components

  • handler should contain all main components (editCompletionHandler, inlineComptionHandler, sessionResultHandler)
  • utils should contain all utilities files
  • telemetry should contain all telemetry related files
  • codeWhispererServer is for initialization of all components.

Verify the inline and edit are working after refactoring:

Screen.Recording.2025-10-01.at.4.16.44.PM.mov

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 92.25634% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.91%. Comparing base (8a2aa34) to head (7b60bd2).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...line-completion/handler/inlineCompletionHandler.ts 88.86% 55 Missing and 2 partials ⚠️
...inline-completion/handler/sessionResultsHandler.ts 99.38% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2373      +/-   ##
==========================================
+ Coverage   60.63%   60.91%   +0.28%     
==========================================
  Files         258      260       +2     
  Lines       58245    58313      +68     
  Branches     3532     3550      +18     
==========================================
+ Hits        35316    35522     +206     
+ Misses      22863    22724     -139     
- Partials       66       67       +1     
Flag Coverage Δ
unittests 60.91% <92.25%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@atonaamz atonaamz force-pushed the unittests branch 3 times, most recently from 221d336 to 25ba908 Compare October 1, 2025 23:11
@atonaamz atonaamz marked this pull request as ready for review October 1, 2025 23:24
@atonaamz atonaamz requested a review from a team as a code owner October 1, 2025 23:24
@atonaamz atonaamz force-pushed the unittests branch 2 times, most recently from 363554b to 026d993 Compare October 2, 2025 00:02

export class SessionResultsHandler {
constructor(
private readonly logging: any,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, type should be Logging and Telementry?

telemetryService,
credentialsProvider,
editsEnabled,
timeSinceLastUserModification,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we pass functions for editsEnabled and timeSinceLastUserModification like SessionResultsHandler below, otherwise handler won't pick up changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we should. I didn't catch it during testing. Thanks for pointing it out.

@atonaamz atonaamz force-pushed the unittests branch 2 times, most recently from fbf0847 to 0b31636 Compare October 2, 2025 18:25
@atonaamz atonaamz closed this Oct 2, 2025
@atonaamz atonaamz reopened this Oct 2, 2025
@atonaamz
Copy link
Contributor Author

atonaamz commented Oct 2, 2025

/retryBuilds

@atonaamz atonaamz closed this Oct 2, 2025
@atonaamz atonaamz reopened this Oct 2, 2025
private readonly getEditsEnabled: () => boolean,
private readonly getTimeSinceLastUserModification: () => number,
private readonly lsp: Lsp,
private readonly getTextDocument: (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will make a followup PR to move this method to a utils class later

@Will-ShaoHua Will-ShaoHua merged commit 9f745a3 into aws:main Oct 2, 2025
6 checks passed
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.

4 participants