This commit is contained in:
Joey Hess 2013-04-27 13:00:57 -04:00
parent cfaee41cf4
commit 8626e67e97

View file

@ -1,7 +1,7 @@
The way [[XMPP pairing|design/assistant/XMPP]] currently works, each The way [[XMPP pairing|design/assistant/XMPP]] currently works, each
separate repository needs to use a different XMPP account. If two separate repository needs to use a different XMPP account. If two
repositories use the same XMPP account, then they will be combined together repositories use the same XMPP account, then they will be combined together
than XMPP pairing takes place. when XMPP pairing takes place.
There are two different UIs for XMPP pairing. While the same protocol There are two different UIs for XMPP pairing. While the same protocol
is running behind the scenes, these UIs should be considered separately. is running behind the scenes, these UIs should be considered separately.
@ -35,41 +35,61 @@ a reasonable requirement.
## Share with a friend ## Share with a friend
Suppose that Alice wants to share with Bob. Bob is using the same XMPP Suppose that Alice wants to share with Bob. Bob is using the same XMPP
account for two separate repositories, that are not themselves paired. account for two separate repositories (B1 and B2), that are not
themselves paired.
When Alice chooses to share with Bob, a XMPP pair request is sent. When Alice chooses to share with Bob, a XMPP pair request is sent.
Both of Bob's repositories see it, and both ask him to confirm. Both of Bob's repositories see it, and both ask him to confirm.
Bob can choose to only confirm the request in one repository, and Bob can choose to only confirm the request in B1, and
not in the other. This should work ok. not in B2. This should work ok.
* The UI for this only says "Pair request received from #{name}", * The UI for this only says "Pair request received from #{name}",
it does not indicate which repository of Alice's is being paired it does not indicate which repository of Alice's is being paired
with. This could be improved. If Alice has two repositories as well, with. This could be improved. If Alice has two repositories as well,
she and Bob will want to coordinate pairing the right ones together. she and Bob will want to coordinate pairing the right ones together.
Could be fixed by just displaying the description of Alice's repisitory Could be fixed by just displaying the description of Alice's repository
to Bob. to Bob.
----- -----
Now, suppose that Alice makes a second, distinct repository, and chooses to Now, suppose that Alice makes a second, distinct repository (A2),
share it with Bob (intending to share with his second repository). This and chooses to share it with Bob (intending to share with B2). This
sends an XMPP pair request to both of Bob's repositories. sends an XMPP pair request to both of Bob's repositories.
One of Bob's repositories has already paired with Alice, so it assumes this B1 has already paired with Alice, so it assumes this
new pair request is from a different device belonging to Alice, and it new pair request is from a different device belonging to Alice, and it
automatically ACKs the pair request. automatically ACKs the pair request.
The result is that Alice's new repository combines with Bob's repository, The result is that Alice's new A2 repository combines with B1,
which is already combined with Alice's old repository. Effectively which is already combined with A1. Effectively combining all of A1, A2, B1,
combining both her repositories, unexpectedly. **This is a bug**. and B2, unexpectedly. **This is a bug**.
1. I think this could be fixed by simply not auto-accepting pair requests Some possible fixes:
1. Stop auto-accepting pair requests
from friends we're already paired with. Require another confirmation. from friends we're already paired with. Require another confirmation.
2. Or, only auto-accept pair requests from friends we're already paired with 2. Or, only auto-accept pair requests from friends we're already paired with
when they come from a repository whose UUID we already know. This when they come from a repository whose UUID we already know. This
enhancment to fix #1 makes it easier to build more robust networks of enhancment to fix #1 makes it easier to build more robust networks of
repositories. repositories.
3. Alternatively, we could say that the problem is that Bob has two
Hmm, I don't think those fixes are sufficient. Suppose they're in place.
Then when Alice shares A2 with Bob, both his repositories will ask him to
confirm the pair request. He confirms in B2, and pairing proceeds.
But, XMPP git push is broadcast to all clients of an XMPP account.
So when B2 sends a push, A1 sees it, and happily merges away. The
repositories still combine!
So, we need another fix:
* Send UUID in XMPP git push protocol messages. Only respond to git push
messages from a known UUID, and ignore all others. (XMPP pairing
already sends the UUID, so it will be known.)
----
* Alternatively, we could say that the problem is that Bob has two
distinct repositories using the same XMPP account, and try to prevent distinct repositories using the same XMPP account, and try to prevent
him from doing that in the first place. him from doing that in the first place.