HomePhabricator

Materialize parent project memberships

Description

Materialize parent project memberships

Summary:
Ref T10010. Subprojects have the following general membership rule: if you are a member of a subproject ("Engineering > Backend"), you are also a member of the parent project.

It would be unreasonably difficult to implement this rule directly in SQL when querying withMemberPHIDs(), because we'd have to do an arbitrarily large number of arbitrarily deep joins, or fetch and then requery a lot of data.

Instead, introduce "materailized members", which are just a copy of all the effective members of a project. When a subproject has a membership change, we go recompute the effective membership of all the parent projects. Then we can just JOIN to satisfy withMemberPHIDs().

Having this process avialable will also be useful in the future, when a project's membership might be defined by some external source.

Also make milestones mostly work like we'd expect them to with respect to membership and visibility.

Test Plan:

  • Added and executed unit tests.
  • Changed project members, verified materialized members populated correctly in the database.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

Differential Revision: https://secure.phabricator.com/D14863

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Dec 23 2015, 10:39 PM
Reviewer
chad
Differential Revision
D14863: Materialize parent project memberships
Parents
rP70f6bf306f24: Implement child/descendant query rules in Projects
Branches
Unknown
Tags
Unknown
Tasks
T10010: Implement Subprojects
Build Status
Buildable 9759
Build 11723: Run Core Tests