Skip to content

feat: add submit_message to AlephMessageClient for full message upload support#89

Merged
odesenfans merged 2 commits into
mainfrom
od/upload-non-inline-messages
Mar 18, 2026
Merged

feat: add submit_message to AlephMessageClient for full message upload support#89
odesenfans merged 2 commits into
mainfrom
od/upload-non-inline-messages

Conversation

@odesenfans
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

@foxpatch-aleph foxpatch-aleph left a comment

Choose a reason for hiding this comment

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

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
@odesenfans odesenfans force-pushed the od/upload-non-inline-messages branch from b977061 to b2164fd Compare March 18, 2026 08:43
@odesenfans odesenfans merged commit 3817467 into main Mar 18, 2026
9 checks passed
@odesenfans odesenfans deleted the od/upload-non-inline-messages branch March 18, 2026 09:23
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