cvs diff: Review policy.

Tyson Richard DOWD trd at students.cs.mu.oz.au
Tue Feb 18 13:57:15 AEDT 1997


Here's something I'd like everyone to at least take a look at,
although it's in particular up to Fergus to review this (since he's
responsible for most of the reviews).

===================================================================

Estimated hours taken: 2.5

Rewrite and clarify review policy.
The contains work done by myself and Fergus, to try to make a clear
policy on reviews, and answer most of the common questions about
reviews.

compiler/notes/CODING_STANDARDS:
	Remove most of the text on reviews, move it into REVIEWS.
	Put in a reference to REVIEWS.

compiler/notes/REVIEWS:
	New document, describes review procedures and policies.


Index: CODING_STANDARDS
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/notes/CODING_STANDARDS,v
retrieving revision 1.8
diff -u -r1.8 CODING_STANDARDS
--- CODING_STANDARDS	1996/12/12 11:52:54	1.8
+++ CODING_STANDARDS	1997/02/18 00:52:35
@@ -234,18 +234,7 @@
 ------------------
 
 Before committing a change, you should get someone else to review your
-changes.  (Before getting someone else to review your changes, you
-should review them yourself!)
+changes. 
 
-Normally code reviews should be done by sending the output of `cvs
-diff -u' to the reviewer, together with a description of the changes
-for the CVS log. The description should state why the changes were
-made, not just what the changes were. 
-
-If you have added any new files or directories, then before committing
-you must check the group-id and permissions of the newly created files
-or directories in the CVS repository.  Files should be readable by
-group mercury and directories should be both readable and writeable by
-group mercury.  (Setting of permissions will be enforced by the
-pre-commit check script `CVSROOT/check.pl'.)
+The file "REVIEWS" contains more information on review policy.
 
New File: REVIEWS
===================================================================

-----------------------------------------------------------------------------

This file outines the policy on reviews for the Mercury system.

-----------------------------------------------------------------------------

Reviewable material
-------------------

All changes to the Mercury repository, including the compiler,
documentation, www pages, library predicates, runtime system, and tools
need to be reviewed.

Review process
--------------

	1.  Make sure you are working with an up-to-date copy of the
	    module you are using.
	2.  If change is a code change, test change. See "Testing" section
	    of coding standards. Testing may take time - don't forget
	    that steps 3, 4 and 5 can be done in parallel.
	3.  Create diff - use `cvs diff -u'.  New files should be
	    appended verbatim to the end of the diff, with descriptions
	    indicating the name of the file.
	4.  Write log message for this change - use template (see below).
	5.  Review diff and log message yourself. (see blow)
	6.  Send to mercury-developers at cs.mu.oz.au, with the subject
	    "cvs diff: <short description of change>".
	    Nominate a reviewer at top of diff (see below).
	7.  Wait for review (see below).
	8.  Fix any changes suggested. 
	9.  Repeat above steps until approval.
	10. Commit change (see below).


Log Messages
------------

Use the template that cvs provides.

	Estimated hours taken: _____

	<overview or general description of changes>

	<directory>/<file>:
		<detailed description of changes>

In estimated hours, include all your time to fix this problem -
including debugging time.

The description should state why the changes were made, not just what
the changes were.  All file modifications related to the same change
should be committed together, and use the same log message, even over
multiple directories.  The reason for this is that the log messages can
be viewed on a file-by-file basis, and it is useful to know that a small
change of a file in a subdirectory is related to a larger change in
other subdirectories.

For very small changes, the <overview or general description> can be
omitted, but the <detailed description> should stay.

If adding a new feature, this is a good place to describe the feature,
how it works, how to turn it on and off, and any present limitations of
the feature (note that all this should also be documented within the
change, as well).  If fixing a bug, describe both the bug and the fix.

Self-Review
-----------

You should also review your own code first, and fix any obvious
mistakes.  Where possible add documentation - if there was something you
had to understand when making the change, document it - it makes it
easier to review the change if it is documented, as well as generally
improving the state of documentation of the compiler.

Review
------

We're now posting all diffs to mercury-developers at cs.mu.oz.au.

The reasons for posting to mercury-developers are:

	- To increase everyone's awareness of what changes are taking
	  place.
	- Give everyone interested a chance to review your code, not
	  just the reviewer. Remember, your changes may impact upon
	  the uncommitted work of others, so they may want to give
	  input.
	- Allow other people to read the reviewer's comments - so the same
	  problems don't have to be explained again and again. 
	- People can try to see how your changes worked without having
	  to figure out how to get cvs to generate the right set of
	  diffs. 
	- Important decisions are often made or justified in reviews, so
	  these should be recorded.

You should try to match the reviewer to the code - someone familiar with
a section of code can review faster and is more likely to catch errors.
Put a preamble at the start of your diff to nominate who you would like
to review the diff.

Waiting and approval
--------------------

Waiting for approval need not be wasted time.  This is a good time to
start working on something else, clean up unused workspaces, etc.  In
particular, you might want to run long running tests that have not yet
been run on the your change (different grades, different architectures,
optimisation levels, etc).

The reviewer(s) should reply, indicate any problems that need to be
corrected, and whether the change can be committed yet. Design issues
may need to be fully justified before you commit. You may need to fix
the problems, then go through another iteration of the review process,
or you may be able to just fix a few small problems, then commit.

Committing
----------

If you have added any new files or directories, then before committing
you must check the group-id and permissions of the newly created files
or directories in the CVS repository.  Files should be readable by
group mercury and directories should be both readable and writable by
group mercury.  (Setting of permissions will be enforced by the
pre-commit check script `CVSROOT/check.pl'.)

