fix(language): resolve @uuid version arg by name in validation - #2835
Conversation
`_checkUuid` assumed the version was `attr.args[0]`, so a named application like `@uuid(message: '...', version: 1)` skipped validation entirely. Look up the arg whose resolved param is `version` and use it for both the value and the diagnostic location. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe ChangesUUID validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to UUID validation now correctly identifies the version argument regardless of named-argument order, preserving message-only usage and reporting invalid versions at the relevant argument. The covered change is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
packages/language/src/validators/attribute-application-validator.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. packages/language/test/attribute-application.test.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). 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 |
Summary
_checkUuidin the attribute application validator assumed the version wasattr.args[0]. With named arguments in a different order — e.g.@uuid(message: 'invalid uuid', version: 1)— the version was never validated, so unsupported versions slipped through; the message string landed in the version slot instead (harmless, sincegetNumberLiteralreturnsundefined, but wrong).The validator now looks up the argument whose
$resolvedParam.nameisversionand uses it for both the value and the diagnostic location.Test plan
packages/language/test/attribute-application.test.ts:messagebeforeversion) — accepts7, rejects1npx vitest run test/attribute-application.test.tsinpackages/language— 42 passed🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
@uuidvalidation for named arguments, regardless of their order.Tests