Repository navigation
feat(commit): make createTree chunking payload-size aware - #35
Merged
Merged
Conversation
Chunk tree entries by approximate serialized byte size in addition to the existing entry-count cap, starting a new createTree request once a chunk nears TREE_ENTRY_BYTE_LIMIT (6 MiB) so many large inline text files cannot produce an oversized request body. Route text files above INLINE_CONTENT_SIZE_LIMIT (1 MiB) through createBlob instead of inlining their content, further bounding request size. Refs: #22
c-vigo
force-pushed
the
feature/22-createtree-payload-chunking
branch
from
July 14, 2026 08:25
2ad2dd7 to
d2b2541
Compare
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
createTreeChainedchunked by entry count only (TREE_ENTRY_CHUNK_SIZE = 100), so a chunk of many large inline text files could approach GitHub's ~100 MB request-body limit. This adds payload-size awareness and a per-file blob-fallback.Closes #22.
Changes
TREE_ENTRY_BYTE_LIMIT = 6 MiB.createTreeChainedrewritten from a fixed-stride slice loop to an accumulating loop with aflush()helper: a chunk ends when adding the next entry would breach either the count cap or the byte budget (whichever first). Empty-chunk guard ensures a single oversized entry still makes progress. Chaining semantics (each chunk's tree SHA → nextbase_tree) unchanged.INLINE_CONTENT_SIZE_LIMIT = 1 MiB. Text files larger than this go throughcreateBlob(base64) instead of inlinecontent.estimateEntrySize— safe over-approximation (64 B overhead + path + content/sha bytes).Tests
createTreecalls, correctbase_treechaining,createBlobnever called.INLINE_CONTENT_SIZE_LIMIT + 1→ routed throughcreateBlob, tree entry carriesshanotcontent.Verification
npm test: 82 passed (3 suites);tsc+nccbuild ok,dist/committed; pre-commit green.Both this and #34 (retry granularity, issue #24) rewrite
createTreeChained. Recommend merging #34 first, then rebasing this branch and re-threading theretry?param so thecreateTreecall inside the newflush()is wrapped viacallWithRetry. No overlap outsidecreateTreeChained/createTree.Refs: #22