﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
10913	Sequential execution of fix* commands in validator rules	mkoniecz	team	"==== What steps will reproduce the problem?
1. Make validator rule with multiple fix* commands

For example:
{{{
fixChangeKey: ""highway => construction"";
fixAdd: ""highway=construction"";
}}}
executed on
{{{
highway=tertiary, construction=yes
}}}

==== What is the expected result?
fix* commands operate on state modified by previous fix* operations:
{{{
1.
highway=tertiary; construction=yes
<before>

2.
construction=tertiary
<after fixChangeKey: ""highway => construction"";>

3.
highway=construction; construction=tertiary
<after fixAdd: ""highway => construction"";>
}}}

==== What happens instead?

Output is 
{{{
construction=construction
}}}

It is equivalent of executing fixAdd before fixChangeKey. Order of fix* commands is ignored (it is neither going first to last nor from last to first). Adding fixRemove ""construction""; failed to improve situation (I hoped that fixChangeKey refuses to overwrite existing key).

==== Please provide any additional information below. Attach a screenshot if possible.

{{{
Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2015-01-01 02:35:00
Last Changed Author: Don-vip
Revision: 7919
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Relative URL: ^/trunk
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2015-01-01 02:55:34 +0100 (Thu, 01 Jan 2015)
Last Changed Rev: 7919

Identification: JOSM/1.5 (7919 en) Linux Ubuntu 14.04.1 LTS
Memory Usage: 326 MB / 889 MB (164 MB allocated, but free)
Java version: 1.7.0_72, Oracle Corporation, Java HotSpot(TM) Server VM
Dataset consistency test: No problems found

Plugins:
- OpeningHoursEditor (30892)
- buildings_tools (30892)
- continuosDownload (1413902943)
- ext_tools (30892)
- measurement (30892)
}}}

I was attempting to run custom validation rule 

{{{
*[construction=yes][highway =~ /motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|living_street|pedestrian|cycleway|footway|steps|path|bridleway|track|bus_guideway|raceway|road|/][highway!=construction] {
  throwWarning: tr(""{0} with {1}=* (highway=construction, construction=* is a superior tagging scheme)"", ""{0.tag}"", ""{1.key}"", ""{1.value}"");
  fixRemove: ""construction"";
  fixChangeKey: ""highway => construction"";
  fixAdd: ""highway=construction"";
}
}}}

on http://www.openstreetmap.org/way/185001688

Making separate rule for every highway value would be feasible but awful hack."	defect	closed	normal	15.04	Core validator		fixed	template_report	Klumbumbus
