4,248 karma · joined Aug 13, 2010 (16y ago) · 545 submissions
comment 8mo ago · link · parent
For example, the debugging section is NOT about debugging problems inside Yjs, it's about debugging one's own bugs while one is using something like Yjs or prosemirror-collab. I'm normally a happy gambler but I actually think the Yjs GC algorithm probably does do what it says... indeed, my complaint is that I specifically do not want that behavior. :)
Likewise, the point I'm making about performance is NOT that Yjs is "slow". I'm saying that it's empirically very challenging to meet the 16ms perf budget even in the simplest possible realistic collab scenario... and that because of this, it is (1) very unappealing and (2) in our experience, challenging to attempt to do this when you also have to do a pile of extra things that are unrelated to the task at hand, like translate `Transaction` to and from operations on an XML doc, and deal with all the consequences of messed up positions passed to plugins. I do understand you have your own benchmarks that give you the confidence to (without qualifications) claim that y-prosemirror "runs at 60fps". You really are not curious about why we think that's not the case?
If we can't get to a shared understand what is being said here, it's going to be very hard to talk about it at all. And on the two material points at stack in your response, I believe you have the precise opposite understanding of what was written. I'm happy to keep discussing but it feels like we're starting from scratch after this response, again.
comment 8mo ago · link · parent
First, the fact that Yjs bindings, by design (for ~6 years), replace the entire document, does in my opinion, indicate a fundamental misunderstand what rich text editors need to perform well in any circumstance, not just collaborative ones. As I say in the article... I hope to be able to write another article that this has changed and they now "get" it, but for now I do not think it is appropriate to trust Yjs with this task for production-grade editors. I'm sorry to write this, but I do think it's true! I'm not trying to bag on anyone!
Second, and more material: to deploy Yjs to production in the centralized case, I think you are very much swimming against the current of its architecture. Just one example is permissions. There is no established way to determine which peers in a truly-p2p architecture have permissions to add comments vs edit, so you will end up using a centralized server for that. But that's not free, CRDTs are mechanically much more complicated! For example, you have to figure out how to disallow a user to make mark-only edits if they have "commenter" access, but allow editing the whole doc for "editor" access. This is trivial in `prosemirror-collab` (say) but it's very hard in Yjs because you have to map it "through" their XML transformations model.
I'm happy to talk more about this if it's helpful. But yes, we are trying to say some stuff about Yjs specifically, and some stuff about CRDTs generally.
comment 8mo ago · link · parent
Another important thing is that CRDTs by themselves cannot give you a causal ordering (by which I mean this[2]), because definitionally causal ordering requires a central authority. Funnily enough, the `prosemirror-collab` and `prosemirror-collab-commit` do give you this, because they depend on an authority with a monotonically increasing clock. They also also are MUCH better at representing the user intent, because they express the entirety of the rich text transaction model. This is very emphatically NOT the case with CRDTs, which have to pipe your transaction model through something vastly weaker and less expressive (XML transforms), and force you to completely reconstruct the `Transaction` from scratch.
Lastly for the algorithm you propose... that is, sort of what `prosemirror-collab-commit` is doing.
[1]: https://www.inkandswitch.com/peritext/
[2]: https://www.scattered-thoughts.net/writing/causal-ordering/
comment 8mo ago · link · parent
comment 8mo ago · link · parent
comment 8mo ago · link · parent
I think this is still reasonable to say because the final paragraph in that section is 100% about how they might fix the delete-all problem, and I hope they do, so that I can write about that, too. But also, that the rest of the article is going to be about how you have to swim upstream against their architecture to accomplish things that are either table stakes or trivial in other solutions.
comment 8mo ago · link · parent
Second of all, I actually think we're more aligned than it seems here. What we're really advocating for is being super clear about what your end-user goals are, and deriving technology decisions from them, instead of the reverse. Our goals for this technology are (1) users should be able to predict what happens to their data, (2) the editor always run at 60fps, and (3) we are reasonably tolerant of transient periods of disconnection (up to, say, 30s-1m).
Because of (1) in particular, a lot of our evaluation was focused on understanding which situations users would be unable to predict what was going to happen to their data. This is only our own experience, but what we found (and the impetus for part 1 of this series) is that almost 100% of the time, when there is a direct editing conflict, users interpret the results of the dominant CRDT and OT implementations as silently corrupting their data. So, the name of the game is to decrease the likelihood of direct editing conflicts, e.g. presence carets in the live-collab case. In particular, we did not notice a meaningful difference between how users view reconciliations of OT and CRDT implementations.
Since our users could not tell the difference, and in fact viewed all options as equally bad ("disastrous" as one user said), this freed us up to consider a much broader class of algorithms, including prosemirror-collab and prosemirror-collab-commit.
I know there is a rich history of why OT is OT, but our final determination was made pretty simple by the fact that the source of the majority of race conditions in our view come from the difficulty of integrating CRDTs and OT directly into modern editing stacks, like ProseMirror. As far as I am aware, prosemirror-collab-commit behaves as good or better on every dimension than, say, an OTTypes implementation would... and mostly that is because it is native to the expressive `Transaction` model of the modern editor. If we had to do interop I think we would have shipped something noticably worse, and much slower.
If you have a different experience I would love to hear about it, as we are perennially in the market for new ideas here.
comment 8mo ago · link · parent
comment 8mo ago · link · parent
In general, the client implementation of collab is pretty simple. Nearly all of the subtlety lies in the server. But it, too, is generally not a lot of code, see for example the author's implementation: https://github.com/ProseMirror/website/tree/master/src/colla...
comment 8mo ago · link · parent
If you are open to it, I'd love the opportunity to hear more. Here or email (alex@moment.dev) or our Discord (bottom right of our website) or Twitter/X... or whatever you prefer.
comment 8mo ago · link · parent
If you are using a centralized server and ProseMirror, there are several OT and pseudo-OT implementations. Most popularly, there is prosemirror-collab[4], which is basically "OT without the stuff you don't need with an authoritative source for documents." Practically speaking that means "OT without T", but because it does not transform the ops to be order-independent, it has an extra step on conflict where the user has to rebase changes and re-submit. This is can cause minor edit starvation of less-connected clients. prosemirror-collab-commit[5] fixes this by performing the rebasing on the server... so it's still "OT without the T", but also with an authoritative conflict resolution pseudo-T at the end. I personally recommend prosemirror-collab-commit, it's what we use, and it's extremely fast and predictable.
If you just want something pedogocically helpful, the blessed upstream collaborative editing solution for CodeMirror is OT. See author's blog post[1], the @codemirror/collab package[2], and the live demo[3]. In general this implementation is quite good and worth reading if you are interested in this kind of thing. ShareJS and OTTypes are both very readable and very good, although we found them very challenging to adopt in a real-world ProseMirror-based editor.
[1]: https://marijnhaverbeke.nl/blog/collaborative-editing-cm.htm...
[2]: https://codemirror.net/docs/ref/#collab
[3]: https://codemirror.net/examples/collab/
[4]: https://github.com/ProseMirror/prosemirror-collab
[5]: https://github.com/stepwisehq/prosemirror-collab-commit
comment 8mo ago · link · parent
It's hard to tell, but I think you also might be saying that criticizing the FOSS foundations of our product actually hurts the ecosystem. I actually am very open to that, and it's why we took so much time writing it since part 1 came out. But the Yjs-alternative technology we use is all also F/OSS, and we also do directly support it, with actual money from our actual bank account. All I'm recommending here is that others do the same. Sorry if that was not clear.
The rest of your reply, I'm not sure I grok. I think you might be suggesting that we are sock-puppeting `auggierose` or `skeptrune`, and that we are part of some (as you put it) "cult" of the Bay area! Let me be clear that neither of these things true. I don't know anyone at Mintlify personally, and in any event we are from Seattle not the Bay!
comment 8mo ago · link · parent
comment 8mo ago · link · parent
I think it's defensible to say that this point in particular is not indicting CRDTs in general because I do say the authors are trying to fix it, and then I link to the (unpublicized) first PR in that chain of work (which very few people know about!), and I specifically spend a whole paragraph saying I hope that I a forced to write an article in a year about how they figured it all out! If I was trying to be disingenuous, why do any of that?
comment 8mo ago · link · parent
BUT, since you mention it, I'll say a bit here. It sounds like you have your own experience, and we'd love to hear about that. But OUR experience was: (1) we found (contrary to popular belief) that OT actually does not require a centralized server, (2) we found it to be harder to implement OT exactly right vs CRDTs, and (3) we found many (though not all) of the problems that CRDTs have, are also problems in practice for OT—although in fairness to OT, we think the problems CRDTs have in general are vastly worse to the end-user experience.
If there's interest I'm happy to write a similar article entirely dedicated to OT. But, for (3), as intuition, we found a lot of the problems that both CRDTs and OT have seem to arise from a fundamental impedance mismatch between the in-memory representation of the state of a modern editor, and the representation that is actually synchronized. That is, when you apply an op (CRDT) or a transform (OT), you have to transform the change into a (to use ProseMirror as an example) valid `Transaction` on an `EditorState`. This is not always easy in either case, and to do it right you might have to think very hard about things like "how to preserve position mappings," and other parts of editor state that are crucial to (say) plugins that manage locations of comment marks or presence cursors.
With all of that said, OT is definitely much closer to what modern editors need, in my opinion at least. The less-well-known algorithm we ended up recommending here (which I will call "Marjin Collab", after its author) is essentially a very lightweight OT, without the "transformation" step.
comment 8mo ago · link · parent
EDIT: I will say I'm not against AI writing tools or anything like that. But, for better or worse, that's just not what happened here.
81.
Lies I was told about collaborative editing, Part 2: Why we don't use Yjs(moment.dev ↗)
272 points · by antics · 8mo ago · 160 comments
comment 9mo ago · link · parent
comment 9mo ago · link · parent
I'm not going to be the one to shut them out of this change. We will work to help both of these audiences.
comment 9mo ago · link · parent
For (1), programmability is why our templates[1] are generally so rich. See, e.g, our NES emulator[2] or our SQLite Explorer[3], both of which would be vastly harder to accomplish in Notion. It's even much harder in Obsidian, which is Markdown-first! Both templates took ~30 minutes of work with `claude`, and to do something similar with their respective extension APIs would have take orders of magnitude more time, especially to publish.
For (2), actually-working live collaborative editing is pretty hard to come by on Markdown-based docs editors. If you don't think you need this, the offering will be less compelling. My opinion is that many people who think they don't need this in a team setting end up being surprised how big a barrier this is when they try to use Obsidian as the central knowledge base for a team setting. Notion is extremely buggy and sometimes very slow, but in almost all cases I've seen, that ends up being worth the trade-off of not having to write code or get everyone to use the exact same extension set. Just my 2 cents though.
[1]: https://www.moment.dev/templates
[2]: https://www.moment.dev/templates/75ovowgp6jnv6lofwu60bx1d1
[3]: https://www.moment.dev/templates/4m8zt4ne0bnqfb4hjtcwm2fob
comment 9mo ago · link · parent
And sometimes I don't! Sometimes I just want to add a graph of customer churn from a ClickHouse query directly into a PRD, and just say who has access to run it, so the proxy can enforce it. Or I want to put a release button into the document that documents the release process. Sometimes I want a collaboratively-editable document that just happens to be enriched with a little bit of personalized UI.
comment 9mo ago · link · parent
For the other points: yes, we aspire to do all of those things. :)
87.
Show HN: We want to displace Notion with collaborative Markdown files(moment.dev ↗)
29 points · by antics · 9mo ago · 14 comments
88.
Collaborative editing with AI is hard(moment.dev ↗)
6 points · by antics · 10mo ago · 1 comment
comment 1y ago · link · parent
Man, sometimes I feel like I live on a different planet. I have been using GitHub since 2010 and—while I really wish I had a nicer way of putting this—I cannot remember a time when all of the flagship products were not uniformly either worst-in-class or close to it. Code review/PRs, issues, code search, CI, a real enterprise offering, and now AI features: all of these offerings had gaps serious enough to instigate real, threatening upstarts, and some of those upstarts were themselves big enough to become public companies. Seriously. A viable path to IPO from 2013 to (say) 2019 was literally "make a version of a GitHub feature that simply does not suck."
I loved GitHub in 2010. I also remember those years, 2013 to 2019, being essentially totally lost, with no meaningful product movement at all. Am I truly alone in this? What is this Andrew talking about here?
I'm not going to defend the Microsoft acquisition, but at least—excruciatingly slowly—things like code review and issues are finally starting to receive features. It's crazy to say it out loud but that is what I see.
I just can't help but think the product "enshittification" narrative here is an ex post justification of the author's own feelings.
comment 1y ago · link · parent
Whether “that thing” is about to be sampling is not for me to say. The probability is certainly not 0 though.