upstream: [graphql] Port header map ordering fix and clever error codes (#10835) - #12643
Open
lollobene wants to merge 3 commits into
Open
Conversation
lollobene
marked this pull request as draft
August 12, 2026 08:33
lollobene
marked this pull request as ready for review
August 12, 2026 13:33
kodemartin
reviewed
Aug 13, 2026
valeriyr
approved these changes
Aug 13, 2026
Dkwcs
approved these changes
Aug 13, 2026
kodemartin
approved these changes
Aug 14, 2026
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.
Description of change
Ports two upstream GraphQL commits:
run-graphqltransactional tests through aBTreeMap, so the snapshot output is deterministically ordered.abortCodefield onTransactionBlockEffects.Upstream commits
e200e730a14d0bb044ac6b05c7294cd3685f6809fa4fe8341d5d4af735daebf8fe7984f257121df7Downstream adaptations
test_adapter.rsRunGraphqlCommandcrates/iota-indexer-alt-e2e-tests/tests/jsonrpc/test_framework/framework.snapiota-graphql-rpc/src/types/transaction_block_effects.rsIotaExecutionStatus::from_native_with_clever_errorincrates/iota-json-rpc-types/src/iota_transaction.rsformat!towrite!was not needed because the shared function does not return aResult.resolve_native_status_impl(resolver)in the newabortCoderesolverself.native().status()errorsresolver usesExecutionFailureStatus::MoveAbort(loc, code)ExecutionFailureStatus::MoveAbort { location, code }+ModuleId::new(...)ExecutionErrorshape, which keeps package and module separatetests/stable/errors/clever_errors.move,tests/stable/call/simple.snaptests/errors/…,tests/call/…stable/test directorystaging.graphql,snapshot_tests__staging.graphql.snapsnapshot_tests__schema.graphql.snapsnapshot_tests__schema_sdl_export.snapSnapshots and
schema.graphqlwere regenerated locally (they are filtered out of the upstream patches).Notes for the reviewer
One commit per upstream patch; both were applied with
git applyfirst and every deviation is listed in the table above.e200e730— header map orderingtest_adapter.rs:run-graphql --show-headersprintedhttp::HeaderMap'sDebug, whose order follows the map's internal hash table and is therefore not stable across runs. It now collects into aBTreeMap<String, HeaderValue>, so the output is sorted by header name.tests/call/simple.snap: the only change is the five header lines being reordered alphabetically, values untouched.fa4fe834— error code in clever errorsiota-package-resolver:CleverErrorgainserror_code: Option<u8>, taken fromErrorBitset::error_code()(already available downstream). It isNonefor#[error]constants that declare no code.iota-json-rpc-types: the downstream home of the message rendering that upstream changed inline in the GraphQL resolver. Two behaviour changes: the abort gets a(code = N)suffix when the constant declares a code, and the ordinal suffix no longer yields11st/12nd/13rd. The existingformat!composition was kept rather than upstream'swrite!rewrite (which upstream needed only for?onfmt::Error); the resulting strings are identical to upstream's, checked literal by literal.iota-graphql-rpc: the newabortCodefield, falling back to the raw abort code when the abort is not a clever error — sonormalAbortreports0, as upstream.clever_errors.move/.snap: two new tasks (callStringWithCodefor#[error(code=1)],callNoCodeOrConstfor a bareabort) plusabortCodein both queries. The large snapshot churn follows from those two tasks: task numbers, source line numbers, published package IDs and gas costs all shift, because clever-error abort codes encode the source line number and the module bytes changed.Worth a closer look:
(code = N)therefore also appears in JSON-RPC and indexer responses, not only in GraphQL as upstream. The CLI is unaffected — itsclever_errorsfixture declares no coded constants andcli_tests__clever_errors.snapis unchanged.clever_errors.snap: that the only semantic additions are the two new tasks, theabortCodevalues, and theabort(code = 1)message forcallStringWithCode.Links to any relevant issues
Closes #10835
How the change has been tested
Basic tests (linting, compilation, formatting, unit/integration tests)
Patch-specific tests (correctness, functionality coverage)
I have added tests that prove my fix is effective or that my feature works
I have checked that new and existing unit tests pass locally with my changes
cargo check --workspace --all-targets,cargo ci-clippy,cargo ci-license,cargo machete,cargo +nightly fmt --allcargo nextest run -p iota-package-resolver -p iota-json-rpc-types -p iota-graphql-rpccargo test -p iota-graphql-e2e-tests --features pg_integrationagainst a local Postgres, including the regeneratederrors/clever_errors.snapandcall/simple.snapcargo test -p iota-graphql-rpc --test snapshot_tests(regeneratedschema.graphqland its snapshot)Release Notes
11st/12nd/13rd.11st/12nd/13rd.TransactionBlockEffects.abortCode; clever error messages now include the error code of the abort, if the abort constant declares one, and the command ordinal no longer renders as11st/12nd/13rd.