-
Notifications
You must be signed in to change notification settings - Fork 191
Fix: float and integer fake data gen #2282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ConsoleProject ID: Sites (2)
Note You can use Avatars API to generate QR code for any text or URLs. |
WalkthroughAdds a new helper src/lib/helpers/numbers.ts exporting isWithinSafeRange(val: number). Updates src/lib/helpers/faker.ts to import and use this helper when generating numbers: for integers, min defaults to 0 and max to 100 if provided values are outside the safe range; previous defaults were 0 and 10000 when undefined. Renames the 'float' case to 'double' and applies the same safe-range defaults, increases precision from 2 to 4, and generates values via faker.number.float with fractionDigits: 4. Other types remain unchanged. Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/lib/helpers/faker.ts
(2 hunks)src/lib/helpers/numbers.ts
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/lib/helpers/faker.ts (1)
src/lib/helpers/numbers.ts (1)
isWithinSafeRange
(36-38)
⏰ 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). (2)
- GitHub Check: e2e
- GitHub Check: build
🔇 Additional comments (2)
src/lib/helpers/faker.ts (2)
5-5
: LGTM: shared numeric guard import.
176-183
: Include both 'float' and 'double' cases and normalize bounds
- Add
case 'float':
abovecase 'double':
and computeto avoid inverted ranges.const rawMin = isWithinSafeRange(floatAttr.min) ? floatAttr.min : 0; const rawMax = isWithinSafeRange(floatAttr.max) ? floatAttr.max : 100; const min = Math.min(rawMin, rawMax); const max = Math.max(rawMin, rawMax); return faker.number.float({ min, max, fractionDigits: 4 });- No
'float'
discriminant was found in the current codebase—please verify if adding it is required.
What does this PR do?
When the limit range is not defined for integer and float columns, backend uses PHP's limits which goes way out of bounds on Console. This fixes it.
Test Plan
Manual -
Screen.Recording.2025-08-30.at.11.50.11.AM.mov
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
New Features
Bug Fixes