Skip to content

Conversation

@hi-rai
Copy link
Contributor

@hi-rai hi-rai commented Oct 30, 2025

This fixes #33 (comment)

IMPORTANT - This also requires create batch result public API PR to be merged in the tms repo and then wait for the next release (not adding release tag for now)

@gemini-code-assist
Copy link

Summary of Changes

Hello @hi-rai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant performance enhancements to the result submission process by enabling concurrent file uploads and batch creation of test results. It refactors the ResultUploader class to leverage these new capabilities, updating the internal API calls and data structures to support the batching mechanism. This change is dependent on a corresponding 'create batch result public API' PR being merged in the tms repository.

Highlights

  • Concurrent File Uploads: Implemented a mechanism to upload attachments concurrently, significantly speeding up the process when multiple files are involved. A MAX_CONCURRENT_FILE_UPLOADS constant (set to 10) controls the degree of parallelism.
  • Batch Result Creation: Results are now created in batches rather than individually, utilizing a new batch API endpoint. This reduces the number of API calls and improves efficiency, with MAX_RESULTS_IN_REQUEST (set to 50) defining the batch size.
  • API Changes: The internal API client has been updated to reflect a new batch result creation endpoint (/result/batch), replacing the previous single-result endpoint. This includes renaming createResultStatus to createResults and updating its request/response schemas.
  • Performance Improvement: The overall result submission process is expected to be much faster due to the concurrent handling of file uploads and batched creation of test results.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces concurrent file uploads and result creation, addressing issue #33. It includes changes to the package.json version, updates to API schemas and run APIs, modifications to the result uploader for handling attachments and batch result creation, and adjustments to the twirl loader in misc.ts. The most significant changes involve refactoring the uploadTestCases function in ResultUploader.ts to handle attachment uploads and result creation in batches, improving efficiency and concurrency.

Comment on lines 233 to 240
for (const item of items) {
const promise = handler(item)
.then((result) => {
results.push(result)
})
.finally(() => {
executing.delete(wrappedPromise)
})

Choose a reason for hiding this comment

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

critical

The processConcurrently function uses a Set to track executing promises and Promise.race to limit concurrency. However, the finally block only deletes the wrappedPromise from the executing set. If the handler function throws an error, the wrappedPromise will be rejected, but the original promise will still be in the executing set, potentially leading to incorrect concurrency control.

To fix this, ensure that the original promise is deleted from the executing set in the finally block.

        .finally(() => {
          executing.delete(promise)
        })

Copy link
Collaborator

@satvik007 satvik007 left a comment

Choose a reason for hiding this comment

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

Test it once when new production deployment happens.

import { ResultUploadCommandArgs, UploadCommandType } from './ResultUploadCommandHandler'

const MAX_CONCURRENT_FILE_UPLOADS = 10
let MAX_RESULTS_IN_REQUEST = 50 // Only updated from tests, otherwise it's a constant
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its probably not that bad, but MAX_RESULTS_IN_REQUEST should really be a constant and there could be a factory style way to create ResultUploader where it could be modified. The simplest way to be to just not have those test cases that rely on this, or fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The simplest way to be to just not have those test cases that rely on this, or fix it - The tests don't rely on it, but rather verify the expected behavior by modifying the value

Since in tests we directly run the command (which in turn creates ResultUploader), instead of directly creating ResultUploader, the only way I can think of is to have a new command line argument for this. But that would make it more complex

@satvik007 satvik007 merged commit 2ba5c2e into main Nov 26, 2025
1 check passed
satvik007 added a commit that referenced this pull request Nov 26, 2025
@satvik007 satvik007 deleted the dev/himanshu/concurrent-file-upload-and-result-creation branch November 26, 2025 18:51
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