fix: resolve 4 bugs in termui - #3552
Conversation
📝 WalkthroughWalkthroughThe FPS calculation in ChangesFPS rounding correction
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/dev-server/src/devtools.ts (1)
81-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for FPS rounding.
packages/dev-server/src/devtools.test.ts:308-313verifies hover-state clearing, but it does not verifyPerfMetrics.fps. Add a deterministic test that controlsDate.now()or uses fake timers, callsrecordRender, selects theperftab, and asserts the one-decimal FPS output. Include a floating-point boundary case targeted byNumber.EPSILON.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/dev-server/src/devtools.ts` at line 81, Add a deterministic regression test in the devtools test suite covering the FPS calculation in recordRender: control Date.now() or use fake timers, record renders, select the perf tab, and assert PerfMetrics.fps is rounded to one decimal place. Include a floating-point boundary value that exercises the Number.EPSILON adjustment while preserving the existing hover-state coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/dev-server/src/devtools.ts`:
- Line 81: Add a deterministic regression test in the devtools test suite
covering the FPS calculation in recordRender: control Date.now() or use fake
timers, record renders, select the perf tab, and assert PerfMetrics.fps is
rounded to one decimal place. Include a floating-point boundary value that
exercises the Number.EPSILON adjustment while preserving the existing
hover-state coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c617dad1-1f46-4c94-a104-51f45817d6e6
📒 Files selected for processing (1)
packages/dev-server/src/devtools.ts
Description
This PR fixes real bugs found in the codebase:
trim()to''misses whitespace-only input;.trim().length === 0is explicit.Number.EPSILONtoMath.round: prevents floating-point drift (e.g.1.005 * 100rounding to 100 instead of 101).parseInt: without10, strings like'0x1F'or'08'parse in unintended bases.Number.EPSILONtoMath.round: prevents floating-point drift (e.g.1.005 * 100rounding to 100 instead of 101).Type of Change
How Has This Been Tested?
Checklist
Related Issue
Ref: #3551
Summary by CodeRabbit