Skip to content

fix(demo): revive graphql demo for grouped layout + add to CI - #305

Merged
allmonday merged 1 commit into
masterfrom
fix/demo-graphql-v6
Aug 1, 2026
Merged

fix(demo): revive graphql demo for grouped layout + add to CI#305
allmonday merged 1 commit into
masterfrom
fix/demo-graphql-v6

Conversation

@allmonday

Copy link
Copy Markdown
Collaborator

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, and test_demo.py couldn't even be collected (FastAPI on_event deprecation, fatal under filterwarnings = error).

What changed

  • Grouped queries everywhere: test_demo, test_mutations, test_entities_v2, test_entities_v3, mcp_server_with_context, START.md, test_queries.sh, README.md{ Entity { method {} } } with nested data[Entity][method] response keys.
  • Pre-existing demo bugs fixed (uncovered while converting):
    • created_at was a required field but the create_* mutations never set it → default_factory=datetime.now (entities.py, entities_v2.py).
    • Enum assertions expected the Python value ('published'); GraphQL correctly emits the member name ('PUBLISHED') → assertions updated.
    • UserEntityV2 relationship count 1 → 2 (myposts + the self_id scalar demo).
    • test_demo.py's broken from app import BaseEntity + missing init_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).
  • CI: demo/** added to the path trigger and uv run pytest tests/ demo/ so the demo can't silently rot again.

Verification

  • demo/graphql/: 75 passed
  • tests/ + demo/ (the CI command): 901 passed, 1 skipped
  • ruff check demo/graphql/: clean

Demo-only changes — no library code, no version bump.

🤖 Generated with Claude Code

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>
@allmonday
allmonday merged commit b5c820e into master Aug 1, 2026
1 check passed
@allmonday
allmonday deleted the fix/demo-graphql-v6 branch August 1, 2026 10:36
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.

1 participant