fix(generator): handle indirect recursion via DFS cycle detection#569
Conversation
Byron
left a comment
There was a problem hiding this comment.
Thanks for contributing, but please do remove the generated code (the one generated in the traditional sense at least).
eb40641 to
7c5a10d
Compare
|
thanks for the feedback @Byron! i have Removed all generated code from the PR as requested. plz take a look |
There was a problem hiding this comment.
Pull request overview
Adds indirect-recursion detection to the Rust type generator so recursive schema references can be boxed to avoid Rust “infinite size” type errors, and updates the shared API blacklist accordingly.
Changes:
- Introduces DFS-based reference traversal helpers (
get_all_refs,points_to) to detect indirect recursion cycles. - Updates
$refhandling into_rust_type_inner()to box references participating in detected cycles. - Removes several APIs from
etc/api/shared.yamlblacklist (previously excluded due to recursive-type generation failures).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/generator/lib/util.py |
Adds DFS reachability checks and applies them during $ref type generation to break indirect recursion cycles. |
etc/api/shared.yaml |
Unblacklists multiple APIs that were previously excluded due to recursive-type generation issues. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Byron
left a comment
There was a problem hiding this comment.
Thanks a lot, I think this is a great improvement!
A few things to change came up, let's resolve them and merge.
7c5a10d to
fad825d
Compare
fad825d to
fc4a30f
Compare
|
@Byron everything is updated u can review it now. If this any problems, plz leave a comment. |
|
Great, thanks a lot! I am now running Tasks
|
|
Thanks for merging the PR, @Byron! It was great working on this. While diving into the generator code, I noticed a couple of other improvements that could be valuable:
Let me know if you’d like me to open Pull Requests for these as well. I'd be happy to contribute further! |
|
Thanks for offering, it's much appreciated.
|
|
Oh, and lastly, if you use AI please give it a |
|
Thanks for the feedback, @Byron! I’m a 2nd-year student and I use AI to help with research, project summaries, and refining my technical discussions. I'll make sure to include the I'll focus on the ergonomic improvements next without using |
|
Submitted two PRs regarding our discussion. I’ll keep watch for any comments. Thanks, @Byron |
util.pyto identify indirect type cycles (e.g.,A -> B -> A).Option<Box<T>>.util_test.pyfor cycle detection and type shape verification.slides,chat,analyticsadmin, anddialogflowAPIs.