Edgewall Software

A proposal: New Trac Workflow


This document was a proposal for an alternative workflow for Trac. It's kept for historical reasons, but has been since superseded by the WorkFlow proposal authored by Alec Thomas.

At some point during the 0.10 development, that branch was quite stable. Now, development has restarted, targeting a possible inclusion in 0.11. See log:sandbox/workflow.


Table of contents:

  1. Introduction: An introduction;
  2. Workflow Transitions: Description of new workflow;
  3. Automatic Ticket Assignment: Description of ticket assignment rules;
  4. Upgrade Notes: Description of necessary steps for upgrading Trac projects in order to use new workflow;
  5. Modified Files and Detailed Release Notes: Detailed description of the changes that are included into the patch;
  6. Future Enhancements: Description of possible future enhancements;
  7. Patch History: History of all attached patches.

List of attachments:

  • patch-newworkflow-0_8_2-r1752-v2.diff: Source code patch for Trac (synchronized with milestone:0.8.2 );
  • resolvedticket-2.png: New icon for resolved tickets in timeline;
  • reopenedticket-2.png: New icon for reopened/retested tickets in timeline;
  • trac-enh-workflow.gif: State chart diagram for new workflow.

See ticket #869 also.

Introduction

Trac is a powerful and simple tracking system with a flexible plugin architecture also used to plug in different version control systems. It consists of logically complemented components that greatly simplify development of small-size projects.

One of important features that has missed in the project is workflow system that includes support for Quality Assurance and Release Management teams.

This documents includes description and implementation of new workflow system that resolves this issue for Trac.

It is still possible to use existing workflow with these changes. The new workflow does not remove existing workflow. Workflow is configured in trac.ini via property workflow.

Workflow Transitions

The workflow uses the following statuses:

  • new: New ticket;
  • assigned: A ticket is accepted and assigned for implementation;
  • reopened: A ticket has not been implemented properly;
  • resolved: A ticket has been implemented and it has to be verified by QA;
  • verified: A ticket has been successfully tested and it has to be closed by Release Manager;
  • closed: Closed ticket.

The following picture shows the transitions using state chart diagram:
http://projects.edgewall.com/trac/attachment/wiki/NewWorkflow/trac-enh-workflow.png?format=raw

The following table describes transitions between statuses:

From/To new assigned reopened resolved verified closed
new reassign, edit accept resolve
assigned reassign edit resolve
reopened accept reassign, edit resolve
resolved reopen reassign, edit verify
verified reopen retest reassign, edit close
closed reopen retest edit

The following actions are used for transitions:

Action Name Trac Action Description Team in Action
edit leave as status Edit ticket fields without changing status and owner Any
reassign reassign ticket to user Reassign a ticket to another person. If ticket is reassigned in status assigned, then status is changed to new It depends on status
accept accept ticket Accept ticket for implementation and assign it to currently logged user Development Team
resolve resolve as resolution Send a ticket to verification when it has been implemented Development Team
reopen reopen ticket Return a ticket to development because it has not been implemented properly QA Team
verify verify ticket Send a ticket to release when it has been verified QA Team
retest retest ticket Return ticket to QA because it has not been tested properly Release Management Team
close close ticket Close ticket QA or Release Management Team

The following table lists actions for every status in details:

Status Available Actions Target Status
new leave as new
accept ticket
resolve as X
reassign ticket to X
new
assigned
resolved
new
assigned leave as assigned
resolve as X
reassign ticket to X
assigned
resolved
new
reopened leave as reopened
resolve as X
reassign ticket to X
reopened
resolved
reopened
resolved leave as resolved
verify ticket
reopen ticket
reassign ticket to X
resolved
verified
reopened
resolved
verified leave as verified
close ticket
reopen ticket
retest ticket
reassign ticket to X
verified
closed
reopened
resolved
verified
closed leave as closed
reopen ticket
retest ticket
closed
reopened
resolved

Simplified Workflows

It is possible to use original Trac workflow with this patch using workflow = trac.workflows.SimpleWorkflow setting in trac.ini.

Also, it is possible to use subclass of described workflow that does not include status verified. This is implemented via workflow = trac.workflows.QaWorkflow setting in trac.ini. This workflow is useful for projects where QA and RMT activities are shared:
http://projects.edgewall.com/trac/attachment/wiki/NewWorkflow/trac-enh-workflow-normt.png?format=raw

Automatic Ticket Assignment

A ticket is assigned automatically during status changes and when a ticket is assigned to empty user.

For implementing the automatic assignment, the following fields should be configured:

  • component.owner: The person that is responsible for developing of a component;
  • component.qaowner: The person that is responsible for testing of a component (QA Engineer);
  • milestone.owner: The person that is responsible for a milestone (Release Manager).

The following table lists the rules that are used for auto-assignment. Note that auto-assignment is stopped when it finds non-empty owner:

