Skip to content

finding(fields): LocationField accepts a partly-numeric coordinate, emitting a plausible wrong location #6715

Description

@claude

Filed unassigned by the dev seat implementing #6714, as an out-of-scope finding. Not fixed there — that card is fenced to the coordinate RANGE, and both the card body and the triage ruling explicitly fence this one out ("parseFloat('12abc') === 12 宽松是另一个问题"). Recording, not choosing.

Dedup before filing: repo-scoped REST list of open issues updated since 2026-08-18 (239 issues), grepped for parseFloat / LocationField / coordinate / latitude — only #6714 itself matched, where this appears as the explicitly excluded half.

What

packages/fields/src/widgets/LocationField.tsx parses the typed pair with bare parseFloat:

const lat = parseFloat(parts[0]);
const lng = parseFloat(parts[1]);
if (!isNaN(lat) && !isNaN(lng)) { ... }

parseFloat stops at the first character it cannot read and returns what it got, so a coordinate that is only PARTLY a number is accepted as if it were whole:

"12abc, 34"   emits {"lat":12,"lng":34}
"1.2.3, 4"    emits {"lat":1.2,"lng":4}
"12deg, 34"   emits {"lat":12,"lng":34}

Each of those emissions is a value the spec ACCEPTS — valueSchemaFor({ type: 'location' }) sees a well-formed in-range pair — so unlike #6714 the platform validator cannot be the oracle here. The defect is that the widget silently invents a coordinate the user did not type, rather than treating the text as the non-coordinate it is.

Why it may matter

Same write path and same exposure as #6714: typing the coordinates is this field's only interaction. The failure is quieter, though — #6714 produced a value the contract refuses, which something downstream could in principle have caught; this produces a plausible, contract-valid, WRONG location. The nearest precedent for how this repo weighs that is the || 0 removal in #6272: "a field that renders a plausible wrong place is worse than one that renders nothing".

What is NOT measured

  • How a user actually reaches this. "12abc" is not obvious typing; paste of a formatted coordinate (12°N, 34°E, 12.5 N, 34 E) is the plausible route and has not been tested.
  • Whether the right disposition is to reject non-numeric residue outright, or to parse the degree/hemisphere notations that a paste would produce. Those are different features, and the choice is triage's.

Related

#6714 (the range refusal on these same two lines, where this was fenced out) · #6272 (the A1 rename, and the || 0 precedent on plausible-wrong values)


Generated by Claude Code

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatchedpriority:p2

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions