Merge lp://staging/~sinzui/launchpad/dsp-vocab-fixes into lp://staging/launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 14711
Proposed branch: lp://staging/~sinzui/launchpad/dsp-vocab-fixes
Merge into: lp://staging/launchpad
Diff against target: 75 lines (+26/-11)
2 files modified
lib/lp/registry/tests/test_dsp_vocabularies.py (+15/-2)
lib/lp/registry/vocabularies.py (+11/-9)
To merge this branch: bzr merge lp://staging/~sinzui/launchpad/dsp-vocab-fixes
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+89505@code.staging.launchpad.net

Description of the change

Allow users to find official unpublished packages in the target picker.

    Launchpad bug: https://bugs.launchpad.net/bugs/919413
    Pre-implementation: no one

On qastaging, where the DSP vocabulary is enabled, I expect to search
for charms/mysql and get an exact match when choosing a package affected
by a bug. The picker says there are no matches.

The problem is obvious looking at the implementation, the SQL joins to
DistributionSourcePackageCache to get rich package information, but
unpublished packages will never appear in the table. This is a
palm-in-face moment for me because 1. I insisted we extend DSP to do
searches because official packages may never be published, yet 2, I
wrote the SQL query that joins to a table predicated on publishing. The
query/scoring of results should use SourcePackageName.name instead of
dspc.name because the former is guaranteed to exist

--------------------------------------------------------------------

RULES

    * Join on spn, left join to dspc.
    * Use the spn.name in scoring

QA

    * Visit https://bugs.qastaging.launchpad.net/launchpad/+bug/741639
    * Expand the affects row.
    * Choose to pick a package.
    * Search for 'charms/mysql' (this is an official unpublished package)
    * Verify the results show a match, but there is no binary packages
      listed in the description

LINT

    lib/lp/registry/vocabularies.py
    lib/lp/registry/tests/test_dsp_vocabularies.py

TEST

    ./bin/test -vv -t lp.registry.tests.test_dsp_vocabularies

IMPLEMENTATION

The addition of spn and changing dspc was near trivial. The test passed
after a fix of a few typos. The second test fix took much longer because
I was certain the test was correct and my SQL changes were bad. The test
was flawed. It created *two* packages, on official unpublished package
and a second unofficial package in a PPA. It was passing because of the
joins, but it should have failed because there was a matching official
package. The correction is to ensure that only one unofficial package is
created.
    lib/lp/registry/vocabularies.py
    lib/lp/registry/tests/test_dsp_vocabularies.py

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Looks nice Curtis. You have a typo in your test method name: offcial.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.