Triaging tickets

Django uses Trac for managing the work on the code base. Trac is acommunity-tended garden of the bugs people have found and the features peoplewould like to see added. As in any garden, sometimes there are weeds to bepulled and sometimes there are flowers and vegetables that need picking. We needyour help to sort out one from the other, and in the end we all benefittogether.

Like all gardens, we can aspire to perfection but in reality there's no suchthing. Even in the most pristine garden there are still snails and insects.In a community garden there are also helpful people who — with the best ofintentions — fertilize the weeds and poison the roses. It's the job of thecommunity as a whole to self-manage, keep the problems to a minimum, andeducate those coming into the community so that they can become valuablecontributing members.

Similarly, while we aim for Trac to be a perfect representation of the stateof Django's progress, we acknowledge that this simply will not happen. Bydistributing the load of Trac maintenance to the community, we accept thatthere will be mistakes. Trac is "mostly accurate", and we give allowances forthe fact that sometimes it will be wrong. That's okay. We're perfectionistswith deadlines.

We rely on the community to keep participating, keep tickets as accurate aspossible, and raise issues for discussion on our mailing lists when there isconfusion or disagreement.

Django is a community project, and every contribution helps. We can't do thiswithout you!

Triage workflow

Unfortunately, not all bug reports and feature requests in the ticket trackerprovide all the required details. A number oftickets have patches, but those patches don't meet all the requirements of agood patch.

One way to help out is to triage tickets that have been created by otherusers.

Most of the workflow is based around the concept of a ticket'striage stages. Each stage describes where in itslifetime a given ticket is at any time. Along with a handful of flags, thisattribute easily tells us what and who each ticket is waiting on.

Since a picture is worth a thousand words, let's start there:
Django's ticket triage workflow
We've got two roles in this diagram:

  • Committers: people with commit access who are responsible for making thefinal decision to merge a patch.
  • Ticket triagers: anyone in the Django community who chooses tobecome involved in Django's development process. Our Trac installationis intentionally left open to the public, and anyone can triage tickets.Django is a community project, and we encourage triage by thecommunity.
    By way of example, here we see the lifecycle of an average ticket:

  • Alice creates a ticket and sends an incomplete pull request (no tests,incorrect implementation).

  • Bob reviews the pull request, marks the ticket as "Accepted", "needs tests",and "patch needs improvement", and leaves a comment telling Alice how thepatch could be improved.
  • Alice updates the pull request, adding tests (but not changing theimplementation). She removes the two flags.
  • Charlie reviews the pull request and resets the "patch needs improvement"flag with another comment about improving the implementation.
  • Alice updates the pull request, fixing the implementation. She removes the"patch needs improvement" flag.
  • Daisy reviews the pull request and marks the ticket as "Ready for checkin".
  • Jacob, a committer, reviews the pull request and merges it.
    Some tickets require much less feedback than this, but then again some ticketsrequire much much more.

Triage stages

Below we describe in more detail the various stages that a ticket may flowthrough during its lifetime.

Unreviewed

The ticket has not been reviewed by anyone who felt qualified to make ajudgment about whether the ticket contained a valid issue, a viable feature,or ought to be closed for any of the various reasons.

Accepted

The big gray area! The absolute meaning of "accepted" is that the issuedescribed in the ticket is valid and is in some stage of being worked on.Beyond that there are several considerations:

  • Accepted + No Flags

The ticket is valid, but no one has submitted a patch for it yet. Often thismeans you could safely start writing a patch for it. This is generally moretrue for the case of accepted bugs than accepted features. A ticket for a bugthat has been accepted means that the issue has been verified by at least onetriager as a legitimate bug - and should probably be fixed if possible. Anaccepted new feature may only mean that one triager thought the feature wouldbe good to have, but this alone does not represent a consensus view or implywith any certainty that a patch will be accepted for that feature. Seek morefeedback before writing an extensive patch if you are in doubt.

  • Accepted + Has Patch

The ticket is waiting for people to review the supplied patch. This meansdownloading the patch and trying it out, verifying that it contains testsand docs, running the test suite with the included patch, and leavingfeedback on the ticket.

  • Accepted + Has Patch + Needs …

This means the ticket has been reviewed, and has been found to need furtherwork. "Needs tests" and "Needs documentation" are self-explanatory. "Patchneeds improvement" will generally be accompanied by a comment on the ticketexplaining what is needed to improve the code.

Ready For Checkin