Use the log message you prepared for the review when committing.

Exceptions: Commit before review
--------------------------------

The only time changes should be committed before being reviewed is when they
satisfy all of the following conditions:

	(a) the change is simple 
	
	(b) you are absolutely sure the change will not introduce bugs

	(c) you are sure that the change will pass review with only
	    trivial corrections (spelling errors in comments, etc.)

	(d) there are no new design decisions or changes to previous
	    design decisions in your change (the status quo should
	    be the default; you must convince the reviewer(s) of
	    the validity of your design decisions before the code
	    is committed).

	(e) you will be around the next day or two to fix the bugs
	    that you were sure could never happen
	
	(f) committing it now will make life significantly easier
	    for you or someone else in the group

If the compiler is already broken (i.e. it doesn't pass it's nightly
tests), and your change is a bug fix, then it's not so important to be
absolutely sure that your change won't introduce bugs.  You should
still be careful, though.  Make sure you review the diffs yourself.

Similarly, if the code your are modifying is a presently unused part of
code - for example a new feature that nobody else is using, that is
switchable, and is switched off by default, or a new tool, or an `under
development' webpage that is not linked to by other webpages yet, the
criteria are a bit looser.  Don't use this one too often - only for
small changes.  You don't want to go a long way down the wrong track
with your new feature, before finding there's a much better way.

If these conditions are satisfied, then I don't see a big problem with
mailing the diff, then committing, then fixing any problems that come
up afterwards, provided you're pretty sure everything will be okay.
This is particularly true if others are waiting for your work.

Exceptions: No review
---------------------

The only time changes should be committed without review by a second
person is when they satisfy all of the following conditions:

	(a) it is a very small diff that is obviously correct
	  eg: fix typographic errors 
 	      fix syntax errors you accidently introduced
 	      fix spelling of people's names
 
		These usually don't need to be reviewed by a second
		person.  Make sure that you review your own changes,
		though.  Also make sure your log message is more
		informative than "fixed a typo", try "s/foo/bar" or
		something so that if you did make a change that people
		don't approve of, at least it's seen quickly.

	(b) it is not going to be publically visible
	  eg: Web pages, documentation, library, man pages.
	 
		Changes to publically visible stuff should always be
		reviewed. It's just too easy to make spelling errors,
		write incorrect information, commit libel, etc. This
		stuff reflects on the whole group, so it shouldn't be
		ignored.




More information about the developers mailing list