fix(graphql): dedupe models across worlds when building schema - #434
Open
djizus wants to merge 1 commit into
Open
fix(graphql): dedupe models across worlds when building schema#434djizus wants to merge 1 commit into
djizus wants to merge 1 commit into
Conversation
When torii indexes multiple worlds that register the same
(namespace, name) model — e.g. several instances of one game deployed
from the same code — build_objects() derived duplicate GraphQL field
names and async-graphql panicked ("Field `...` already exists"),
killing the whole process, indexer included. Keep the first occurrence
of each model; world-scoped access remains available via SQL and gRPC,
and single-world deployments are unaffected.
Fixes dojoengine#433
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Fixes #433.
When torii indexes multiple worlds that register the same
(namespace, name)model — e.g. several instances of one game deployed from the same code —build_objects()derives duplicate GraphQL field names and async-graphql panics (Field...already exists), killing the whole process, indexer included.This dedupes models by
(namespace, name)when building the schema. World-scoped access remains available via SQL and gRPC; single-world deployments are unaffected (the dedupe is a no-op there).Test
Adds a regression test that registers the same model under two world addresses and asserts the schema builds with the model field present.
panicked at async-graphql-7.0.11/src/dynamic/object.rs:82:9: FieldmultiworldTestDuplicateModelsalready existstest result: ok. 1 passedReproduced originally on torii v1.8.16 + katana v1.8.0-rc.9 with two
sozo migrateruns of the same project under different seeds and one torii indexing both worlds. We run this patch in production.🤖 Generated with Claude Code