The ticket was reviewed by any member of the community other than the personwho supplied the patch and found to meet all the requirements for acommit-ready patch. A committer now needs to give the patch a finalreview prior to being committed. See theNew contributors' FAQ for "My ticket has been inRFC forever! What should I do?"

Someday/Maybe

This stage isn't shown on the diagram. It's used sparingly to keep track ofhigh-level ideas or long term feature requests.

These tickets are uncommon and overall less useful since they don't describeconcrete actionable issues. They are enhancement requests that we mightconsider adding someday to the framework if an excellent patch is submitted.They are not a high priority.

Other triage attributes

A number of flags, appearing as checkboxes in Trac, can be set on a ticket:

Has patch

This means the ticket has an associatedpatch. These will be reviewedto see if the patch is "good".

The following three fields (Needs documentation, Needs tests,Patch needs improvement) apply only if a patch has been supplied.

Needs documentation

This flag is used for tickets with patches that need associateddocumentation. Complete documentation of features is a prerequisitebefore we can check them into the codebase.

Needs tests

This flags the patch as needing associated unit tests. Again, thisis a required part of a valid patch.

Patch needs improvement

This flag means that although the ticket has a patch, it's not quiteready for checkin. This could mean the patch no longer appliescleanly, there is a flaw in the implementation, or that the codedoesn't meet our standards.

Easy pickings

Tickets that would require small, easy, patches.

类型

Tickets should be categorized by type between:

    • New Feature
    • For adding something new.
    • Bug
    • For when an existing thing is broken or not behaving as expected.
    • Cleanup/optimization
    • For when nothing is broken but something could be made cleaner,better, faster, stronger.

Component

Tickets should be classified into components indicating which area ofthe Django codebase they belong to. This makes tickets better organized andeasier to find.

Severity

The severity attribute is used to identify blockers, that is, issues whichshould get fixed before releasing the next version of Django. Typically thoseissues are bugs causing regressions from earlier versions or potentiallycausing severe data losses. This attribute is quite rarely used and the vastmajority of tickets have a severity of "Normal".

Version

It is possible to use the version attribute to indicate in whichversion the reported bug was identified.

UI/UX

This flag is used for tickets that relate to User Interface and UserExperiences questions. For example, this flag would be appropriate foruser-facing features in forms or the admin interface.

Cc

You may add your username or email address to this field to be notified whennew contributions are made to the ticket.

Keywords

With this field you may label a ticket with multiple keywords. This can beuseful, for example, to group several tickets of a same theme. Keywords caneither be comma or space separated. Keyword search finds the keyword stringanywhere in the keywords. For example, clicking on a ticket with the keyword"form" will yield similar tickets tagged with keywords containing strings suchas "formset", "modelformset", and "ManagementForm".

Closing Tickets

When a ticket has completed its useful lifecycle, it's time for it to beclosed. Closing a ticket is a big responsibility, though. You have to be surethat the issue is really resolved, and you need to keep in mind that thereporter of the ticket may not be happy to have their ticket closed (unlessit's fixed, of course). If you're not certain about closing a ticket, justleave a comment with your thoughts instead.

If you do close a ticket, you should always make sure of the following:

  • Be certain that the issue is resolved.
  • Leave a comment explaining the decision to close the ticket.
  • If there is a way they can improve the ticket to reopen it, let them know.
  • If the ticket is a duplicate, reference the original ticket. Alsocross-reference the closed ticket by leaving a comment in the original one— this allows to access more related information about the reported bugor requested feature.
  • Be polite. No one likes having their ticket closed. It can befrustrating or even discouraging. The best way to avoid turning peopleoff from contributing to Django is to be polite and friendly and to offersuggestions for how they could improve this ticket and other tickets inthe future.
    A ticket can be resolved in a number of ways:

    • fixed
    • Used once a patch has been rolled into Django and the issue is fixed.
    • invalid
    • Used if the ticket is found to be incorrect. This means that theissue in the ticket is actually the result of a user error, ordescribes a problem with something other than Django, or isn'ta bug report or feature request at all (for example, some new userssubmit support queries as tickets).
    • wontfix
    • Used when a someone decides that the request isn't appropriate forconsideration in Django. Sometimes a ticket is closed as "wontfix" with arequest for the reporter to start a discussion on the django-developersmailing list if they feel differently from the rationale provided by theperson who closed the ticket. Other times, a mailing list discussionprecedes the decision to close a ticket. Always use the mailing list toget a consensus before reopening tickets closed as "wontfix".
    • duplicate
    • Used when another ticket covers the same issue. By closing duplicatetickets, we keep all the discussion in one place, which helpseveryone.
    • worksforme
    • Used when the ticket doesn't contain enough detail to replicatethe original bug.
    • needsinfo
    • Used when the ticket does not contain enough information to replicatethe reported issue but is potentially still valid. The ticketshould be reopened when more information is supplied.
      If you believe that the ticket was closed in error — because you'restill having the issue, or it's popped up somewhere else, or the triagers havemade a mistake — please reopen the ticket and provide further information.Again, please do not reopen tickets that have been marked as "wontfix" andbring the issue to django-developers instead.

