Searching on status of depedencies?

I’m using RT to do ticket-tracking for software development. I
would like to use RT to the answer the question “What can I work on now?”.
I’d been using a search that checked for existing dependencies, but RT
doesn’t appear to distinguish between resovled and unresolved
dependencies. I saw some ‘scrips’ online that could work around this
using the ‘stalled’ status, but they were incomplete (a ticket needs to
become stalled if it gains a dependency), and it’s not clear that it’s a
good idea to run them for everybody else (using the same RT installation
for normal ticket tracking), or if it’s possible to restrict them to a
particular queue. I also saw a suggestion about a "custom search module.“
I rather suspect this is what I actually want to do – add
"UnresolvedDependencies” to ticket SQL – but I can’t find documentation
on it anywhere. Do I need to buy the book? Thanks.

  • Todd Miller

Todd,

I’m not

I’m using RT to do ticket-tracking for software development. I
would like to use RT to the answer the question “What can I work on
now?”.
I’d been using a search that checked for existing dependencies, but RT
doesn’t appear to distinguish between resovled and unresolved
dependencies. I saw some ‘scrips’ online that could work around this
using the ‘stalled’ status, but they were incomplete (a ticket needs
to
become stalled if it gains a dependency), and it’s not clear that
it’s a
good idea to run them for everybody else (using the same RT
installation
for normal ticket tracking), or if it’s possible to restrict them to a
particular queue. I also saw a suggestion about a “custom search
module.”
I rather suspect this is what I actually want to do – add
“UnresolvedDependencies” to ticket SQL – but I can’t find
documentation
on it anywhere. Do I need to buy the book? Thanks.

It looks like the cleanest way to do this would be to write a custom
search that calls

$Ticket->HasUnresolvedDependencies() for each item in the collection’s
results.

This is something we’ve done significantly differently in Hiveminder
and I totally understand why you want it, but I’m not sure there’s a
clean and simple way to get it today.

-jesse

It looks like the cleanest way to do this would be to write a custom
search that calls $Ticket->HasUnresolvedDependencies() for each item in
the collection’s results.

For other people who may come googling by, "custom search" appears 

to mean writing a Perl module in lib/RT/Search; I started by copying
Googleish.pm, since it was simpler. You can test the search from the
command-line (sometimes, depending on your database it set up) using
rt-crontool’s --search option (RT::Search::MyNewSearch). (Setting
–command and --condition to the “Generic” modules seems to work for
no-ops, since, IIRC, rt-crontool will be unhappy without them. Note that
you’ll have to print the results in your search code to actually see
them.) You can test the search in the web interface by copying
Simple.html and changing the names appropriately. Note that /both/ Mason
and mod_perl do caching, so changing your custom search after you’ve used
it from the web may require restarting the web server (as well as clearing
Mason’s cache).

The advantage of this approach is that it's minimally invasive; 

only one page, not linked to from anywhere, calls the custom search you
wrote. I don’t believe that ‘saved search’, however, saves the search
module used to generate the results. (Certainly, I didn’t see anyway to
specify that in the web UI, which was disappointing.) It would have been
cool, because I generally like the idea of the ‘RT at a glance’ page, and
would like to have had my custom search show up in it. My guess is that
the simplest way to do this is to customize the usual search
(RT/Search/FromSQL?) to recognized some magic constant in the input
TicketSQL and switch to the custom search when if finds it. (e.g.
“CustomSearch = ‘True’”).

In fact, it would be mighty cool if that became a part of RT's 

TicketSQL: “AND CustomSearch = ‘RT::Search::MyCustomSearch’”.

  • Todd Miller

    One implementation note: $self->TicketsObj->ItemsArrayRef() caches
    its results. Calling delete( $self->TicketsObj->{ ‘items_array’ } ) seems
    to be how to clear the cache, which was useful for debugging, and may be
    necessary (to get correct results); I don’t really understand the
    implementation.