BReg refuses valid crs84-point coordinates near zero at precision 6 or more

オープン
#2,645 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

Start with coordinate_number in crates/registry-breg/src/contract.rs and the client validator in crates/registry-breg-client/src/actions.rs; compare their decimal handling with the polygon path added in #2644. Add near-zero Point and polygon position cases to both validators and update the assertion that currently expects the precision 9 coordinate to be refused. Done when in-bounds values with no more than the configured fraction digits are accepted consistently by server and client validation.

索引モデルが issue の本文から書いたものです。

説明

area:breg bug

A crs84-point field with precision 6 or more refuses some valid coordinates close to zero, that is, points within roughly 1e-5 degrees (about 1 m) of the equator or the prime meridian. Programme areas on the equator (for example Kenya, Uganda, DRC, Gabon, Ecuador, Indonesia) can hit it.

Cause

coordinate_number in crates/registry-breg/src/contract.rs formats the JSON number with Value::to_string() and passes the text to parse_coordinate, which refuses any exponent (e or E). serde_json writes small magnitudes in exponent form, so 0.000000001 reaches the parser as 1e-9 and is refused even though it has 9 fraction digits and is inside the bounds.

The client-side validator in crates/registry-breg-client/src/actions.rs behaves the same way; the polygon test added in #2644 asserts that [0.000000001, 0.000000001] is refused at precision 9, which pins this behaviour.

Expected

A coordinate is accepted when its value is within bounds and it has no more fraction digits than precision, however serde_json prints it.

Suggested fix

Read the value with as_f64 and count fraction digits from a non-exponent decimal rendering (the polygon path added in #2644 already avoids the exponent problem), and keep refusing exponent notation only where it comes from the submitted text, if that is still wanted. Relax the assertion in actions.rs and add near-zero cases for Point and polygon positions on both the server and client validators.

主要言語
Rust
スター
2
フォーク
0
平均マージ
9時間 48分
マージ済み PR(30日)
151

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

registrystack/registry-stack のほかの issue

registrystack/registry-stack の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。