Skip to content

feat(amazonq): inline unit test generation #1406

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

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

Will-ShaoHua
Copy link
Contributor

Problem

Solution

License

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

@Will-ShaoHua Will-ShaoHua mentioned this pull request May 21, 2025
@Will-ShaoHua
Copy link
Contributor Author

Will-ShaoHua commented May 21, 2025

5/21
unitTestIntentDetection is complete
focalFileIdentity is WIP

@Will-ShaoHua Will-ShaoHua changed the title feat(amazonq): enhanced utg feat(amazonq): inline unit test generation May 28, 2025
@@ -1,7 +1,7 @@
// Port of implementation in AWS Toolkit for VSCode
// https://github.com/aws/aws-toolkit-vscode/blob/9d8ddbd85f4533e539a58e76f7c46883d8e50a79/packages/core/src/codewhisperer/models/model.ts

export type UtgStrategy = 'ByName' | 'ByContent'
export type UtgStrategy = 'ByName' | 'ByContent' | 'NEW_UTG'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should just call it UTG

@Will-ShaoHua
Copy link
Contributor Author

   focalFileResolver
    inferFocalFilename
      java
        ✔ should infer and return correct source focal file name case 0
        ✔ should infer and return correct source focal file name case 1
        ✔ should infer and return correct source focal file name case 2
      python
        ✔ should infer and return correct source focal file name case 0
        ✔ should infer and return correct source focal file name case 1
      js
        ✔ should infer and return correct source focal file name case 0
        ✔ should infer and return correct source focal file name case 1
      ts
        ✔ should infer and return correct source focal file name case 0
        ✔ should infer and return correct source focal file name case 1
    extractImportedPaths
      java
        1) case1


  745 passing (7s)
  8 pending
  1 failing

  1) focalFileResolver
       extractImportedPaths
         java
           case1:

      AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  fs.writeFileSync(
      p,
      `
  package com.amazon.q.service;
  
  import com.amazon.q.foo.FooClass;
  import com.amazon.q.bar.BarClass;
  import com.amazon.q.baz1.baz2.BazClass;
  
  public class TestClass {}
  `
  )

      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (src\shared\supplementalContextUtil\focalFileResolution.test.ts:100:24)
      at processImmediate (node:internal/timers:476:21)

supplementalContextValue = await waitUntil(
async function () {
const focalFile = await utgFocalFileResolver.inferFocalFile(document, workspace)
if (focalFile) {

Choose a reason for hiding this comment

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

When isUtg is true but inferFocalFile fails to identify a focal file, should we fall back to using BM25 to retrieve supplemental context? Currently, the logic seems to return an empty result in this case.

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 follow up

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.

2 participants