Skip to content

chore: sync dev with main - #40

Merged
vig-os-release-app[bot] merged 2 commits into
devfrom
chore/sync-main-to-dev-4-1
Jul 14, 2026
Merged

vig-os-release-app[bot] merged 2 commits into
devfrom
chore/sync-main-to-dev-4-1

Conversation

@vig-os-release-app

Copy link
Copy Markdown
Contributor

Syncs dev with main (sync-main-to-dev workflow).

c-vigo and others added 2 commits July 14, 2026 10:24
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
## Summary

`createTreeChained` chunked 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
- **Byte-aware chunking** — new exported `TREE_ENTRY_BYTE_LIMIT = 6
MiB`. `createTreeChained` rewritten from a fixed-stride slice loop to an
accumulating loop with a `flush()` 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 → next
`base_tree`) unchanged.
- **Per-file threshold** — new exported `INLINE_CONTENT_SIZE_LIMIT = 1
MiB`. Text files larger than this go through `createBlob` (base64)
instead of inline `content`.
- `estimateEntrySize` — safe over-approximation (64 B overhead + path +
content/sha bytes).

## Tests
1. 4× 2.5 MiB text files (under the count cap) split at 2 entries/chunk
purely on the byte budget → 2 `createTree` calls, correct `base_tree`
chaining, `createBlob` never called.
2. One text file at `INLINE_CONTENT_SIZE_LIMIT + 1` → routed through
`createBlob`, tree entry carries `sha` not `content`.

## Verification
- `npm test`: **82 passed** (3 suites); `tsc` + `ncc` build ok, `dist/`
committed; pre-commit green.

## ⚠️ Merge sequencing (conflicts with #34)
Both this and **#34 (retry granularity, issue #24)** rewrite
`createTreeChained`. Recommend merging **#34 first**, then rebasing this
branch and re-threading the `retry?` param so the `createTree` call
inside the new `flush()` is wrapped via `callWithRetry`. No overlap
outside `createTreeChained`/`createTree`.

Refs: #22
@vig-os-release-app
vig-os-release-app Bot merged commit 5983d68 into dev Jul 14, 2026
8 checks passed
@vig-os-release-app
vig-os-release-app Bot deleted the chore/sync-main-to-dev-4-1 branch July 14, 2026 08:27
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.

1 participant