fix(plateau): source に MLIT_PLATEAU を含め、source_ref を付ける - #44
Merged
Conversation
Edits made with this tool set only source=RapiD_Plateau_JP, which says what made
the edit but not where the data came from. The parent import convention
(wiki.openstreetmap.org/wiki/MLIT_PLATEAU/imports_outline) asks for
source=MLIT_PLATEAU together with a source_ref pointing back at that page, so
uploads were attributing the data to nothing in particular.
Set both values. They answer different questions and the changeset can carry
both: MLIT_PLATEAU is the data's origin, RapiD_Plateau_JP is the tool.
source = aerial imagery;MLIT_PLATEAU;RapiD_Plateau_JP
source_ref = https://wiki.openstreetmap.org/wiki/MLIT_PLATEAU/imports_outline
source_ref is withdrawn again when the edit stops using Plateau data — the
commit panel recomputes these on every render, so an undone transfer would
otherwise leave behind a provenance claim the changeset no longer earns. A
source_ref the user typed is never touched, on either path.
The logic moved into modules/util/plateau_changeset_tags.js. It was unreachable
from a test inside updateSessionChangesetTags(), a closure over context and
editor; as a pure function it is directly testable, which is what let the
idempotency and undo cases be written as tests first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
このツールで行った編集は
source=RapiD_Plateau_JPだけを付けていました。何が編集したかは分かりますが、データがどこから来たのかを示していません。親の import 規約(MLIT PLATEAU/imports outline)は changeset に次の 2 つを求めています。
両方を設定します。
MLIT_PLATEAUはデータの出所、RapiD_Plateau_JPは編集に使ったツールで、答えている問いが違うので changeset は両方を持てます。区切りはスペースなしです。既存のコードが
;で join しており、他の値もaerial imagery;mapillaryの形のためです。source_ref の取り消し
Plateau データを使わなくなったときは
source_refを消します。commit パネルは再描画のたびにタグを組み直すので、転記を取り消した後もそのままだと、実態のない出典を主張する changeset になってしまいます。ユーザーが自分で入れた
source_refは、付ける側でも消す側でも触りません。テストのための切り出し
判定ロジックを
modules/util/plateau_changeset_tags.jsに移しました。元はupdateSessionChangesetTags()というcontextとeditorを閉じ込めたクロージャの中にあり、テストから到達できませんでした。純粋関数にしたことで、冪等性と取り消しの挙動を先にテストとして書けるようになっています。テスト 734 件グリーン。
別途対応が必要なこと
ツール自身の wiki ページ JA:MLIT PLATEAU/Plateau RapiD は
RapiD_Plateau_JPのみを記載しておりMLIT_PLATEAUに触れていません。この PR でツールの挙動は親規約に沿いますが、wiki の記述とは食い違う状態になるため、デプロイ後に wiki 側の更新が必要です。