Taoffi's blog

prisonniers du temps

TFS thoughts – Task Closed on code check-in issue

The problem

You probably experienced this some time:

  • You have a task assigned to you
  • It is in active state
  • You check-in your code
  • The task is automatically marked as Closed

 

This workflow may seem OK in some context. However, judging by the number of complaints I read on many development sites, that behavior seems more of an annoyance than a comfort!

In my own view, a task should actually be intentionally closed as long as it has been assigned to a human being. Otherwise, if the task had been assigned to a robot, things may be considered differently!

In 2010, someone at Microsoft's TFS team mentioned:

… people have asked me how to modify the Scrum template such that a Task or Bug is marked as Done during a check-in. We left this out of the original state flow because we wanted the done state transition to be very intentional

 

The TFS team seem to have succumbed to the robotic behavior since!

The solution

In face of such issue, everyone finds a solution but few talk about it (so many other troubles out thereJ)

To solve this annoying behavior, some people propose to go through some acrobatic solutions in the registry and the like. Which is tedious and remains unsustainable in a professional development environment.

Rationally speaking, in its workflow, a Task transits between its different states. For instance: from 'Active' to 'In progress' to 'Closed'. These transitions can be automated by calling some method somewhere in the assemblies that run TFS. And that seems exactly what happens here.

To put this 'automation' OFF, let us look at the article referenced above, to see how the TFS team put this ON:

… Below is a snippet of the In Progress –> Done transition on the Task work item after applying the changes.

 

<TRANSITION from="In Progress" to="Done">

<ACTIONS>

<ACTION value="Microsoft.VSTS.Actions.Checkin" />

</ACTIONS>

<REASONS>

<DEFAULTREASON value="Work finished" />

</REASONS>

</TRANSITION>

 

Yes, it is there… we can simply remove this to put this option OFF!

But… where to find this?

This is part of the 'process template' that compose the TFS meta-models which in turn define the structures, behaviors and processing workflows of TFS objects (among which lives the 'Task' work item).

Using Team foundation server 201X power tools (replace the X by you TFS version: 0, 2 or 3)

  • In Visual Studio, select Tools, Process Editor, WorkItem Types, Open WIT from server
  • Select the Task Work item

 

  • The Workflow tab displays the current processing workflow
  • Right click the Transition Active to Closed and select Open Details

 

  • On the details dialog, select the Actions Tab
  • Delete the Check-in action

  •  Save the work item type

 

Note: Of course, you can do this the hard way by downloading the process template files, and diving into XML… etc. … it is up to you… I personally prefer not J