Add visibility_level to fork network data model
Problem to solve
If a public project fast-inc/project-zing
is forked to james/project-zing
, and then the public project fast-inc/project-zing
is made private, the relationship between the two projects is not broken.
This doesn't matter because we only deduplicate objects from the root (fast-inc/project-zing
) if it also public. But we want to implement deduplication for internal and private projects.
Further details
In a fork network, the root may change it's visibility freely, but the forks may not. A fork of an internal project must stay be internal or private, and the fork of a private project must be private.
Here is a diagram showing that the root and forks share objects from the pool. If they are all at the same access level (public or internal) this is fine
However, if the root was public, and then became internal, which is allowed. Then internal data could be leaked to a public repo for the world to see.
graph TD
Pool-.->|alternate|Root
Root-->|dedupe to pool|Pool
Pool-.->|alternate|A[Fork A]
Pool-.->|alternate|B[Fork B]
If the root project changes in visibility:
- making it more open (e.g. private to public), will not change the visibility of existing forks, but will allow them to be made more public
- making it less open (e.g. public to private), will change the visibility of existing forks to match (e.g. make them all private)
Proposal
I don't think we can nominate one as the root blindly. I think it might be easier to grasp if we defined a visibility level on a fork network on its creation, then all projects within that fork network must have visibility lower than, or equal to that visibility level (we already do this, but without it being set on the network). What do you think about this:
If the root of the fork-network raises its visibility level, then the visibility level for the fork network is raised. No problem here.
If the root of the fork network lowers its visibility level, then it effectively leaves the fork network, and the visibility level of the fork network becomes public
.