Skip to content

[Maintainer] i18n: fix scoped-locale and decimal Bugbot findings from #1148 - #1162

Merged
Aymericr merged 1 commit into
mainfrom
cursor/i18n-bugbot-fixes-ae7f
Oct 27, 2026
Merged

Aymericr merged 1 commit into
mainfrom
cursor/i18n-bugbot-fixes-ae7f

Conversation

@Aymericr

@Aymericr Aymericr commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Follows up on #1148’s five remaining Bugbot findings:

  • False positive — client locale reset: ClientBootstrap subscribes with defaultI18n.subscribeLocale, which excludes catalog refresh notifications. Registering a later compiled pack therefore refreshes messages without applying the global English locale to the request scope. The regression now explicitly registers a compiled catalog while global en and request-local fr differ, and verifies no locale notification or reset occurs.
  • False positive — slider scoped parsing: SliderControl gets locale from useLocale() and calls parseSliderBareValue(text, locale), which forwards it to parseLocalizedNumber. The regression now explicitly keeps global locale en while rendering and parsing through a French scope.
  • False positive — formatter hydration: formatNumber no longer reads the live registry locale; its default is deterministic English and React renderers pass the useLocale() snapshot explicitly. The SSR regression now asserts global English and request-local French simultaneously.
  • Fixed — decimal write-back: metric controls now use locale-aware Intl.NumberFormat for idle, edit, reset, and arrow-key values. Slider write-back was already locale-aware and remains covered. The related floor-plan extrusion input now also preserves the scoped decimal separator after unit or locale changes.
  • Fixed — floor-plan formatting: reference-scale labels, prefilled inputs, and scale previews now use the scoped locale instead of the panel’s local ASCII-only formatter.

apps/editor/proxy.ts is unchanged.

How to test

  1. Run bun test packages/core/src/i18n packages/editor/src/components/ui/controls/slider-control.test.tsx packages/editor/src/components/ui/controls/metric-control.test.ts packages/editor/src/components/editor/floorplan-panel.test.ts packages/editor/src/components/editor-2d/floorplan-measurement-tool-layer.test.ts.
  2. Run bun run ci.
  3. In a French-scoped editor, verify 2,75 remains comma-formatted after committing metric, slider, extrusion, and reference-scale values.

Screenshots / screen recording

N/A — non-visual formatting correctness change.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch
Open in Web Open in Cursor 

@Aymericr Aymericr added the bot:maintainer label Oct 27, 2026 — with Cursor
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T01:02:59.854337Z 95707a2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95707a2277

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

measuredLengthUnits: scaledMeasuredLengthUnits,
metersPerUnit,
label: formatReferenceScaleLabel(displayLength, referenceScaleUnit),
label: formatReferenceScaleLabel(displayLength, referenceScaleUnit, locale),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep localized labels out of persisted guide data

When a reference scale is created under French, this stores a value such as 2,75 m in scaleReference.label; the floor-plan layer and reference panel subsequently render that persisted string verbatim. If the editor locale later changes, or another user opens the scene under a different locale, existing labels retain the creator's decimal convention and scene serialization now varies by locale. Persist the numeric value and unit (or a locale-neutral representation) and format the label with the active locale at render time.

Useful? React with 👍 / 👎.

Comment on lines +46 to +48
function roundToPrecision(value: number, precision: number): number {
const factor = 10 ** precision
return Math.round((value + Number.EPSILON) * factor) / factor

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve symmetric rounding for negative metric values

For metric controls that permit negative values, such as node-position controls, Math.round resolves exact negative half steps toward positive infinity. For example, at precision 1 this changes -1.25 to -1.2, whereas the previous toFixed path and the new Intl.NumberFormat display round it to -1.3; wheel or drag updates can therefore move a negative coordinate one quantum toward zero and disagree with the displayed value. Use a sign-symmetric rounding method consistent with the formatter.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Tooling cross-review at 95707a2: APPROVE

  • CI: quality, cli-smoke, Changed paths and ci are green at this SHA. Bugbot passed with no findings.
  • Tests: the 5 test files in the PR body pass locally (34/34).
  • French write-back: every toFixed/String() write-back in metric-control.tsx and the extrusion input now goes through the scoped formatNumber. The new tests cover 2,75 in French and 2.75 in English for the metric, extrusion and floor-plan helpers.
  • Floor-plan decimals: the floor-plan panel's local ASCII formatter is gone.
  • False positives: each of the three has a regression test — the catalog refresh doesn't reset the locale, slider parsing works in a French scope while the global locale is en, and the formatter defaults to English under SSR.
  • Scope: apps/editor/proxy.ts is byte-identical to main. Only 8 i18n component and test files change, with no auth, payments, secrets, infra, moderation, user data, schema or CI files, so Security isn't needed.

No P0 or P1 problems.

P2 follow-ups (Codex, open on this head):

  • floorplan-panel.tsx:7224: scaleReference.label is persisted scene data, so it now saves the creator's decimal style, e.g. 2,75 m. Store a locale-neutral value and format it when rendering.
  • metric-control.tsx:48: roundToPrecision rounds negative halves toward zero (-1.25 becomes -1.2), which doesn't match the formatter's -1.3. Use sign-symmetric rounding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants