Jens-G opened a new pull request, #3567:
URL: https://github.com/apache/thrift/pull/3567

   Follow-up to the netstd recursion-depth round-trip test (#3563). 
`test/Recursive.thrift` now also defines a recursive `union` 
(`CoUnion`/`CoUnion2`) and `exception` (`CoError`/`CoError2`) in addition to 
the existing recursive structs. The netstd generator emits the same 
`IncrementRecursionDepth`/`DecrementRecursionDepth` guard around the generated 
read/write of all three kinds, so this extends `TProtocolRecursionDepthTests` 
to cover unions and exceptions too.
   
   - **Struct + exception** are parameterized together (`ChainKind`): 
below-limit, at-limit, over-limit write, over-limit read and cyclic-graph, 
across Binary/Compact/JSON. `CoError` mirrors `CoRec` (the recursive field is 
optional, so the chain terminates with a null leaf).
   - **Union** is leaf-less here: `CoUnion`/`CoUnion2` have only the recursive 
field, so every terminal is the unset state, which is unwritable — no finite 
union value can be serialized, hence no at-limit round-trip. Only the 
over-limit rejection is observable: an over-limit write (the guard fires before 
the unwritable terminal is reached) and an over-limit read of a payload crafted 
with raw protocol primitives (a direct `STRUCT` field, id 1, so the reader 
recurses through the guarded `CoUnion.ReadAsync` rather than the unbounded skip 
path).
   
   All over-limit assertions check for `TProtocolException(DEPTH_LIMIT)` 
specifically, so a pass confirms the recursion guard actually fired.
   
   Test-only change. Validated locally with .NET 10: 39/39 pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to