Skip to content

fix: code quality and safety improvements - #3368

Closed
saurabhhhcodes wants to merge 1 commit into
Karanjot786:mainfrom
saurabhhhcodes:fix/termui-83794
Closed

saurabhhhcodes wants to merge 1 commit into
Karanjot786:mainfrom
saurabhhhcodes:fix/termui-83794

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved numeric validation across calculator, layout, input, pagination, and selection components.
    • Prevented values that are not valid numbers from being incorrectly accepted or processed.
    • Preserved existing clamping, calculation, and returned-value behavior.

@github-actions github-actions Bot added type:bug +10 pts. Bug fix. area:examples Example apps. area:core @termuijs/core area:ui @termuijs/ui labels Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 778504a3-4b03-46c1-81ca-5778a3557048

📥 Commits

Reviewing files that changed from the base of the PR and between 6c7584e and e69ea05.

📒 Files selected for processing (5)
  • examples/calculator/src/index.tsx
  • packages/core/src/layout/LayoutEngine.ts
  • packages/ui/src/NumberInput.ts
  • packages/ui/src/Pagination.ts
  • packages/ui/src/prompts.ts

📝 Walkthrough

Walkthrough

The changes replace global isNaN checks with Number.isNaN in calculator evaluation, layout parsing, number input, pagination, and prompt selection. Existing clamping, fallback, infinity, and return behavior remains unchanged.

Changes

Numeric validation updates

Layer / File(s) Summary
Calculator evaluation validation
examples/calculator/src/index.tsx
Negative-number detection and final evaluation validation now use Number.isNaN.
Layout numeric parsing validation
packages/core/src/layout/LayoutEngine.ts
Grid span and track parsing now use Number.isNaN for parsed values.
UI numeric input validation
packages/ui/src/NumberInput.ts, packages/ui/src/Pagination.ts, packages/ui/src/prompts.ts
Numeric input, pagination, and prompt choice validation now use Number.isNaN. Existing clamping and fallback behavior remains unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: quality:clean

Suggested reviewers: karanjot786

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so all required template sections and issue information are missing. Add the required description sections, including the linked issue, affected packages, change type, checklist, and reviewer notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format and accurately describes the code-quality and safety changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 2, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core @termuijs/core area:examples Example apps. area:ui @termuijs/ui type:bug +10 pts. Bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant