Repository navigation
chore: sync dev with main - #39
Merged
Merged
Conversation
Wrap each Octokit REST call inside createTree, createTreeChained, and createBlob in withRetry via an optional RetryOptions parameter, instead of wrapping the whole multi-call createTree operation in commitViaAPI. A transient mid-batch failure now retries only the failing call rather than re-running the entire tree build and re-uploading already-succeeded blobs and tree chunks, saving API budget and easing rate-limit pressure. The new RetryOptions parameter is optional and defaults to no retries, keeping the public signatures of createBlob and createTree backward compatible. Refs: #24
## Summary Retries are now applied at **individual Octokit REST call sites** inside `createTree` / `createTreeChained` / `createBlob`, replacing the coarse `withRetry` wrap around the *entire* `createTree` in `commitViaAPI`. A transient mid-batch failure now retries only the failing call instead of re-running the whole multi-call operation and re-uploading already-created blobs/trees. Closes #24. ## How - New exported `RetryOptions { config: RetryConfig; logger? }` + private `callWithRetry(fn, retry?)` helper — calls `fn()` once when `retry` is undefined, else `withRetry(fn, config, logger)`. - `retry?: RetryOptions` threaded (optional, defaults to **no retries** → backward-compatible signatures) through `createBlob`, `createTreeChained`, `createTree`. - `commitViaAPI` drops the `withRetry(() => createTree(...))` wrap and passes `{ config: retryConfig, logger: log }` into `createTree`. The other single-call coarse wraps (getCommit/getBranchInfo/createCommit/updateBranch) are unchanged (already one call each). ## Tests (both fail against the old coarse wrap) 1. **Chunked tree retry**: 101 files → 2 chunks; chunk-2 fails 503 once then succeeds → `createTree` called exactly 3× (not 4), retried call still carries `base_tree = tree-chunk-1` (chunk-1 not re-uploaded). 2. **Blob retry**: blob-2 fails 503 once → `createBlob` called 3× (blob-1 once), single `createTree` carries both resolved SHAs. ## Verification - `npm run build` (tsc), `npm run bundle` (ncc, `dist/` committed): ok - `npm test`: **82 passed** (3 suites) - Pre-commit suite green (devkit dev-shell) ## Reviewer note Overlaps **PR for #22** (payload-size chunking) on the same `createTree`/`createTreeChained` path — recommend merging this first, then rebasing #22 to re-thread `retry` through any new chunking helper. Refs: #24
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.
Syncs
devwithmain(sync-main-to-dev workflow).