Move NumberInput.svelte input processing from JS to Rust#4274
Conversation
There was a problem hiding this comment.
Code Review
This pull request moves the evaluation of math expressions in the NumberInput widget from the frontend (via WebAssembly) to the backend. The backend's LayoutMessageHandler now handles the evaluation, validation, and clamping of these expressions, while the frontend simply dispatches a commitText event. Additionally, the math-parser library has been updated to support decimals without a leading zero (e.g., .5). The feedback suggests refactoring a dense chain of inspect_err().ok()? calls in the backend's math evaluation helper to improve readability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
2 issues found across 9 files
Confidence score: 3/5
libraries/math-parser/src/grammer.pestchanges around leading-dot floats could let malformed input like1..5be accepted as implicit multiplication, which risks silently mis-parsing user expressions instead of surfacing a syntax error — add/adjust grammar guards and include a regression test for malformed dotted numbers before merging.- In
editor/src/messages/layout/layout_message_handler.rs, mutatingnumber_input.valuebeforeon_commitreverses the documented commit/update order, which can produce incorrect undo snapshots and confusing edit history behavior — restore commit-before-mutate ordering (or update the contract) and verify with an undo/redo test before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Cleaner architecture, and now we no longer need to see this in our dev server rebuilds: