Skip to content
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

Ignore large files when building the diff for welcome and review purposes #2173

Open
kgilpin opened this issue Jan 3, 2025 · 1 comment · May be fixed by #2217
Open

Ignore large files when building the diff for welcome and review purposes #2173

kgilpin opened this issue Jan 3, 2025 · 1 comment · May be fixed by #2217
Assignees
Labels
enhancement New feature or request navie-plan

Comments

@kgilpin
Copy link
Contributor

kgilpin commented Jan 3, 2025

When examining the diff to suggest user questions and to perform code review, ignore large file diffs. A typical example would be yarn.lock.

@kgilpin kgilpin added enhancement New feature or request navie-plan labels Jan 3, 2025
Copy link

github-actions bot commented Jan 3, 2025

Gathering additional information, please wait... done!

Title: Ignore Large Files When Building Diff for Welcome and Review

Problem: The current system does not ignore large files when building diffs for generating user questions and performing code reviews. This can lead to inefficiencies and irrelevant suggestions, particularly with files like yarn.lock.

Analysis: In the context of suggesting user questions and performing code reviews, large file changes might not provide relevant information and could unnecessarily complicate the change analysis. The yarn.lock file, often large and auto-generated, is a good example of such a file.

The solution should involve determining whether a file is large before it is included in the diff analysis used for generating suggestions and reviews. This will prevent large files from altering the logic of change analysis and keep the focus on more meaningful modifications. The file size checking logic should already partially exist as seen in the presence of functions like isLargeFile.

Proposed Changes:

  1. Check and Modify Diff Collection Logic:

    • Locate the logic responsible for gathering changes and generating diffs for introducing suggestions and code reviews. This seems included in functionalities associated with the getWelcomeSuggestion function and related diffs collection and processing.
  2. Implement Large File Filtering:

    • Integrate a check using existing functions like isLargeFile to filter out large files. Ensure this logic runs before the diffs are interpreted or acted upon. This might mean enhancing or wrapping logic in getDiffLog, getWorkingDiff, or similar functions.
  3. Exclude Large Files at an Early Stage:

    • It’s critical to apply this check as early as possible to exclude large files before processing them to avoid computational overhead.
  4. Integration Test:

    • Ensure that changes are tested, especially looking at any parts interfacing with getWelcomeSuggestion and related command processes like WelcomeCommand. Verify no large diffs appear in suggestions and reviews.

By implementing these modifications, you should be able to ignore large files from the change analysis processes used in suggestions and code reviews, consequently focusing only on differences in smaller, more pertinent files.

dividedmind added a commit that referenced this issue Jan 23, 2025
This skips diffs larger than 1000 characters when generating input
for @WELCOME and @review. Large diffs are replaced with a message,
for example

    diff --git a/file2.txt b/file2.txt
    [Change of size 2078]

Fixes #2173
dividedmind added a commit that referenced this issue Jan 23, 2025
This skips diffs larger than 1000 characters when generating input
for @WELCOME and @review. Large diffs are replaced with a message,
for example

    diff --git a/file2.txt b/file2.txt
    [Change of size 2078]

Fixes #2173
dividedmind added a commit that referenced this issue Jan 23, 2025
This skips diffs larger than 1000 characters when generating input
for @WELCOME and @review. Large diffs are replaced with a message,
for example

    diff --git a/file2.txt b/file2.txt
    [Change of size 2078]

Fixes #2173
dividedmind added a commit that referenced this issue Jan 23, 2025
This skips diffs larger than 5000 characters when generating input
for @WELCOME and @review. Large diffs are replaced with a message,
for example

    diff --git a/file2.txt b/file2.txt
    [Change of size 2078]

Fixes #2173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request navie-plan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants