darcs

Issue 1077 wish: apply sanity check (nothing new before == nothing new after)

Title wish: apply sanity check (nothing new before == nothing new after)
Priority feature Status given-up
Milestone Resolved in
Superseder Nosy List claus.reinke, darcs-devel, dmitry.kurochkin, kowey, thorkilnaur
Assigned To
Topics ThePendingPatch

Created on 2008-09-17.08:24:05 by kowey, last changed 2017-07-30.22:58:41 by gh.

Messages
msg6024 (view) Author: kowey Date: 2008-09-17.08:24:02
This is a request for comment as well as a wish.  

Perhaps darcs whatsnew should have the following sanity check: if there is
nothing new before I pull or apply patches, there is nothing new after I apply
them.  We can't do much more checking than that (because if there are changes to
the pending patch, they would need to be commuted), but I suspect that this very
simple case could give us some early warning about potential pending patch bugs.

I'm not sure if this should be tolerant or not.  If the sanity check fails, do
we want a "Bug in darcs" or do we just want a big warning?

The context is that I have been thinking about Claus and his battles with
http://bugs.darcs.net/issue693 and http://bugs.darcs.net/issue1034 this morning.
 One of his insights is that it is a pity we can't reason backwards about why
mysterious bugs happen.  Our inability to do this is partly because darcs
doesn't record the fact that things go wrong (e.g. having to tolerantly apply
patches, issue1010)... but sometimes darcs /can't/ in general know that
something has gone wrong (for example, with pending patch bugs).  The invariant
I propose is a just special case where we actually have a clear definition of
"wrong"... so maybe we should exploit it.
msg6026 (view) Author: claus.reinke Date: 2008-09-17.12:34:13
>Perhaps darcs whatsnew should have the following sanity check: if there is
>nothing new before I pull or apply patches, there is nothing new after I apply
>them.  We can't do much more checking than that (because if there are changes to
>the pending patch, they would need to be commuted), but I suspect that this very
>simple case could give us some early warning about potential pending patch bugs.

You mean that 'darcs pull' etc should check that 'darcs whatsnew'
output doesn't change? That sounds useful. Why can't it be extended
to non-empty 'darcs whatsnew', though?

If the pull conflicts with local changes, we get a conflict message. In
all other cases, the output of 'darcs whatsnew' should not change with
pull, right? Something like:

    whatsnew_{pre} =_{modulo conflicts} whatsnew_{post}

>I'm not sure if this should be tolerant or not.  If the sanity check fails, do
>we want a "Bug in darcs" or do we just want a big warning?

Warnings can get lost easily, so they should be repeated until resolved
(issue1010). If there is an obvious bug, immediate reporting should be 
encouraged. Apart from those two concerns, users would like to be
able to get unstuck quickly. But just continuing will maintain the status
quo, with surprising follow-on issues, possibly at a much later time
when the warning is long forgotten.

>The context is that I have been thinking about Claus and his battles with
>http://bugs.darcs.net/issue693 and http://bugs.darcs.net/issue1034 this morning.
>One of his insights is that it is a pity we can't reason backwards about why
>mysterious bugs happen.  

Actually, the point about reasoning backwards is much stronger:
given a darcs fix description and a repo in which errors occured,
someone should be able to determine whether and where the fix
would have affected the repo history, in particular, where in the
repo history the pre-fix darcs would have failed when the after-fix 
darcs would have succeed.

>Our inability to do this is partly because darcs doesn't record the 
>fact that things go wrong (e.g. having to tolerantly apply patches, 
>issue1010)... but sometimes darcs /can't/ in general know that
>something has gone wrong (for example, with pending patch bugs).  
>The invariant I propose is a just special case where we actually 
>have a clear definition of "wrong"... so maybe we should exploit it.

That is more related to your concern that darcs forensics are
currently not as well supported as they could be, making it too
difficult to reproduce bugs for fixing, let alone knowing when
they're fixed. And making sure that issues are reported (by darcs)
as early as possible (when users still have the context of what went
wrong) certainly sounds like a step in the right direction.

Claus
msg6027 (view) Author: kowey Date: 2008-09-17.12:47:32
On Wed, Sep 17, 2008 at 13:33:58 +0100, Claus Reinke wrote:
> If the pull conflicts with local changes, we get a conflict message. In
> all other cases, the output of 'darcs whatsnew' should not change with
> pull, right? Something like:
>
>    whatsnew_{pre} =_{modulo conflicts} whatsnew_{post}

Because whatsnew /can/ change with pull because of commutation.  If you
edit file foo and pull a patch renaming foo to bar, then your whatsnew
should now report that you have edited file bar.

So this check would be a a lot less straightforward than simply checking
the case where there is nothing new.  A fancy check that works modulo
commutation might be prone to the same kinds of bugs that pending is
susceptible to, so I would not advocate it.
msg6030 (view) Author: daveroundy Date: 2008-09-17.14:15:33
On Wed, Sep 17, 2008 at 4:24 AM, Eric Kow  wrote:
> Perhaps darcs whatsnew should have the following sanity check: if there is
> nothing new before I pull or apply patches, there is nothing new after I apply
> them.  We can't do much more checking than that (because if there are changes to
> the pending patch, they would need to be commuted), but I suspect that this very
> simple case could give us some early warning about potential pending patch bugs.

I'm not entirely clear what you mean here.  I think you're proposing a
change to darcs pull and apply, not a change to whatsnew?

> I'm not sure if this should be tolerant or not.  If the sanity check fails, do
> we want a "Bug in darcs" or do we just want a big warning?

I'd say just a small warning.  There's nothing to prevent users from
modifying the working directory while pulling.  It's not really very
wise to do so, but in many cases it isn't harmful, and it should never
cause corruption (of anything but the working directory, they could
certainly lose the changes they make while darcs is changing the same
file, but that's to be expected).  We don't want to claim we've got a
bug when a user is doing something reasonable, like editing one file
while darcs pulling changes that he knows don't affect that file.

> The context is that I have been thinking about Claus and his battles with
> http://bugs.darcs.net/issue693 and http://bugs.darcs.net/issue1034 this morning.
>  One of his insights is that it is a pity we can't reason backwards about why
> mysterious bugs happen.  Our inability to do this is partly because darcs
> doesn't record the fact that things go wrong (e.g. having to tolerantly apply
> patches, issue1010)... but sometimes darcs /can't/ in general know that
> something has gone wrong (for example, with pending patch bugs).  The invariant
> I propose is a just special case where we actually have a clear definition of
> "wrong"... so maybe we should exploit it.

Sounds reasonable, except of course that it doesn't necessarily
indicate a bug.  Also note that this invariant is also violated when
there are conflicts--and correctly so, so we'd need to be a bit more
careful than just checking the before and after state.

David
msg6031 (view) Author: kowey Date: 2008-09-17.14:32:51
On Wed, Sep 17, 2008 at 14:15:38 -0000, David Roundy wrote:
> > Perhaps darcs whatsnew should have the following sanity check: if there is
> > nothing new before I pull or apply patches, there is nothing new after I apply
> > them.  We can't do much more checking than that (because if there are changes to
> > the pending patch, they would need to be commuted), but I suspect that this very
> > simple case could give us some early warning about potential pending patch bugs.
> 
> I'm not entirely clear what you mean here.  I think you're proposing a
> change to darcs pull and apply, not a change to whatsnew?

Yes, sorry, I must have confused myself!  The sanity check is in darcs
pull apply, but it checks the whatsnew output (which is probably where
the confusion came from)

> Sounds reasonable, except of course that it doesn't necessarily
> indicate a bug.  Also note that this invariant is also violated when
> there are conflicts--and correctly so, so we'd need to be a bit more
> careful than just checking the before and after state.

Ah yes, I had not considered that possibility.  That slightly reduces
the usefulness of this sanity check though :-(  I dunno, all I wanted
was to find a way to detect new variants on issue693 before users get
bitten by them.
History
Date User Action Args
2008-09-17 08:24:05koweycreate
2008-09-17 12:34:16claus.reinkesetstatus: unread -> unknown
nosy: kowey, dagit, claus.reinke
messages: + msg6026
2008-09-17 12:47:34koweysetnosy: kowey, dagit, claus.reinke
messages: + msg6027
2008-09-17 14:15:38daveroundysetnosy: + daveroundy
messages: + msg6030
2008-09-17 14:32:54koweysetnosy: kowey, dagit, daveroundy, claus.reinke
messages: + msg6031
2008-09-28 20:50:12adminsetnosy: + droundy, simon, thorkilnaur, - daveroundy
2009-08-06 18:00:55adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, tommy, beschmi, - droundy, claus.reinke
2009-08-06 21:12:33adminsetnosy: - beschmi
2009-08-10 21:48:28adminsetnosy: + claus.reinke, - tommy, markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-10 23:45:37adminsetnosy: - dagit
2009-08-23 17:39:56koweysetstatus: unknown -> needs-implementation
nosy: kowey, simon, thorkilnaur, claus.reinke, dmitry.kurochkin
title: wish: whatsnew sanity check (nothing new before == nothing new after) -> wish: apply sanity check (nothing new before == nothing new after)
2009-08-25 17:29:44adminsetnosy: + darcs-devel, - simon
2009-08-26 14:29:19koweysetnosy: kowey, darcs-devel, thorkilnaur, claus.reinke, dmitry.kurochkin
2009-08-27 14:30:48adminsetnosy: kowey, darcs-devel, thorkilnaur, claus.reinke, dmitry.kurochkin
2017-07-30 22:58:41ghsetstatus: needs-implementation -> given-up