test(questionTool): add parser coverage and reject unsupported fields#1631
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR tightens question tool argument validation by adding Zod ChangesQuestion Tool Strict Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
|
LGTM |
Summary
parseQuestionToolArgsjsonrepairrecovery behaviorallowOtherandquestionsby making the top-level schema strictWhy
src/main/lib/agentRuntime/questionTool.tsdid not have dedicated unit coverage, and its Zod schemasilently accepted unsupported top-level keys when the required fields were otherwise valid. That
made the documented tool contract looser in practice than the prompt guidance claims.
Verification
pnpm exec vitest run test/main/lib/agentRuntime/questionTool.test.tspnpm exec vitest run test/main/presenter/toolPresenter/toolPresenter.test.ts -t "describes the question schema and returns actionable validation errors"pnpm run lintpnpm run typecheckpnpm run buildNotes
v24.14.0, so npm scripts emit anengine warning because the repo asks for
>=24.14.1 <25.Summary by CodeRabbit
Improvements
Tests