← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/system-bug-comments-api into lp:launchpad

 

The proposal to merge lp:~sinzui/launchpad/system-bug-comments-api into lp:launchpad has been updated.

Description changed to:

A bug message is accessible over the API via two approaches. Iterating
over bug.messages or directly loading the message via its URL (eg, +bug/1004834/comments/2). The latter case can oops with NoCanonicalUrl (OOPS-2f0df95d0ba20796d46cfe2a1b3c3fa1) because the parent
message is not one of the bug's messages, it it does not have an index number.
bug.message returns IIndexedMessage which sets the parent to None to enforce
non-threaded messaging in bugs, but the latter case an IMessage which is
threaded. Both IIndexedMessage and IMessage claim to be bug messages, but
we know that the DB is storing all messages in the table.

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

RULES

    Pre-implementation: no one
    * IMessage was exported as an accident of exporting bug messages, and
      they are now permanently in the API. They claim to just be bug messages
      as can be seen by their URL.
    * Since bug messages are not threaded, and we cannot unexport the
      parent attribute, we can follow IIndexedMessage's example by ensuring
      None is the value returned.
    * Export a replacement parent attr on the API that retrofits the beta
      api to return None.

QA

    * visit https://api.qastaging.launchpad.net/devel/ubuntu/+source/request-tracker3.8/+bug/1004834/comments/2
    * Verify the page loads.

LoC

    I have a 16,000 line credit this week.

LINT

    lib/lp/bugs/tests/test_bug_messages_webservice.py
    lib/lp/services/messages/interfaces/message.py
    lib/lp/services/messages/model/message.py

TEST

    ./bin/test -vvc -t MessageTraversal lp.bugs.tests.test_bug_messages_webservice

IMPLEMENTATION

I added getAPIParent to IMessage and exported it using accessor_for(parent)
to ensure the API never sees a parent message.
    lib/lp/bugs/tests/test_bug_messages_webservice.py
    lib/lp/services/messages/interfaces/message.py
    lib/lp/services/messages/model/message.py

For more details, see:
https://code.launchpad.net/~sinzui/launchpad/system-bug-comments-api/+merge/137308
-- 
https://code.launchpad.net/~sinzui/launchpad/system-bug-comments-api/+merge/137308
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/system-bug-comments-api into lp:launchpad.


References