fix: clarify copy fast-path contracts#25
Merged
Merged
Conversation
Signed-off-by: Robin He <git@hybscloud.com>
Signed-off-by: Robin He <git@hybscloud.com>
Signed-off-by: Robin He <git@hybscloud.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates iox’s Copy-family documentation and benchmarks to more precisely describe (and measure) behavior around the io.WriterTo / io.ReaderFrom fast paths, and adds explicit go test timeouts in local/CI automation.
Changes:
- Clarifies fast-path contract boundaries in GoDocs and READMEs (fast path owns advancement, partial-write recovery, and semantic error preservation).
- Fixes “slow-path” benchmarks to actually exercise the generic read/write loop (by using a Reader-only source).
- Adds
-timeout 120stogo testinvocations in CI and Makefile targets.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
io.go |
Expands Copy/CopyPolicy docs to spell out fast-path ownership; updates buffer wording to “internal fixed-size buffer”. |
doc.go |
Refines package-level semantics docs to make fast-path responsibilities explicit. |
bench_test.go |
Adds a Reader-only benchmark source and switches slow-path benchmarks to avoid WriterTo fast path. |
README.md |
Aligns English README fast-path and buffer wording with implementation/contract. |
README.zh-CN.md |
Mirrors README fast-path/buffer clarifications in zh-CN translation. |
README.ja.md |
Mirrors README fast-path/buffer clarifications in Japanese translation. |
README.fr.md |
Mirrors README fast-path/buffer clarifications in French translation. |
README.es.md |
Mirrors README fast-path/buffer clarifications in Spanish translation. |
Makefile |
Adds -timeout 120s to go test targets (tests and benchmarks). |
.github/workflows/ci.yml |
Adds -timeout 120s to CI test command and normalizes formatting. |
Signed-off-by: Robin He <git@hybscloud.com>
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
This PR aligns the
ioxcopy contract docs, fallback benchmarks, and validation timeouts with the implementation. It keeps invalidWritercounts as a caller-owned contract violation instead of adding repeated hot-loop validation branches.Changes
CopyandCopyPolicyfast-path boundaries:WriterToandReaderFromimplementations own source advancement, partial-write recovery, semantic error preservation, and progress accounting.WriterToand actually exercise the generic read/write loop.