Skip to content

feat(antd-java): sha256 on upload results and manifest entries (REST + gRPC) - #394

Merged
Nic-dorman merged 1 commit into
mainfrom
nic/v2-1724-sha256-java
Oct 23, 2026
Merged

Nic-dorman merged 1 commit into
mainfrom
nic/v2-1724-sha256-java

Conversation

@Nic-dorman

Copy link
Copy Markdown
Member

Part of the sha-fanout round (V2-1724): the SDK side of the sha256 fields antd 0.17.0 added in #347. Targets main; the daemon and antd-go are already released.

V2-1724. Carry the plaintext SHA-256 that antd 0.17.0 returns. DataPutResult,
DataPutPublicResult, FilePutResult, FilePutPublicResult and
FinalizeUploadResult (wave and merkle finalize) gain a sha256 component, and
ManifestEntryInfo reads it on build and decode. ManifestEntryInput gains an
optional sha256 and a withSha256 helper.

Optional values are null, never "": a missing REST key, a JSON null or an
empty string (gRPC's zero value) read as null on every result and on entry
info. On an entry input, null or "" is omitted on the wire: REST leaves the
key out, gRPC leaves the proto3 optional field unset. The value is passed
through as given (no hex, length or case handling); a bad one is the
daemon's 400 / INVALID_ARGUMENT, surfaced as BadRequestException with its
message.

Compatibility: sha256 is the last record component on all seven types, and
each keeps a constructor with its previous canonical shape (defaulting
sha256 to null), alongside the shorter ones that already existed, so existing
construction compiles. Equality and hashCode include the new component. Not
breaking. gRPC stubs are generated at build from antd/proto, nothing is
committed.

Tests: 18 new unit tests (Sha256RestTest for REST and the async client,
Sha256GrpcTest against in-process mock services); full suite 309 tests, 0
failures, 3 live tests skipped when unset. LiveSha256Test, gated on
ANTD_TEST_URL and ANTD_TEST_SHA_LINK (and ANTD_TEST_GRPC for gRPC), passes
against an antd v0.17.0 devnet over both transports: decode of the fixture
link, build with and without a hash, a bad hash as BadRequestException, and
one public upload per transport whose returned sha256 equals the locally
computed hash.

🤖 Generated with Claude Code

…+ gRPC)

V2-1724. Carry the plaintext SHA-256 that antd 0.17.0 returns. DataPutResult,
DataPutPublicResult, FilePutResult, FilePutPublicResult and
FinalizeUploadResult (wave and merkle finalize) gain a sha256 component, and
ManifestEntryInfo reads it on build and decode. ManifestEntryInput gains an
optional sha256 and a withSha256 helper.

Optional values are null, never "": a missing REST key, a JSON null or an
empty string (gRPC's zero value) read as null on every result and on entry
info. On an entry input, null or "" is omitted on the wire: REST leaves the
key out, gRPC leaves the proto3 optional field unset. The value is passed
through as given (no hex, length or case handling); a bad one is the
daemon's 400 / INVALID_ARGUMENT, surfaced as BadRequestException with its
message.

Compatibility: sha256 is the last record component on all seven types, and
each keeps a constructor with its previous canonical shape (defaulting
sha256 to null), alongside the shorter ones that already existed, so existing
construction compiles. Equality and hashCode include the new component. Not
breaking. gRPC stubs are generated at build from antd/proto, nothing is
committed.

Tests: 18 new unit tests (Sha256RestTest for REST and the async client,
Sha256GrpcTest against in-process mock services); full suite 309 tests, 0
failures, 3 live tests skipped when unset. LiveSha256Test, gated on
ANTD_TEST_URL and ANTD_TEST_SHA_LINK (and ANTD_TEST_GRPC for gRPC), passes
against an antd v0.17.0 devnet over both transports: decode of the fixture
link, build with and without a hash, a bad hash as BadRequestException, and
one public upload per transport whose returned sha256 equals the locally
computed hash.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@MaidSafe-Hermes MaidSafe-Hermes 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.

APPROVE — reviewed head 415e7ddeb94838cc28d2788ee1fafa55361313cc.

Coverage: 2/2 seats reviewed (sol-1 gpt-6.1-sol xhigh; glm-1 z-ai/glm-5.3). GLM raised a concern that mock tests' /tmp/x file might not exist. I checked the current AntdClient.filePut implementation: it sends the path to the daemon and does not open the file locally, so this is not a test blocker.

The added Java result constructors preserve prior overloads, REST/gRPC mappings normalize empty hashes, and manifest inputs omit unset values. The mock tests cover these cases. No checks are reported for this branch. The V2-1724 parent comment reports fanout verification and live devnet tests; they were not independently rerun here. This is a code-review approval only, not merge authorization.

@Nic-dorman
Nic-dorman marked this pull request as ready for review October 23, 2026 19:36
@Nic-dorman
Nic-dorman merged commit fb8102b into main Oct 23, 2026
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