How can I help with triaging?

The triage process is primarily driven by community members. Really,ANYONE can help.

To get involved, start by creating an account on Trac. If you have anaccount but have forgotten your password, you can reset it using the passwordreset page.

Then, you can help out by:

  • Closing "Unreviewed" tickets as "invalid", "worksforme", or "duplicate", or"wontfix".
  • Closing "Unreviewed" tickets as "needsinfo" when the description is toosparse to be actionable, or when they're feature requests requiring adiscussion on django-developers.
  • Correcting the "Needs tests", "Needs documentation", or "Has patch"flags for tickets where they are incorrectly set.
  • Setting the "Easy pickings" flag for tickets that are small andrelatively straightforward.
  • Set the type of tickets that are still uncategorized.
  • Checking that old tickets are still valid. If a ticket hasn't seenany activity in a long time, it's possible that the problem has beenfixed but the ticket hasn't yet been closed.
  • Identifying trends and themes in the tickets. If there are a lot of bugreports about a particular part of Django, it may indicate we shouldconsider refactoring that part of the code. If a trend is emerging,you should raise it for discussion (referencing the relevant tickets)on django-developers.
  • Verify if patches submitted by other users are correct. If they are correctand also contain appropriate documentation and tests then move them to the"Ready for Checkin" stage. If they are not correct then leave a comment toexplain why and set the corresponding flags ("Patch needs improvement","Needs tests" etc.).

注解

The Reports page contains links to many useful Trac queries, includingseveral that are useful for triaging tickets and reviewing patches assuggested above.

You can also find more 对新贡献者的建议.

However, we do ask the following of all general community members working inthe ticket database:

  • Please don't promote your own tickets to "Ready for checkin". Youmay mark other people's tickets which you've reviewed as "Ready forcheckin", but you should get at minimum one other community member toreview a patch that you submit.
  • Please don't reverse a decision without posting a message todjango-developers to find consensus.
  • If you're unsure if you should be making a change, don't make thechange but instead leave a comment with your concerns on the ticket,or post a message to django-developers. It's okay to be unsure,but your input is still valuable.

Bisecting a regression

A regression is a bug that's present in some newer version of Django but not inan older one. An extremely helpful piece of information is the commit thatintroduced the regression. Knowing the commit that caused the change inbehavior helps identify if the change was intentional or if it was aninadvertent side-effect. Here's how you can determine this.

Begin by writing a regression test for Django's test suite for the issue. Forexample, we'll pretend we're debugging a regression in migrations. After you'vewritten the test and confirmed that it fails on the latest master, put it in aseparate file that you can run standalone. For our example, we'll pretend wecreated tests/migrations/test_regression.py, which can be run with:

  1. $ ./runtests.py migrations.test_regression

Next, we mark the current point in history as being "bad" since the test fails:

  1. $ git bisect bad
  2. You need to start by "git bisect start"
  3. Do you want me to do it for you [Y/n]? y

Now, we need to find a point in git history before the regression wasintroduced (i.e. a point where the test passes). Use something likegit checkout HEAD~100 to checkout an earlier revision (100 commits earlier,in this case). Check if the test fails. If so, mark that point as "bad"(git bisect bad), then checkout an earlier revision and recheck. Once youfind a revision where your test passes, mark it as "good":

  1. $ git bisect good
  2. Bisecting: X revisions left to test after this (roughly Y steps)
  3. ...

Now we're ready for the fun part: using git bisect run to automate the restof the process:

  1. $ git bisect run tests/runtests.py migrations.test_regression

You should see git bisect use a binary search to automatically checkoutrevisions between the good and bad commits until it finds the first "bad"commit where the test fails.

Now, report your results on the Trac ticket, and please include the regressiontest as an attachment. When someone writes a fix for the bug, they'll alreadyhave your test as a starting point.