Skip to content

Conversation

@tpham-mysten
Copy link
Contributor

@tpham-mysten tpham-mysten commented Dec 18, 2025

Description

Add partial error support for GraphQL resolvers in sui-indexer-alt-graphql by changing return types from Result<Option, E> to Option<Result<T, E>> for Transaction-related types.

Test plan

How did you test the new or updated feature?

cargo nextest run -p sui-indexer-alt-e2e-tests

Stack:

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally
  • CLI:
  • Rust SDK:
  • Indexing Framework:

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
multisig-toolkit Ignored Ignored Dec 18, 2025 5:40am
sui-kiosk Ignored Ignored Dec 18, 2025 5:40am

Copy link
Contributor

@amnn amnn left a comment

Choose a reason for hiding this comment

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

Seeing this makes me want to suggest adopting an even more standard pattern for these functions, namely to leave the bodies basically unchanged, and wrap them in one of these two patterns:

// Body doesn't produce optional values.
async {
  // ...
}
.await
.map(Some)
.transpose()

// Body could produce `None`
async {
  // ...
}
.await
.transpose()

You could even consider creating some! { ... } and transposed! { ... } macros for these, but I'm a bit on the fence about whether those would be actually useful.

})
.map(Some)
) -> Option<Result<Connection<String, ActiveJwk>, RpcError>> {
let new_active_jwks = async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just inline the async block inside the Some as well?, e.g.

Some(async {
    // ...
}.await)

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.

3 participants