Repository navigation
Add suggestChanges: turn pushed edits into tracked changes - #66
Conversation
Undo each edit without tracking, redo it with meta.tc. The text is unchanged, so a clone that pushed it has nothing to pull.
|
Thanks, this is an interesting one. Turning pushed edits into suggestions would help anyone who writes locally and reviews with co-authors on Overleaf. Since it writes to documents others are editing and relies on an undocumented format, I'd like to discuss the design in an issue first. Could you open one? Points to settle there:
I'll also run some tests of my own over the next few days, with a second account watching the document. I'll leave this PR open until then. |
|
As soon as I have a little time, I will open the design discussion. I mainly PR’d this in because it’s such a nice project and I am tweaking it on my side to work with a vs code extension; apologies for the blunt PRs. On 16 Nov 2026, at 03:14, Alexander Loth ***@***.***> wrote:aloth left a comment (aloth/olcli#66)
Thanks, this is an interesting one. Turning pushed edits into suggestions would help anyone who writes locally and reviews with co-authors on Overleaf.
Since it writes to documents others are editing and relies on an undocumented format, I'd like to discuss the design in an issue first. Could you open one? Points to settle there:
The meta.tc format (18 hex digits, seed plus counter): what we know and how we notice if Overleaf changes it.
The short window between the untracked undo and the tracked redo, when collaborators see the old text. Acceptable, or can both updates go out together?
history-ot docs: keep refusing, or find out how the editor requests tracking there.
Whether to mark it experimental at first, and whether it should get a CLI command or MCP tool later.
I'll also run some tests of my own over the next few days, with a second account watching the document. I'll leave this PR open until then.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
No need to apologize, your PRs were small, tested and easy to review. I'm really glad you sent this one, and I'm looking into it more closely now. I'll post what I find here. If you're short on time, there's no need to open a separate issue. We can keep the discussion in this PR. Good luck with the VS Code extension, happy to hear how it goes. |
|
I've tested this against overleaf.com with two accounts on a sharejs-text-ot project: one ran suggestChanges, the other had the doc open in the browser. In the collaborator's review panel each replacement shows up as a single "Changed: X to Y" entry with the author's name, like a suggestion typed in the editor, and accepting and rejecting it in the browser works. Overleaf's source confirms the meta.tc format. A few things came up:
I'll merge this and take care of these in a follow-up, so there's nothing more you need to do here. It will ship in 0.18.0. Thanks again for the idea and the careful PR. |
This is for edits that reach Overleaf as plain text, through
git push,olcli pushor a sync, from someone who would have liked them to be suggestions. Today the only way to get a tracked change is typing in the editor in Reviewing mode.Change
suggestChanges(projectId, path, edits)takes edits as old text, new text and some text around them. For each one it finds the new text in the doc (the match nearest to a position hint), undoes the edit without tracking, and redoes it as a tracked change by settingmeta.tcon the update, as the editor does in Reviewing mode. The text ends up exactly as it was, so a git clone that pushed the edit has nothing new to pull. An edit whose new text isn't on Overleaf yet comes back asnot-pushedand is left alone; one that matches neither text comes back asnot-found.It's sharejs-text-ot only. history-ot docs are refused with an error.
Tests
npm testgoes from 240 to 242. The tests stub the socket (no network): a pushed edit sends the untracked undo and then the tracked redo, with a 18-hex-digittcand consecutive versions; an unpushed edit and a missing one send nothing; history-ot is refused and the socket is closed. Lint is unchanged. CHANGELOG entry included.Live, on a scratch project: replacements, pure inserts and pure deletes (including non-ASCII text) show up in the editor as suggestions with my name, grouped as "Changed" like ones typed in the browser, and
git pullafterwards is a fast-forward with no content change.What I haven't verified
meta.tcformat (18 hex digits, ids are the seed plus a counter) is what I observed in the editor's updates; I haven't found it documented anywhere.CONTRIBUTING says to discuss bigger changes first, and this is a new feature. Happy to open an issue and move the discussion there if you'd rather.