Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-52583

libdeps graph linter: public that should be private



    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Server Development Platform


      from the document:

      Second only to removing edges that should not exist in impact, this is one of the key lint features we want to deliver. Reducing an edge from public to private means that the dependency no longer propagates transitively through the codebase. It also means that in environments that can use ABI driven (rather than out-of-date detection) relinks are greatly reduced, because private edges firewall the propagation of out-of-dateness when ABI is unaltered by a code change.


      Conceptually, the scenario isn’t hard to understand. If A declares a public dependency on Z, and A directly requires symbols from Z (e.g. not as a consequence of Z’s export from another dependency of A which A uses in its implementation), but use of A’s interface does not induce a dependency on Z on the client, then Z should be reduced from public to private in A.


      There is, as always, a wrinkle here. It may not be possible to tell, looking at the use of Z symbols in A, whether those symbols are because of direct use of Z symbols in A’s implementation, or whether those symbols are used because A is using B which uses Z in its interface. But it sort of doesn’t matter: if A’s use of B causes A to acquire dependencies on Z in its implementation but not its interface, then the linter will require that Z be public in B. But we assumed that use of A’s interface didn’t induce a dependency on Z. So one or both of B and Z will be private in A. But we can always safely recommend that any existing public Z dependency be moved to be private in A.




            backlog-server-devplatform [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
            daniel.moody@mongodb.com Daniel Moody
            0 Vote for this issue
            1 Start watching this issue