feat: add submit_message to AlephMessageClient for full message upload support#89
Merged
Merged
Conversation
foxpatch-aleph
left a comment
There was a problem hiding this comment.
Now I have reviewed all the key changes in the PR. Let me provide my assessment:
{
"verdict": "APPROVE",
"summary": "This PR adds a well-designed `submit_message` default method that transparently handles content uploads for non-inline messages. The implementation correctly handles all three item types (Inline, Storage, IPFS), includes proper hash verification with a new `HashMismatch` error variant, and uses a raw reqwest client for multipart uploads (which are non-cloneable and incompatible with retry middleware). The tests are comprehensive: unit tests with a mock client cover all code paths including the hash mismatch error case, and integration tests verify both inline and storage-routed messages work end-to-end. The CLI update to use `submit_message` is appropriate. The code is clean, well-documented, and follows existing patterns.",
"comments": [
{
"path": "crates/aleph-sdk/src/client.rs",
"line": 764,
"body": "Minor nit: The `upload_to_storage` call passes `message.item_content.as_bytes()` but the storage upload function takes `&[u8]`. This is fine, but you might consider being explicit about the type conversion with `.as_bytes()` since `item_content` is a `String`. (This is already done, just noting it's correct.)"
},
{
"path": "crates/aleph-sdk/src/client.rs",
"line": 1428,
"body": "The error conversion `StorageError::UploadFailed(reqwest_middleware::Error::from(e))` is clever - it wraps the raw reqwest error in the middleware error type to maintain type consistency. This is a good pattern."
},
{
"path": "crates/heph/tests/integration.rs",
"line":
</parameter>
</function>
</tool_call>…d support Add a submit_message default method on AlephMessageClient that transparently uploads content to storage/IPFS before posting, based on the message's item_type. Callers no longer need to manually handle the upload step for non-inline messages. - Add HashMismatch variant to MessageError for upload integrity checks - Add submit_message with where Self: AlephStorageClient bound - Update CLI to use submit_message instead of post_message - Fix multipart uploads: use raw reqwest client (not retry middleware) since multipart bodies are not cloneable - Integration tests for inline and storage-routed messages via heph
b977061 to
b2164fd
Compare
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.
Add a submit_message default method on AlephMessageClient that transparently uploads content to storage/IPFS before posting, based on the message's item_type. Callers no longer need to manually handle the upload step for non-inline messages.