-
Notifications
You must be signed in to change notification settings - Fork 787
[V6] Add some report-status and send-pack tests #1536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v6-transport
Are you sure you want to change the base?
[V6] Add some report-status and send-pack tests #1536
Conversation
There was a problem hiding this 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 adds new tests for the report-status feature in the SendPack routine and improves error messaging in pktline parsing while introducing typed errors for report-status failures.
- Added tests for buildUpdateRequests covering various capability combinations.
- Introduced UnpackStatusErr and CommandStatusErr types for more informative error messages.
- Updated error messages in pktline write/read functions and hex length parsing for clarity.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
plumbing/transport/build_update_requests_test.go | New test cases to validate capabilities for report-status, progress, atomic, and agent. |
plumbing/protocol/packp/sideband/demux.go | Added check for empty pktline content with an explicit error. |
plumbing/protocol/packp/report_status_test.go | Extended tests to cover failed command status errors and unpack with failed commands. |
plumbing/protocol/packp/report_status.go | Refactored error message generation using new error types for unpack/command status errors. |
plumbing/format/pktline/pktline.go | Updated Writef and Read functions to leverage new fmt.Appendf syntax and improved error text. |
plumbing/format/pktline/length.go | Changed error messages for hex decoding related to pktline length. |
plumbing/format/pktline/common.go | Minimal change in import structure. |
internal/transport/test/receive_pack.go | Removed outdated test assertions tied to report-status in the SendPack tests. |
if err == io.ErrUnexpectedEOF { | ||
return Err, ErrInvalidPktLen | ||
if errors.Is(err, io.ErrUnexpectedEOF) { | ||
return Err, fmt.Errorf("%w: short pkt-line %q", ErrInvalidPktLen, len(p[:LenSize])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of %q to format an integer (the length) may be confusing. Consider using a format specifier appropriate for integers (e.g., %d or %04x) to improve clarity in the error message.
return Err, fmt.Errorf("%w: short pkt-line %q", ErrInvalidPktLen, len(p[:LenSize])) | |
return Err, fmt.Errorf("%w: short pkt-line %d", ErrInvalidPktLen, len(p[:LenSize])) |
Copilot uses AI. Check for mistakes.
This adds a new few tests for
report-status
during theSendPack
routine. It also adds more informativepktline
error messages, and typedreport-status
errors.