fix: prevent $defs mutation in Tool.from_tool transforms#2493
fix: prevent $defs mutation in Tool.from_tool transforms#2493jlowin merged 1 commit intoPrefectHQ:mainfrom
Conversation
Deep copy parent_defs before passing to compress_schema to prevent mutation from affecting parent tool schemas when child tools hide parameters that remove all $ref usage.
WalkthroughThe change modifies Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (2)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #2492
Description
_create_forwarding_transformpasses a reference to the parent tool's$defsdict tocompress_schema, which mutates it in-place when pruning unused definitions. This corrupts the parent's schema when child tools hide parameters that remove all$refusage.The fix deep copies
parent_defsbefore passing tocompress_schema.Contributors Checklist
Review Checklist