Status Assignment rules
new Use component.owner, then milestone.owner
assigned Use currently logged user
reopened Use component.owner, then milestone.owner
resolved Use component.qaowner, then milestone.owner
verified Use milestone.owner, then ticket reporter
closed N/A

Upgrade Notes

The following steps should be performed for upgrading existing projects:

  1. If the sources are not integrated into main Trac release:
    1. Refresh source code tree from http://svn.edgewall.com/repos/trac/tags/trac-0.8.2
    2. Apply attached patch;
    3. Copy attached file resolvedticket-2.png to htdocs/resolvedticket.png
    4. Copy attached file reopenedticket-2.png to htdocs/reopenedticket.png;
    5. Install Trac by running setup.py install
  2. Upgrade every project by running trac-admin project-path upgrade;
  3. Settings for several predefined reports are overridden during the upgrade. If standard reports have been customized for a project, then it is necessary to repeat the customization using the following steps:
    1. Go to directory project-path/db;
    2. Dump existing reports by running sqlite trac.db ".dump report" > dump.new
    3. Dump original reports by running sqlite trac.db.7.bak ".dump report" > dump.old
    4. Diff the dumps and analyze the differences;
    5. Login into the project as an administrator and edit appropriate reports.
  4. For every project where enhanced workflow is required:
    1. Run trac-admin /path/to/projenv and configure the project:
      1. Review and modify components. Specify owner and qaowner for every component;
      2. Review and modify milestones. Specify owner for every milestone.
    2. Finally, edit project-path/conf/trac.ini and change property workflow to trac.workflows.QaRmtWorkflow (section ticket);

Modified Files and Detailed Release Notes

Many files have been modified and below list describes the changes. The patch is also available.

Refactoring of Trac code for easy support of customized workflows

  • File wiki-default/TracIni:
    • Property workflow added to trac.ini, section tickets:
      • The property specifies class name that implements workflow for Trac;
      • By default, it equals to trac.workflows.SimpleWorkflow and current workflow is used.
  • File setup.py; Added trac/workflows/__init__.py:
    • Install additional directory trac/workflows, which contains predefined implementations of workflows for Trac.
  • Added trac/workflows/Base.py:
    • Abstract base class for any workflow. All workflow implementations should be derived from it.
  • Added trac/workflows/SimpleWorkflow.py, templates/ticket_workflow_simple.cs:
    • Implementation of standard workflow (as in Trac 0.8).
  • Files trac/Ticket.py, templates/ticket.cs, templates/newticket.cs:
    • Code refactoring for customized workflow usage;
    • Workflow-specific code has been moved to trac/workflows/SimpleWorkflow.py and templates/ticket_workflow_simple.cs;
    • Visible enhancements:
      • Better error handling: If validation of a ticket is failed, then the ticket is displayed in preview mode automatically with explanation of errors;
      • Custom fields are preserved in preview mode (see #930 also).

Changes for new workflow

  • Files wiki-default/TracAdmin, scripts/trac-admin, trac/db_default.py, trac/upgrades/__init__.py; Added trac/upgrades/db8.py:
    • New ticket statuses resolved and verified added:
      • Status resolved is used by QA for testing;
      • Status verified is used by Release Manager for releasing a product.
    • New field qaowner added to components. It defines QA engineer that is responsible for a component:
      • Command trac-admin component add modified so that qaowner can be specified. If it is omitted, then qaowner equals to owner;
      • Command trac-admin component chown modified so that qaowner can be specified.
    • New field owner added to milestones. It defines a person that is responsible for a milestone (e.g. Release Manager):
      • Command trac-admin milestone add modified so that owner can be specified;
      • Command trac-admin milestone chown added for changing an owner of a milestone.
    • Added new default reports for simplifying usage of new workflow:
      • For querying not closed defects:
        • Open Tickets, Mine first;
        • Open Tickets by Version;
        • Open Tickets by Milestone;
        • Open Tickets by Owner;
        • Open Tickets by Status.
      • For processing resolved defects by QA:
        • Resolved Tickets, Mine first;
        • Resolved Tickets by Milestone;
        • Resolved Tickets by Owner.
      • For processing verified and closed defects by Release Manager:
        • Completed Tickets by Milestone (Full Description).
    • Default report All Tickets by Milestone renamed to Active Tickets by Milestone because existing name does not correspond to what is produced by the report;
    • Default report My Tickets updated so that new statuses are queried;
    • Default reports enhanced in order to handle empty values properly:
      • Not Assigned displayed as group name for empty owner or milestone;
      • Not Specified displayed as group name for empty version;
    • Database version changed to 8. Affected tables including reports are updated during database upgrade;
    • Old workflow is used by default after the upgrade. New workflow is used by default for new projects.
  • Files trac/workflows/__init__.py; Added trac/workflows/QaRmtWorkflow.py, templates/ticket_workflow_qarmt.cs:
    • Implementation of new workflow. See separate chapters Workflow Transitions and Automatic Ticket Assignment for details.
  • File templates/ticket.cs:
    • Display resolution in ticket header when it is available (currently, the resolution is displayed for closed tickets only).
  • Files trac/Milestone.py, trac/Roadmap.py, templates/roadmap.cs, templates/milestone.cs:
    • Word resolved is replaced with word completed in order to eliminate conflict with status resolved;
    • New statuses used when percentage is calculated:
      • Active Tickets include tickets for developers and QA, e.g. statuses new, assigned, reopened, and resolved;
      • Completed Tickets include tickets for Release Manager and closed tickets, e.g. statuses verified and closed.
    • Milestone owner can be changed when milestone is edited;
    • Milestone owner is displayed near milestone date when it has been specified;
    • New statuses are taken into account when information is downloaded in iCalendar format.
  • Files htdocs/css/timeline.css, trac/Timeline.py, templates/timeline_rss.cs, templates/timeline.cs; Added htdocs/resolvedticket.png, htdocs/reopenedticket.png:
    • The resolved and verified tickets added to timeline when new workflow is used;
    • Milestone owner is retrieved from database for RSS;
    • New icons are used for resolved and reopened/retested tickets in timeline.
  • File trac/WikiFormatter.py:
    • Ticket status is displayed in popups for ticket numbers.

Future Enhancements

Proposed implementation has been tested and it is ready for using. However, the following further enhancements are visible:

  • Roadmap and Milestone enhancement: In progress line, display amount of defects separately by every status. For example, Active Tickets include statuses new, assigned, reopened, and resolved. Different colors can be used for these statuses on a progress bar so that user sees where is the delay in active tickets. The same is applied to Completed Tickets, where different colors can be used for verified and closed tickets.
  • Ticket auto-assignment enhancement: Add owner for version records. It can be used when component and milestone do not have owners. This allows defining responsibilities for released versions of a product.
  • Ticket workflow enhancement: Add status testing for QA. It is similar to assigned but it is used for testing. This is important for the projects where testing of a ticket takes significant amount of time and it is necessary to track testing progress in details.
  • Ticket workflow enhancement: Add status unconfirmed for new tickets. This status is used as the initial status for a ticket is user-reporter does not belong to some "core" team. It can be configured via additional permission TICKET_CREATE_NEW.
  • Ticket workflow enhancement: Allow actions and fields editing depending on permissions for logged user.

Patch History

  • patch-newworkflow-0_8_2-r1752.diff: Patch does not contain fix for the following bug: Reassign owner is not preserved during ticket preview;
  • patch-newworkflow-r1102.diff: Patch was not synchronized with 0.8.x releases of Trac;
  • patch-newworkflow-r1098.diff: Patch does not contain changes that have been requested in #869 recently.
  • patch-newworkflow-r1064.diff: Patch is not synchronized with milestone:0.8. Also, new icons for resolved and reopened tickets have been added in order to have similar look with latest Trac icons. The icon for closed tickets does not need to be changed.
  • patch-newworkflow-r1040.diff: Patch that does not include refactoring in Ticket.py in order to support customized workflows.
  • patch-newworkflow-r1034.diff: Patch that includes one more non-related change (see #905 for details). There are no more changes to remove! :-)
  • patch-newworkflow-r1016.diff: Patch that includes one more non-related change (see #892 for more details). Also, this patch has merge conflicts with current codebase. Also, this patch does not contain support for separate icon for reopened/retested tickets.
  • patch-newworkflow-r1008.diff: Patch that includes non-related to workflow changes. They have been removed in favour of #877, #878, #879, and #880.
  • patch-newworkflow-r1003.diff: Original patch. It the patch, Advanced Query screen does not allow to query by empty values in custom fields.

Final notes:

  • I would like to thank Trac development team for their effort and for this project.
  • In case if a question or a suggestion occurs, email me to pkou at ua.fm.

Bye!


Here are some references to similar customizability efforts that were or are ongoing for bugzilla, and might be worth a read:

  • #37613 "Accept bug" or "Take bug" functionality. See in particular comment 39.
    • I would like to argue against table-based approach for ticket workflows. Yes, they can be powerful but setting up the tables require significant effort that needs to be duplicated for every project. It is a nightmare job from my experience of using proprietary defect tracking systems. Also, the proposal in Bugzilla is not complete because it does not use entity action, which should describe necessary changes in status and optionally other fields. — pkou
  • #94534 Customised resolutions.
    • It seems that the issue with customized resolutions needs to be moved to separate thread. See #905 as an example. — pkou

Last modified 18 years ago Last modified on Oct 31, 2006, 10:50:59 AM

Attachments (18)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.