Skip to content

feat(extraction): make MAX_FILE_SIZE configurable via CODEGRAPH_MAX_FILE_SIZE env var#1224

Open
fengshao1227 wants to merge 1 commit into
colbymchenry:mainfrom
fengshao1227:feat/configurable-max-file-size
Open

feat(extraction): make MAX_FILE_SIZE configurable via CODEGRAPH_MAX_FILE_SIZE env var#1224
fengshao1227 wants to merge 1 commit into
colbymchenry:mainfrom
fengshao1227:feat/configurable-max-file-size

Conversation

@fengshao1227

Copy link
Copy Markdown

Summary

Projects with legitimate large source files (1–5 MB hand-written code, not minified bundles or vendored blobs) are silently skipped during indexing due to the hardcoded 1 MB file size limit. This leaves gaps in the function graph.

This PR makes the limit configurable via the CODEGRAPH_MAX_FILE_SIZE environment variable (value in bytes), following the existing pattern of CODEGRAPH_* env vars for runtime configuration:

CODEGRAPH_MAX_FILE_SIZE=5242880 codegraph index   # 5 MB limit

The 1 MB default is unchanged — zero behavior difference for users who don't set the variable.

  • Invalid values (non-numeric, zero, negative) silently fall back to the 1 MB default
  • The size_exceeded warning message already includes the effective limit, so users can see the configured value
  • The exported getMaxFileSize() function enables testing and future use by codegraph status

Closes #1016

Test plan

  • 3 new tests in extraction.test.ts:
    • Default 1 MB when env var is not set
    • Custom value when env var is a valid positive integer
    • Fallback to default for invalid values (non-numeric, negative, zero)
  • All existing extraction tests pass (zero regressions)

…ILE_SIZE env var (colbymchenry#1016)

Projects with legitimate large source files (1-5 MB, not minified/vendored)
were silently skipped during indexing, leaving gaps in the function graph.

The 1 MB default is unchanged. Users can override it via the
CODEGRAPH_MAX_FILE_SIZE environment variable (value in bytes):

  CODEGRAPH_MAX_FILE_SIZE=5242880 codegraph index

Invalid values (non-numeric, zero, negative) fall back to the 1 MB default.

Closes colbymchenry#1016
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.

Make MAX_FILE_SIZE configurable via environment variable

1 participant