Skip to content

dev/aratiu/sha256 transport fixtures#2656

Merged
Sebastian Thiel (Byron) merged 5 commits into
mainfrom
dev/aratiu/sha256-transport-fixtures
Jun 20, 2026
Merged

dev/aratiu/sha256 transport fixtures#2656
Sebastian Thiel (Byron) merged 5 commits into
mainfrom
dev/aratiu/sha256-transport-fixtures

Conversation

@Byron

Copy link
Copy Markdown
Member

This is PR #2647 with one commit added on top.
No revwrites, but can't push back there.

Adrian Ratiu (10ne1) and others added 4 commits June 16, 2026 20:24
Add a sha256 analog of the existing `from_bytes` capability test,
asserting that gix-transport's capability parser reads a server
`object-format=sha256` advertisement as sha256:

supports("sha256") is true, and supports("sha1") is false for this
capability, the negative control mirroring the existing sha1 test.

No production change is needed: the parser is generic over the
advertised value, so this just verifies the transport layer passes
sha256 through.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Adrian Ratiu <[email protected]>
Add a daemon-transport handshake test backed by a minimal v2
fixture that advertises `object-format=sha256`.

It asserts the handshake reports protocol v2, defers refs to a
later ls-refs trip and surfaces the sha256 object-format capability.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Adrian Ratiu <[email protected]>
Add an http handshake test backed by `v2/http-handshake-sha256.response`
(modeled on the existing sha1 `v2/http-handshake.response`, with an
`object-format=sha256` capability and Content-Length adjusted to match).

It asserts the handshake reports protocol v2, returns no refs (deferred
to ls-refs) and surfaces the sha256 object-format.

Verified on both the reqwest and curl http backends.

No production change is required: the http transport relays the server
sha256 negotiation untouched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Adrian Ratiu <[email protected]>
The .response and .request fixtures are byte-exact protocol captures:
CRLF HTTP headers, pkt-line length prefixes and a Content-Length that
must match the body.

Git line-ending conversion (e.g. core.autocrlf) could rewrite them on
checkout, making the byte-exact tests platform dependent or fail
unexpectedly, so mark the whole fixtures directory "-text" so the
on-disk bytes stay stable across environments, matching the existing
gix-protocol/tests/fixtures policy.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Adrian Ratiu <[email protected]>
Copilot AI review requested due to automatic review settings June 20, 2026 03:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds SHA-256 object-format negotiation fixtures and tests to ensure gix-transport surfaces the server-advertised object-format=sha256 capability during protocol v2 handshakes (both daemon/TCP-style and HTTP).

Changes:

  • Add pkt-line and HTTP handshake fixtures that advertise object-format=sha256.
  • Add client tests verifying the V2 handshake returns object-format=sha256 in parsed capabilities.
  • Add a .gitattributes rule to prevent line-ending conversions in byte-exact protocol fixtures.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
gix-transport/tests/fixtures/v2/http-handshake-sha256.response New HTTP handshake fixture including object-format=sha256.
gix-transport/tests/fixtures/v2/handshake-sha256.response New V2 handshake pkt-line fixture including object-format=sha256.
gix-transport/tests/fixtures/.gitattributes Ensures fixtures remain byte-exact by disabling text conversions.
gix-transport/tests/client/git.rs Adds a V2 handshake test asserting object-format=sha256 is surfaced.
gix-transport/tests/client/capabilities.rs Adds a unit test validating parsing/support checks for object-format=sha256.
gix-transport/tests/client/blocking_io/http/mod.rs Adds an HTTP handshake test asserting object-format=sha256 is surfaced.

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

While it's more correct to test for `values()` of a capability, I found
it much more complex to read so reverted this to only look at `value()`.
Once options with multiple values are under test, we can of course test for that,
assuming that no bug is introduced that would somehow add values on its own.

Co-authored-by: Sebastian Thiel <[email protected]>
@Byron
Sebastian Thiel (Byron) force-pushed the dev/aratiu/sha256-transport-fixtures branch from c1f90c2 to d056a3f Compare June 20, 2026 03:16
@Byron
Sebastian Thiel (Byron) merged commit 1ad9639 into main Jun 20, 2026
32 checks passed
@Byron
Sebastian Thiel (Byron) deleted the dev/aratiu/sha256-transport-fixtures branch June 20, 2026 05:29
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.

4 participants