Skip to content

fix: refuse type parameters a resource reaches through a proto record - #304

Closed
moetemp wants to merge 1 commit into
moe/up/flattened-setup-indentfrom
moe/up/resource-type-params-through-protos
Closed

moetemp wants to merge 1 commit into
moe/up/flattened-setup-indentfrom
moe/up/resource-type-params-through-protos

Conversation

@moetemp

@moetemp moetemp commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

This PR refuses a resource that reaches a type parameter through a proto-backed record, as nexgen refuses one that reaches it through a plain record. The check of each operation that a resource method binds walks through protos too. Planning and the generated code don't change.

It's based on #303.

Why?

nexgen generated generic models for a resource class that isn't generic, so the code didn't compile or type-check. For example, with Brook's Stream WIT, the Python resource methods took AppendRecord[EventT] with no EventT in scope.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

The new rejection fixtures type-parameters/generic-proto-resource and type-parameters/generic-proto-resource-operation fail without the fix.

@moetemp
moetemp requested a review from a team as a code owner October 27, 2026 04:37
@moetemp
moetemp marked this pull request as draft October 27, 2026 07:48
@moetemp
moetemp force-pushed the moe/up/resource-type-params-through-protos branch from 4545d1f to be2ac92 Compare October 28, 2026 16:37
This was referenced Oct 28, 2026
@moetemp
moetemp changed the base branch from main to moe/up/flattened-setup-indent October 28, 2026 22:57
@moetemp
moetemp force-pushed the moe/up/flattened-setup-indent branch from 026f1d0 to 2b18cce Compare October 29, 2026 04:00
@moetemp
moetemp force-pushed the moe/up/resource-type-params-through-protos branch 2 times, most recently from 2acc4e9 to fb0aedf Compare October 29, 2026 06:28
@moetemp
moetemp force-pushed the moe/up/flattened-setup-indent branch from 2b18cce to bca32e1 Compare October 29, 2026 06:28
@moetemp
moetemp force-pushed the moe/up/resource-type-params-through-protos branch from fb0aedf to cc6f8ba Compare October 29, 2026 07:00
Before planning, a proto-backed record is named by its proto type, so the walk for a resource's
type parameters stopped there. nexgen then wrote generic models for a resource class that isn't
generic, and the code didn't compile. The checks of the resource and of the operations that its
methods bind both walk through protos.
@moetemp
moetemp force-pushed the moe/up/resource-type-params-through-protos branch from cc6f8ba to e7f9b2e Compare October 29, 2026 07:35
@moetemp
moetemp force-pushed the moe/up/flattened-setup-indent branch from 1967f3a to cf1a028 Compare October 29, 2026 07:35
@moetemp

moetemp commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Closing this. moetemp#78 takes the check, where the stream sample needs it.

@moetemp moetemp closed this Oct 29, 2026
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