Skip to content

Generate connection and edge types for StreamPageConnection - #21

Merged
michaelstaib merged 11 commits into
mst/stream-v2from
mst/analyzers-streampage-connection
Oct 10, 2026
Merged

michaelstaib merged 11 commits into
mst/stream-v2from
mst/analyzers-streampage-connection

Conversation

@michaelstaib

@michaelstaib michaelstaib commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

The source generator only knew connections derived from ConnectionBase with list edges, so a resolver returning StreamPageConnection got no connection or edge types. The existing connection pipeline now also recognizes StreamPageConnection for direct, Task and ValueTask returns, derived connections and referenced assemblies. It binds GetEdgesAsync, GetNodesAsync and GetTotalCountAsync as async resolvers that receive the request cancellation token, and keeps PagingArguments, QueryContext and ConnectionFlags generation the same as for PageConnection.

Page info follows the unified runtime type from #20: the special case that mapped StreamPageConnection to a separate StreamPageInfo type is gone. Generated connection types reference the abstract PageInfo, the runtime infers the one PageInfo type from it, and the generator emits no page info type of its own. An executed schema test now holds a classic [UsePaging] field, a generated PageConnection field and a generated StreamPageConnection field in one schema with relative cursors enabled: it shows exactly one PageInfo type with six fields and resolves all six on all three. Without relative cursors the same schema has one four-field PageInfo, and selecting a cursor field fails validation. Edges and nodes of a StreamPageConnection are nullable lists, like PageConnection, and GetNodesAsync is virtual so a derived connection can override it.

A second executed schema test enables cost analysis and cache control and shows that the shared PageInfo fields carry neither @cost nor @cacheControl on generated and classic connections; the opt-out flag from #20 reaches them through the inferred type, so the generator needs no extra code for it.

One thing to watch for in review: the StreamPageConnection part of the executed test runs over an empty stream page, because only a database provider can produce a non-empty one.

Stacked on #20.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@michaelstaib
michaelstaib added this pull request to stack #22 October 4, 2026 19:56
@michaelstaib
michaelstaib force-pushed the mst/analyzers-streampage-connection branch 7 times, most recently from b850063 to 7c1441f Compare October 10, 2026 01:36
Base automatically changed from mst/pagination-streampage-connection to mst/stream-v2 October 10, 2026 02:17
@michaelstaib
michaelstaib force-pushed the mst/analyzers-streampage-connection branch from 7c1441f to 41cb1e0 Compare October 10, 2026 02:17
@michaelstaib
michaelstaib merged commit 9216664 into mst/stream-v2 Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants