Expose API to find Blueprints associated with a Bug

Bug #1321338 reported by John Agosta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

Problem Statement:
We have a development process where every LP Bug must have an associated Blueprint. We have a *master* project and many sub-projects. The master project holds all the Blueprints for sub-projects. What I would like to determine is "do I have any Bugs without a Blueprint?"

Ultimately, I would like to generate an offline report that shows the Bug detail and any Blueprint the Bug is related to (or not related to).

The LP API to extract Blueprint data is not currently exposed in the API documentation.

Request:
Please expose the API to allow locating the blueprints for a Bug.

Tags: api trivial
Colin Watson (cjwatson)
tags: added: api trivial
Changed in launchpad:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Colin Watson (cjwatson) wrote :

While it might well make sense to export this anyway, given this description, it's possible that your task would actually run faster the other way round, which only requires currently-exported API. You probably have fewer blueprints than bugs, so you could iterate over all your blueprints and get the collection of linked bugs for each one more quickly than you could iterate over all your bugs and find any linked blueprint for each one.

Something like:

  all_bugs = set(project.searchTasks())
  bugs_with_blueprints = set()
  for spec in project.valid_specifications:
      bugs_with_blueprints.update(spec.bugs)

Then the difference between all_bugs and bugs_with_blueprints is the answer to your question. (And of course you could also use project.searchTasks(linked_blueprints="Show only Bugs without linked Blueprints").)

For the full report, likewise, you could do something like:

  bug_to_blueprint = {}
  for spec in project.valid_specifications:
      for bug in spec.bugs:
          bug_to_blueprint[bug] = spec

This wouldn't make sense if you were looking at a more limited set of bugs, but for everything in the project it's probably reasonable.

Revision history for this message
John Agosta (jagosta) wrote :

What adds to the complexity here is that I have 8 projects (today, expect more) and all the bugs in this project reference blueprints in another project.

so it is more of
all_bugs = set(project1.searchTasks()) + set(project2.searchTasks()) ... set(projectN.searchTasks())

So, this is a little more complext than what I wanted to do now as a G-job, but it is something I can look into later.

Regarding : project.searchTasks(linked_blueprints="Show only Bugs without linked Blueprints")
Ah, this will definitely be helpful to generate a quick report to ensure the QA of my LP bugs. Thanks for this tip.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.