fix: guard createASTCache against zero maxSize to prevent LRU cache crash#144
Merged
magyargergo merged 2 commits intoMar 6, 2026
Merged
Conversation
…rash When a repo has no parseable files (e.g., unsupported languages or all files filtered out), chunks.reduce returns 0, causing createASTCache(0) to pass max:0 to LRUCache which throws TypeError. This clamps maxSize to at least 1 and adds a progress message when no parseable files exist.
|
@magyargergo is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
Author
|
This is a duplicate of #134 |
This was referenced Mar 6, 2026
motolese
pushed a commit
to motolese/datamoto-gitnexus
that referenced
this pull request
Apr 23, 2026
…-zero-max-crash fix: guard createASTCache against zero maxSize to prevent LRU cache crash
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.
Summary
gitnexus analyze --forcecrashes withTypeError: At least one of max, maxSize, or ttl is requiredon repos where no files pass the parseable filter (e.g., all files are in unsupported languages, all filtered by .gitignore, or native bindings fail to load)chunks.reduce((max, c) => Math.max(max, c.length), 0)returns0when chunks is empty, andcreateASTCache(0)passesmax: 0tonew LRUCache()which throwsmaxSizeto at least 1 increateASTCache(), and add a progress message when no parseable files are foundChanges
src/core/ingestion/ast-cache.tsMath.max(maxSize, 1)guardsrc/core/ingestion/pipeline.tstotalParseable === 0test/unit/ast-cache.test.tscreateASTCache(0)edge caseTest plan
createASTCache(0)doesn't throw and clamps to 1gitnexus analyze --forceon a repo with only unsupported language files