Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ward/relative move #52

Merged
merged 3 commits into from
Aug 6, 2014
Merged

Ward/relative move #52

merged 3 commits into from
Aug 6, 2014

Conversation

WardCunningham
Copy link
Member

This pull request is motivated by the drag-and-drop merging of journals. This has turned out to be a lot more work than expected, mostly due to carelessly conceived unit tests that confused more than illuminated my work. I've chosen to use the node-server implementation as the definition of 'correct' where it and the unit tests disagreed.

I've replaced the unit tests with smaller and more comprehensive tests based on a situation modeling language which is itself tested as a prolog to the tests. For example, here we create a page with three items:

data = Fixture
  story: [3, 1, 2]
  journal: ['a1', 'a21', 'a3']

This says: the story is to be three paragraphs, t1, t2, and t3. These are created by adding t1, then t2 after t1, and then t3 at the beginning (after nothing). A reasonable test would be to retrieve the final version and verify that the paragraphs are indeed in the order t3, t1, t2.

With good tests the modifications to lib/revision.coffee were straightforward.

This error computing revisions from the journal would cause
a reconstruction to be incorrect if there were any add to 
the first position of the story. This must be unlikely because
it hasn't been noticed.

Client now agrees with server. Both ruby and node versions
already agreed.
We construct a relative address for a move action from the
item id ordering provided by the move action.

The relative address identifies what item the moved item will follow.

Notice that this approach is only used client-side. The servers
can continue applying moves as they always have.

The two methods should be equivalent when retrieving older revisions
from the version history so long as the history follows a single thread.

The relative form allows us to mash multiple histories together and then
'fork' the resulting construction over top of once single-threaded versions.
paul90 added a commit that referenced this pull request Aug 6, 2014
@paul90 paul90 merged commit a6442fa into master Aug 6, 2014
@WardCunningham WardCunningham deleted the ward/relative-move branch August 6, 2014 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants