← Back to team overview

launchpad-dev team mailing list archive

Re: Lessons from a weird bug

 

On Oct 2, 2011, at 6:06 PM, James Westby wrote:

> Hi Brad,
> 
> Thanks for writing this up. It reminded of another bug to do with
> validators and dict ordering:
> 
>  https://bugs.launchpad.net/lazr.restful/+bug/561521
> 
> I'm not sure if there are changes that could be made to avoid these
> sorts of problems in future, but in that bug Michael makes a statement
> that someone may be able to confirm or deny, which could eliminate these
> problems (at the risk of introducing them elsewhere of course.)

I think Michael's comment makes sense out of context, so I'll quote it for others.

"""
I have this feeling, though it's very much citation needed, that schema set methods shouldn't depend on the value of other schema items for validation, to avoid exactly this issue and that kind of constraint should be expressed as an invariant. But I could be wrong.
"""

That's a very reasonable constraint for a field validation method.  Another very reasonable constraint, and arguably an even more basic one, is the one that Brad touched on: validators should not mutate.

Brad mentioned when he described the problem to me that someone had created these validators to work around some kind of design problem.  I forget the details.  In any case, I suspect Brad would agree that reworking BugTask to conform to these constraints would be a Good Thing, and worthy of filing a bug for future work.

Gary

References