Skip to content

Move NumberInput.svelte input processing from JS to Rust#4274

Merged
Keavon merged 2 commits into
masterfrom
move-number-input-processing-to-rust
Jun 22, 2026
Merged

Move NumberInput.svelte input processing from JS to Rust#4274
Keavon merged 2 commits into
masterfrom
move-number-input-processing-to-rust

Conversation

@Keavon

@Keavon Keavon commented Jun 22, 2026

Copy link
Copy Markdown
Member

Cleaner architecture, and now we no longer need to see this in our dev server rebuilds:

image

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread editor/src/messages/layout/layout_message_handler.rs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 9 files

Confidence score: 3/5

  • libraries/math-parser/src/grammer.pest changes around leading-dot floats could let malformed input like 1..5 be 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, mutating number_input.value before on_commit reverses 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

Comment thread libraries/math-parser/src/grammer.pest Outdated
Comment thread editor/src/messages/layout/layout_message_handler.rs Outdated
@Keavon Keavon merged commit c1fa8ba into master Jun 22, 2026
11 checks passed
@Keavon Keavon deleted the move-number-input-processing-to-rust branch June 22, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant