Skip to content

Close the client load path: App Router, typed clients, and e2e seams - #24

Merged
cursor[bot] merged 4 commits into
mainfrom
cursor/frontend-contract-stitch-93f2
Aug 16, 2026
Merged

cursor[bot] merged 4 commits into
mainfrom
cursor/frontend-contract-stitch-93f2

Conversation

@Modsofthenation

@Modsofthenation Modsofthenation commented Aug 16, 2026 •

Copy link
Copy Markdown
Owner

Walks stay the product. This pack closes the published-contract stitch on the client side so a Django change can reach Next.js pages, typed API clients, and Playwright/Cypress visits instead of stopping at inferred fetch + Zod overlap.

Rebased onto current main (review history, graph overlays, editor marks). Adversarial review findings that would have shipped false high-confidence stitches are fixed in this revision.

What changed

  1. Next.js App Router as pages and sinks — app/**/page.tsx (and layout) plus Pages Router map to URL templates. app/**/route.ts is an API handler, not a page. "use server" exports (function and const arrows) become react.server_action sinks.
  2. High-confidence typed clients — RTK Query createApi endpoints (URL, not HTTP method literals), openapi-fetch createClient/GET, ts-rest method+path contracts, and trpc.* procedures stitch as consumed_by_client. Generic api.POST / React Router path: / api.*.useQuery are not typed clients.
  3. E2E as tested_by — Playwright page.goto / page.request and Cypress cy.visit / cy.request attach to React routes and pages. Path matching allows an /api mount prefix only — not /internal/... or collection↔detail.
  4. GraphQL and Ninja/Pydantic as the serializer contract family — graphql-codegen (generated paths / TypedDocumentNode, not bare __typename) and Ninja Schema / ModelSchema resolved through imports.
  5. Django residuals — get_serializer_class links returned serializers only (dead dicts stay residual). Nested serializers, SerializerMethodField, and to_representation dict keys become published fields.
  6. 2D layout algorithms — toolbar dropdown (architecture layers, edge flow, radial, compact grid). Choice persists in localStorage (try/catch). Flow ranks cap on cycles. Radial/grid pick N/E/S/W handles.

Tests

  • Unit: App Router + Server Action, RTK method-literal rejection, openapi-fetch/ts-rest/tRPC over-match guards, route handlers, Ninja vs marshmallow Schema, unresolved get_serializer_class, path-match mounts
  • Index stitch: typed clients, e2e tested_by, no /internal/invoices false links
  • UI vitest: layout algorithms, cycle cap, radial bezier + handles
  • Playwright: layout dropdown moves InvoicePage and hides in 3D
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Added selectable, persistent graph layouts: layers, flow, radial, and grid.
    • Added visibility and classification for Next.js pages, server actions, typed API clients, GraphQL, and end-to-end tests.
    • Improved Django API analysis for nested serializers, Ninja schemas, Pydantic models, and resolved serializer behavior.
    • Added stronger stitching between backend contracts, frontend clients, routes, and tests.
  • Documentation

    • Expanded extraction and client-stitching documentation with supported frameworks and patterns.
  • Tests

    • Added coverage for graph layouts, framework detection, API stitching, and end-to-end route relationships.

Index Next.js app/pages routes and Server Actions as sinks, stitch RTK
Query, openapi-fetch, tRPC, and ts-rest as high-confidence clients, and
count Playwright/Cypress visits as tested_by on the published route.

Treat GraphQL codegen types and Ninja/Pydantic nested schemas as the
same contract family as DRF serializers. Resolve get_serializer_class
returns and extract nested serializers, SerializerMethodField, and
to_representation keys so those stop dumping to residual AI.

Co-authored-by: zord.lack.net <zord.lack.net@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 7b1102d4-1fb3-441a-a274-ac4a9247354e

📥 Commits

Reviewing files that changed from the base of the PR and between 2f0e2ae and b3caaff.

⛔ Files ignored due to path filters (1)
  • fixtures/demo_monorepo/frontend/src/generated/graphql.ts is excluded by !**/generated/**
📒 Files selected for processing (42)
  • README.md
  • fixtures/demo_monorepo/backend/billing/api.py
  • fixtures/demo_monorepo/backend/billing/serializers.py
  • fixtures/demo_monorepo/backend/billing/views.py
  • fixtures/demo_monorepo/frontend/e2e/invoice.spec.ts
  • fixtures/demo_monorepo/frontend/src/app/invoices/[id]/actions.ts
  • fixtures/demo_monorepo/frontend/src/app/invoices/[id]/page.tsx
  • fixtures/demo_monorepo/frontend/src/features/billing/invoice.graphql
  • fixtures/demo_monorepo/frontend/src/features/billing/invoiceApi.ts
  • fixtures/demo_monorepo/frontend/src/features/billing/openapiFetch.ts
  • fixtures/demo_monorepo/frontend/src/features/billing/trpc.ts
  • fixtures/demo_monorepo/loadpath.yml
  • src/loadpath/architecture/snapshot.py
  • src/loadpath/config.py
  • src/loadpath/detect.py
  • src/loadpath/extractors/django.py
  • src/loadpath/extractors/react.py
  • src/loadpath/index.py
  • src/loadpath/review/cluster.py
  • src/loadpath/review/engine.py
  • src/loadpath/review/suggested_tests.py
  • src/loadpath/static/assets/LayeredGraph3D-Ch8n5xd0.js
  • src/loadpath/static/assets/index-BuTg-qls.js
  • src/loadpath/static/assets/index-CdW5Vb1S.css
  • src/loadpath/static/assets/index-cvBsmXkd.js
  • src/loadpath/static/index.html
  • src/loadpath/stitch/openapi.py
  • src/loadpath/types.py
  • tests/e2e/conftest.py
  • tests/e2e/test_ui_flows.py
  • tests/unit/test_depth.py
  • tests/unit/test_django_extractors.py
  • tests/unit/test_index_and_stitch.py
  • tests/unit/test_overlays.py
  • tests/unit/test_react_extractors.py
  • ui/src/ImpactGraph.test.ts
  • ui/src/ImpactGraph.tsx
  • ui/src/graphView.test.ts
  • ui/src/graphView.ts
  • ui/src/nodeInspector.ts
  • ui/src/styles.css
  • ui/src/types.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change expands Django and React extraction, schema and route stitching, server-action modeling, GraphQL indexing, and graph visualization. It adds fixture coverage, review suggestions, UI layout controls, tests, and updated packaged assets.

Changes

Django and React extraction

Layer / File(s) Summary
Django serializers and response schemas
src/loadpath/extractors/django.py, fixtures/demo_monorepo/backend/billing/..., tests/unit/test_django_extractors.py, tests/unit/test_overlays.py
Extraction now records nested serializers, representation fields, resolved serializer classes, Ninja schemas, Pydantic fields, GraphQL fields, and response schemas.
Next.js, typed clients, and GraphQL extraction
src/loadpath/extractors/react.py, fixtures/demo_monorepo/frontend/..., src/loadpath/index.py, tests/unit/test_react_extractors.py
React extraction now models Next.js routes, server actions, typed clients, GraphQL documents and generated schemas, and E2E visits.
Schema and route stitching
src/loadpath/stitch/openapi.py, src/loadpath/review/..., src/loadpath/types.py, tests/unit/test_index_and_stitch.py, tests/unit/test_depth.py
Stitching now matches typed schemas, GraphQL codegen, E2E visits, and tRPC clients with parameter-aware route matching.

Graph layout and interface

Layer / File(s) Summary
Graph layout algorithms and persistence
ui/src/graphView.ts, ui/src/types.ts
The graph view adds layers, flow, radial, and grid layouts with validated localStorage persistence.
Layout-aware rendering and inspection
ui/src/ImpactGraph.tsx, ui/src/nodeInspector.ts, ui/src/styles.css
Graph elements use layout-aware positions and handles. The toolbar exposes a 2D layout selector and node inspection displays new metadata.
Validation and packaged assets
ui/src/*.test.ts, tests/e2e/..., src/loadpath/static/...
Tests cover layouts, persistence, handles, and 2D/3D controls. Packaged assets and entrypoint references were updated.

Estimated code review effort: 5 (Critical) | ~120 minutes

Merge Risk: ⚪ Minimal · up to b3caa

This change expands client-side contract and graph stitching behavior without any supplied evidence of an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant SourceFile
  participant extract_react_file
  participant stitch
  participant GraphUI
  SourceFile->>extract_react_file: provide route, client, schema, or test source
  extract_react_file->>stitch: emit nodes and relationship metadata
  stitch->>GraphUI: provide stitched graph data
  GraphUI->>GraphUI: apply selected layout and render handles
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

cursoragent and others added 3 commits August 16, 2026 02:32
The map toolbar now has a layout dropdown (architecture layers, edge
flow, radial, compact grid) that persists in localStorage.

Co-authored-by: zord.lack.net <zord.lack.net@gmail.com>
Co-authored-by: zord.lack.net <zord.lack.net@gmail.com>
Bring in the review-experience UI, then keep the layout dropdown
on top of it. Typed clients no longer over-match HTTP methods,
React Router paths, or internal URLs; flow layout caps cycles;
localStorage matches the theme helpers.

Co-authored-by: zord.lack.net <zord.lack.net@gmail.com>
@Modsofthenation
Modsofthenation marked this pull request as ready for review August 16, 2026 03:18
@cursor
cursor Bot merged commit 853109f into main Aug 16, 2026
2 checks passed
@cursor
cursor Bot deleted the cursor/frontend-contract-stitch-93f2 branch August 16, 2026 03:25
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.

2 participants