fix(demo): revive graphql demo for grouped layout + add to CI - #305
Merged
Conversation
The demo hadn't tracked the GraphQL query API for several versions — tests
used bare/flat names matching neither the old nor the new schema, and
collection failed on a FastAPI on_event deprecation. Updated for the v6
grouped layout:
- Convert all demo queries to grouped { Entity { method {} } } with nested
response keys (test_demo, test_mutations, test_entities_v2/v3,
mcp_server_with_context, START.md, test_queries.sh, README.md)
- Fix pre-existing demo bugs found along the way:
- created_at was required but the create_* mutations never set it -> default_factory
- enum assertions expected the Python value; GraphQL emits the member name
- UserEntityV2 relationship count (1 -> 2: myposts + self_id)
- test_demo's broken `from app import BaseEntity` + missing init_db_v3
- Migrate app.py from @app.on_event("startup") to lifespan (the deprecation
is fatal under filterwarnings = error)
- Run demo/ in CI so it can't silently rot again
All 75 demo tests pass; tests/ + demo/ together = 901 passed. Demo-only
changes, no library code or version bump.
Co-Authored-By: Claude <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.
Follow-up to #304 (v6 grouped layout). The
demo/graphql/suite had drifted across several versions — tests used bare/flat query names that matched neither the old nor the new schema, andtest_demo.pycouldn't even be collected (FastAPIon_eventdeprecation, fatal underfilterwarnings = error).What changed
test_demo,test_mutations,test_entities_v2,test_entities_v3,mcp_server_with_context,START.md,test_queries.sh,README.md→{ Entity { method {} } }with nesteddata[Entity][method]response keys.created_atwas a required field but thecreate_*mutations never set it →default_factory=datetime.now(entities.py, entities_v2.py).'published'); GraphQL correctly emits the member name ('PUBLISHED') → assertions updated.UserEntityV2relationship count1 → 2(myposts+ theself_idscalar demo).test_demo.py's brokenfrom app import BaseEntity+ missinginit_db_v3(); rewritten as a real pytest smoke test.app.py:@app.on_event("startup")→lifespan(so the demo server imports/runs on modern FastAPI).demo/**added to the path trigger anduv run pytest tests/ demo/so the demo can't silently rot again.Verification
demo/graphql/: 75 passedtests/ + demo/(the CI command): 901 passed, 1 skippedruff check demo/graphql/: cleanDemo-only changes — no library code, no version bump.
🤖 Generated with Claude Code