Skip to content

Conversation

Copy link

Copilot AI commented Jan 22, 2026

Applies all actionable feedback from PR #19 review thread #3690473082.

Code Quality

  • Naming: wantChunkswantParts, chunksparts (consistent with multipart upload terminology)
  • Cleanup: Removed commented-out code, unnecessary blank lines
  • Error formatting: >%q<%q (conventional Go error format)
  • Spelling: maximunmaximum, terrabytesterabytes

Test Coverage

Expanded TestOptimalChunkSize from 7 to 15 cases covering all thresholds and boundaries:

  • Zero/edge cases: 0 bytes, 1 MB
  • Boundary transitions: 100 MB±1B, 1 GB±1B, 10 GB±1B, 100 GB±1B
  • Scaled ranges: 5 GB, 500 GB
  • Fixed parts calculation for fileSize == 0

Observability

Added logging when git config fails:

func init() {
    v, err := GetLfsCustomTransferInt("lfs.customtransfer.drs.multipart-min-chunk-size", 10)
    if err != nil {
        log.Printf("Warning: Could not read git config for multipart-min-chunk-size, using default (10 MB): %v\n", err)
        MinChunkSize = int64(10) * MB
        return
    }
    MinChunkSize = int64(v) * MB
}

Documentation

Added algorithm description to NEW section matching OLD section structure:

  • Calculation logic for each file size range
  • Behavior summary (single PUT, fixed chunks, scaled ranges)
  • Examples with expected chunk sizes and part counts
  • Removed markdown escape artifacts (\--)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 22, 2026 21:33
Co-authored-by: bwalsh <47808+bwalsh@users.noreply.github.com>
Co-authored-by: bwalsh <47808+bwalsh@users.noreply.github.com>
Co-authored-by: bwalsh <47808+bwalsh@users.noreply.github.com>
Copilot AI changed the title [WIP] Update optimal chunk size calculation for uploads Address PR #19 review comments: naming, test coverage, and documentation Jan 22, 2026
Copilot AI requested a review from bwalsh January 22, 2026 21:36
@bwalsh bwalsh marked this pull request as ready for review January 22, 2026 21:43
Copilot AI review requested due to automatic review settings January 22, 2026 21:43
@bwalsh bwalsh merged commit b9174c3 into fix/increase-multipart-chunk-size Jan 22, 2026
@bwalsh bwalsh deleted the copilot/sub-pr-19 branch January 22, 2026 21:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies follow-up review feedback from PR #19, refining the OptimalChunkSize algorithm documentation, tightening test coverage and naming around multipart parts calculation, and improving observability and comments in common constants.

Changes:

  • Expanded and clarified the engineering note in docs/optimal-chunk-size.md to document the new OptimalChunkSize behavior, test strategy, and cleaned up markdown artifacts.
  • Strengthened TestOptimalChunkSize in client/upload/utils_test.go with additional boundary and scaled-range cases, renamed wantChunkswantParts, and fixed the parts calculation for zero-byte files.
  • Updated client/common/constants.go to fix spelling in comments, remove dead code, add logging when git config lookup fails, and normalize error message formatting.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
docs/optimal-chunk-size.md Documents the new OptimalChunkSize algorithm, its behavior across size ranges, and provides a concrete test plan and examples.
client/upload/utils_test.go Extends and renames the table-driven tests to validate chunk sizes and part counts across edge cases and scaled ranges, including the 0-byte behavior.
client/upload/utils.go Minor cleanup in OptimalChunkSize, keeping implementation aligned with the documented algorithm.
client/common/constants.go Corrects comment spelling, adds a warning log on git config read failure for multipart min chunk size, removes obsolete commented code, and standardizes error message formatting in GetLfsCustomTransferInt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +27
{
name: "0 bytes",
fileSize: 0,
wantChunkSize: 1 * common.MB,
wantParts: 0,
},
{
name: "1MB",
fileSize: 1 * common.MB,
wantChunkSize: 1 * common.MB,
wantParts: 1,
},
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test table exercises the 0-byte, exact-threshold, and +1 byte boundary cases, but it does not include the documented -1 byte boundaries or a negative fileSize, even though docs/optimal-chunk-size.md ("Test design notes" #3 and #4) explicitly calls for those cases. To fully match the documented test plan and guard against off-by-one or fallback regressions, consider adding subtests for fileSize < 0 and for each X - 1 byte threshold (e.g., 100 MB - 1 B, 1 GB - 1 B, etc.).

Copilot uses AI. Check for mistakes.
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.

2 participants