Skip to content

Conversation

@joe-p
Copy link
Collaborator

@joe-p joe-p commented Dec 11, 2025

Leverages path_to_error to get better serde error messages

Example from an algod serialization error:

Before:

"Serialization error: string found to be invalid utf8: invalid utf-8 sequence of 1 bytes from index 0"

After:

"Serialization error: block.txns[10].dt.gd.current_miner.bs: string found to be invalid utf8: invalid utf-8 sequence of 1 bytes from index 0"

@joe-p joe-p requested a review from lempira as a code owner December 11, 2025 20:13
Copilot AI review requested due to automatic review settings December 11, 2025 20:13
Copy link
Contributor

Copilot AI left a 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 enhances error reporting across the Algorand SDK by integrating the serde_path_to_error library. When deserialization fails, error messages now include the full path to the problematic field (e.g., block.txns[10].dt.gd.current_miner.bs), making debugging significantly easier compared to generic error messages.

Key Changes:

  • Added serde_path_to_error dependency to all client crates and core libraries
  • Replaced direct serde_json::from_slice and rmp_serde::from_slice calls with serde_path_to_error::deserialize throughout the codebase
  • Updated code generation templates to emit the new deserialization pattern for future API changes
  • Added new error variant DecodingErrorWithPath in algokit_transact to preserve path information

Reviewed changes

Copilot reviewed 102 out of 103 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/algod_client/Cargo.toml Added serde_path_to_error dependency
crates/algod_client/src/apis/*.rs (66 files) Updated JSON and MessagePack deserialization to use serde_path_to_error
crates/kmd_client/Cargo.toml Added serde_path_to_error dependency
crates/kmd_client/src/apis/*.rs (23 files) Updated JSON deserialization to use serde_path_to_error
crates/indexer_client/Cargo.toml Added serde_path_to_error dependency
crates/indexer_client/src/apis/*.rs (24 files) Updated JSON deserialization to use serde_path_to_error
crates/algokit_transact/Cargo.toml Added serde_path_to_error dependency
crates/algokit_transact/src/error.rs Added DecodingErrorWithPath error variant with path information
crates/algokit_transact/src/transactions/mod.rs Updated MessagePack deserialization in SignedTransaction::decode
crates/algokit_transact/src/traits.rs Updated AlgorandMsgpack::decode to use serde_path_to_error
crates/algokit_abi/Cargo.toml Added serde_path_to_error dependency
crates/algokit_abi/src/arc56_contract.rs Updated JSON deserialization in Arc56Contract::from_json
api/oas_generator/rust_oas_generator/templates/base/Cargo.toml.j2 Updated template to include serde_path_to_error dependency
api/oas_generator/rust_oas_generator/templates/apis/endpoint.rs.j2 Updated template for JSON/MessagePack deserialization
api/oas_generator/rust_oas_generator/templates/apis/api.rs.j2 Updated template for JSON deserialization
Cargo.lock Added serde_path_to_error version 0.1.17 with dependencies

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

@joe-p joe-p force-pushed the feat/serde_path_to_err branch from f12513c to 7d43c51 Compare December 11, 2025 20:17
@joe-p joe-p marked this pull request as draft December 11, 2025 20:18
@joe-p joe-p marked this pull request as ready for review December 11, 2025 20:20
@joe-p joe-p force-pushed the feat/serde_path_to_err branch from 49fb5ab to b8b8ce2 Compare December 11, 2025 22:28
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