merge causes OOPs in Person:+participation by introducing missing key in getPathsToTeams()

Bug #676494 reported by Curtis Hovey
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
j.c.sackett

Bug Description

OOPS-1781EC1703 and OOPS-1781O1961 are two examples where the page fails to render because the team or person in the graph has disappeared. There where 32 of these the day before the 10.11 release.

/srv/launchpad.net/production/launchpad-rev-11926/lib/lp/registry/browser/../templates/person-participation.pt object at 0x13e25410>, 'has_participations', [])
  Module lp.services.propertycache, line 116, in __get__
    value = self.populate(instance)
  Module lp.registry.browser.person, line 3341, in has_participations
    return len(self.active_participations) > 0
  Module lp.services.propertycache, line 116, in __get__
    value = self.populate(instance)
  Module lp.registry.browser.person, line 3314, in active_participations
    paths, memberships = self.context.getPathsToTeams()
  Module lp.registry.model.person, line 2289, in getPathsToTeams
    step = graph[step]
KeyError: <Person at 0x18d0ba50 adana-team (Adana Team)>

Related branches

Curtis Hovey (sinzui)
summary: - Missing key in getPathsToTeams()
+ Person:+participation missing key in getPathsToTeams()
j.c.sackett (jcsackett)
Changed in launchpad-registry:
assignee: nobody → j.c.sackett (jcsackett)
Revision history for this message
Curtis Hovey (sinzui) wrote : Re: Person:+participation missing key in getPathsToTeams()

I believe this issue relates to bug 651210 [Spurious entries in TeamParticipation]. I suspect this is an exacerbation of an older issue with merge.

The getPathsToTeams() method gets all the TP entries for the IPerson, filter out self, then builds a graph of all the TeamMemberships for the TP.team ids. *But* the graph cannot be built because the TP key is not in the TM data.

In the last few days, ~canonical-mobile, ~ubuntu-cl-website, and ~ubuntu-cl-dev teams were deleted. I believe merge is broken because ~registry should not be members of super teams that the deleted teams belonged to (/me struggles to keep ~registry's memberships sane). Delete uses revokeTeamMembership() for all direct team memberships before doing completing the merge.

The expectation is that all TP entries are correct before the merge process starts. The _mergeTeamMembership() step does work with both TM and TP, but maybe it fails because the data changes are not flushed to the db. TP has triggers; maybe the db is not in the state we think.

tags: added: merge-deactivate
j.c.sackett (jcsackett)
summary: - Person:+participation missing key in getPathsToTeams()
+ merge causes OOPs in Person:+participation by introducing missing key in
+ getPathsToTeams()
Revision history for this message
Curtis Hovey (sinzui) wrote :

We see a number of problems in the execution chain that needs fixing.

* AdminTeamMergeView.deactivate_members_and_merge_action
  removes the team members, call flush_database_updates, then
  call doMerge that removes the super teams. flush_database_updates is
  not called.
  ! This is why the super teams were transferred to ~registry later
    in Person._mergeTeamMemberships().
  ! Moved the remove members and flush call to the do merge method so
    all the setup operations happen in the expected order.

* Person._mergeTeamMemberships() was never intended for teams; the view
  aborted merge. There is already a guard to ensure a team with members is
  not passed.
  ! Add an assert in the merge() method to ensure it fails if the team has
    super teams.

* Person.deactivateAllMembers() used a single db calls to remove the members,
  but only the direct entries in TeamParticipation are deleted. The indirect
  entries are not removed. This issue overlaps with bug 651210
  ! This is why getPathsToTeams() in +participation fails.
  ! The Person.teams_participated_in can be adapted to provide a complete set
    of entries that must be removed for all team members.

Curtis Hovey (sinzui)
Changed in launchpad-registry:
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
tags: added: qa-needstesting
Changed in launchpad-registry:
status: In Progress → Fix Committed
Revision history for this message
j.c.sackett (jcsackett) wrote :

The branch landed seems to address issues related to this, but qa shows there's still something going wrong. Tagging it as incremental and in progress; there's a chance this has something to do with triggers on TP, not the code addressed in the branch.

tags: added: incr
removed: qa-needstesting
Changed in launchpad-registry:
status: Fix Committed → In Progress
tags: added: qa-ok
removed: incr
Revision history for this message
j.c.sackett (jcsackett) wrote :

Switched to qa-ok from 'incr'; mixing up my landing directives with bug tags. Bug is still in progress.

Curtis Hovey (sinzui)
Changed in launchpad-registry:
milestone: 10.12 → series-future
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
Changed in launchpad-registry:
milestone: series-future → none
tags: added: qa-needstesting
removed: qa-ok
Changed in launchpad-registry:
status: In Progress → Fix Committed
j.c.sackett (jcsackett)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in launchpad:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
milestone: none → 11.01
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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