Fix/243 truncated repo tree fallback - #245
Open
envico801 wants to merge 2 commits into
Open
Conversation
Add fallback mechanism when GitHub's recursive tree API is truncated (>100k files). When truncation is detected, the extension now fetches directory-specific data using the contents endpoint to ensure sizes are still displayed. This resolves cases where folders show "..." or no size due to missing data in truncated API responses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Handle GitHub API tree truncation (100k+ files)
This PR fixes an issue where repository sizes are not displayed (or show
"...") for very large repositories.Root cause
The extension relies on the GitHub API endpoint:
However, GitHub enforces a hard limit of 100,000 files per response. When this limit is exceeded:
truncated: true)Check the official api for more info:
As a result, the extension fails to find files and outputs
"...".This can be reproduced with:
Solution
When a truncated tree is detected, this PR introduces a fallback mechanism:
Detect
repoInfo.truncated === trueFetch the currently viewed directory using:
Inject the returned items into the existing tree
This ensures that visible files in the current directory always have valid size data.
Limitation (Important)
0 Bin truncated repositoriesThis is expected, since calculating folder sizes would require recursive fetching, which would:
Changes
getFallbackDirectoryInfo()inapi.tsupdateDOM()indom-manipulation.tsCloses #243
Before:
After: