Re: [Potlatch-dev] [OSM-talk] Way with only one single node

2012-03-21 Thread Andy Allan
On 21 March 2012 12:56, Steve Bennett stevag...@gmail.com wrote:

 1) We can fix this, but it's hard to prevent it coming back when new
 features are built. I've probably written such bugs.

Mumble grumble unit testing.

 3) I still think we should do this. We have a responsibility to not
 mess up the database. Saying well, we should avoid writing bugs
 isn't addressing that: we should both implement this failsafe
 mechanism, *and* avoid writing such bugs.

Well, I'm not sure I agree on this one. If it was a truly awful thing
to do, the API would prevent it. Given that it's not truly awful, it's
not something to worry about too much. It's not messing up referential
integrity, it's just something unexpected and, at the moment,
seemingly useless.

Furthermore, handling it at save time is, to me, the wrong thing to
do. What do we do when we find our data has an issue? Alert the user?
Silently swallow it? Neither is a good thing. Should that way be
deleted? Should a node be re-inserted? What did the mapper mean to
happen? We can't tell.

Finally, in other projects I follow the convention of don't code
defensively, as described at
http://www.erlang.se/doc/programming_rules.shtml#HDR11 and elsewhere.
The save code should trust that the data is good. If the data isn't
good, whatever made it bad should be fixed. Otherwise it's turtles all
the way down - should the save code check the ids are actually
numerical, just in case, should it do x, y or z, just in case? So the
answer is that the input should be checked, somewhere in the
controller code, and then it should be trusted.

Anyway, mumble grumble unit testing. When we find out what's the
trigger, for the love of god someone should help me write the unit
test so that when it's fixed, it stays fixed.

Thanks,
Andy

___
Potlatch-dev mailing list
Potlatch-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/potlatch-dev


Re: [Potlatch-dev] [OSM-talk] Way with only one single node

2012-03-21 Thread Richard Fairhurst
Andy wrote:
 Anyway, mumble grumble unit testing. When we find out what's the
 trigger, for the love of god someone should help me write the unit
 test so that when it's fixed, it stays fixed.

I've corresponded with Thomas B and found some, ahem, fairly easy steps to
reproduce:

1. Click on map (_once_) to start new way
2. With elastic band still engaged, click 'Save'
3. Whatever the opposite of PROFIT is

Will look at it this weekend I guess.

cheers
Richard




___
Potlatch-dev mailing list
Potlatch-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/potlatch-dev


Re: [Potlatch-dev] [OSM-talk] Way with only one single node

2012-03-21 Thread Andy Allan
On 21 March 2012 16:34, Richard Fairhurst rich...@systemed.net wrote:

 I've corresponded with Thomas B and found some, ahem, fairly easy steps to
 reproduce:

 1. Click on map (_once_) to start new way
 2. With elastic band still engaged, click 'Save'
 3. Whatever the opposite of PROFIT is

 Will look at it this weekend I guess.

My initial thought would be to not create the way until the second
node was drawn. I think that would also remove a lot of the gnarlyness
around POI creation, where we are footling with the
way-that-we-never-actually-wanted as we finish handling the double
click.

Also, if anyone smarter than I am (Dave?) wants to point me in the
right direction, I'd love to bind the controller state and the data
state together a bit better, so that when you're doing things like
undo you not only change the data, but put the controller into the
appropriate state at the same time. That's only tangentially related
to the above problem, however.

Cheers,
Andy

___
Potlatch-dev mailing list
Potlatch-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/potlatch-dev