Repository navigation
[Maintainer] Reference scale: validate calibration input and harden label fallback - #1170
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Tooling cross-review at 9037f09: APPROVE Every check that ran on this exact SHA is green: Changed paths, quality, cli-smoke, and Cursor Bugbot with no issues.
This PR doesn't touch |
What does this PR do?
A follow-up to #1164. It adds input validation to reference-scale calibration and makes the legacy label parser more robust.
displayLengthat1e6, so a larger value could be saved and then fail validation on import, paste or patch. The form now shows an inline message ("Length must be at most 1000000 m.", using the unit you picked) and disables Save Scale.createGuideScaleReferenceis the only code that writesdisplayLength. It now leaves outdisplayLength/displayUnitwhen the value is outside the schema range and keeps only the label, so whatever it returns always passes the schema. The guide move/resize path copies a reference that is already stored and doesn't set these fields.String()on arbitrary values. If a scene was loaded without validation and a persistedlabelisn't a string, the label now renders as the number when it is a number and as an empty string otherwise. Odd values such as{ toString: null }, null-prototype objects or symbols can no longer throw.'1 234,5 m'parses again. The pattern is now\s+between digit groups; JavaScript's\salready covers NBSP and narrow NBSP. Whitespace and digit groups can't match the same characters, and the existing 64-character cap still applies before matching.Deferred: a hand-typed
'1.234 m'still reformats to'1234 m'. Only hand-typed labels are affected. The editor never saved a label with a thousands separator or more than two decimals: it usedtoFixed(2)before #1162, and the shared formatter has had grouping off since #1148. The parser reads three digits after the last separator as grouping, which is what makes a hand-typed'1,234 m'read as 1234. Reading'1.234 m'as 1.234 instead would mean choosing a convention for dot versus comma in free text. That is out of scope for this PR, so behaviour is unchanged.How to test
2000000(meters). An inline error says the length must be at most 1000000 m, and Save Scale is disabled.1000000. The error goes away and saving works.bun test src/components/editor/floorplan-panel.test.tsand the fullpackages/editortest suite (2669 pass), plusturbo run check-types --filter=@pascal-app/editor.Screenshots / screen recording
N/A: the only visible change is the inline validation message.
Checklist
bun devbun checkto verify)mainbranchNote
Low Risk
Changes are limited to floor-plan reference-scale validation and display; they reduce invalid persisted data and rendering edge cases without touching auth or core persistence paths.
Reviewed by Cursor Bugbot for commit 9037f09. Bugbot is set up for automated code reviews on this repo. Configure here.