152 Commits

Author SHA1 Message Date
Jakob Ackermann
b62d4814c3 [monorepo] turn throw statements in callback code into callback calls (#33524)
* [eslint-plugin] add rule for throw inside callback code

* [monorepo] enable our custom eslint plugins globally

* [monorepo] fix running make lint from root

* [monorepo] turn throw statements in callback code into callback calls

* [monorepo] add eslint-plugin libraries to all the Dockerfiles

* [monorepo] install eslint-plugin library at the root level

* [linked-url-proxy] add eslint-plugin library into Dockerfile

* [latexqc] add our eslint-plugin to eslint config

GitOrigin-RevId: b05e3ebbefb62370f2422e83880dd3913815270d
2026-05-14 08:05:47 +00:00
Malik Glossop
7bf7102b98 Merge pull request #32712 from overleaf/mg-recreate-corrupted-blob
Recover from corrupted blobs during hard resync

GitOrigin-RevId: 7cc764e3bcc8557689c040c8f042991d97f897bc
2026-05-11 08:06:15 +00:00
Mathias Jakobsen
a478c1a829 [web+project-history] Add lastResyncedAt field to projects and set after resync (#33240)
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: f679a190b88694a46f7816d51eff96446f338dec
2026-04-30 08:06:43 +00:00
Malik Glossop
da027f46cf Merge pull request #32530 from overleaf/mg-stuck-sync-repro
Detect and auto-clear stuck sync states

GitOrigin-RevId: 680861a33e42432dab7d40ad421980b707eb6089
2026-04-29 08:05:33 +00:00
Jakob Ackermann
6117feef1b [chat] clone comment threads when cloning project with ranges (#32852)
* [project-history] add best effort flush when cloning project

* [web] update labels in clone project modal for admins

* [project-history] do not shadow history flush failure

* [web] fix accessible label for 'Add comment' button

* [chat] clone comment threads when cloning project with ranges

GitOrigin-RevId: ef30204c8a94b3d6204d56dcca2f62a46319996b
2026-04-17 08:07:03 +00:00
Mathias Jakobsen
cae558af69 Merge pull request #32779 from overleaf/mj-project-history-bug
[project-history] Fix broken ranges from history resync

GitOrigin-RevId: c839e1d187768b7ce3411d06f78f017ebf7fec6e
2026-04-17 08:05:42 +00:00
Jakob Ackermann
3dc8899334 [web] add admin page for project history failures (#32751)
GitOrigin-RevId: c9564e07239b761851c9a86894f9ef3023dfcf2b
2026-04-15 08:05:57 +00:00
Jakob Ackermann
7faa4c5db4 [project-history] normalize failure messages (#32748)
* [project-history] normalize failure messages

* [project-history] add tests for normalizing failure messages

GitOrigin-RevId: ec15fdba97215047067c10c3fd16ad64696af20b
2026-04-15 08:05:53 +00:00
Jakob Ackermann
5a6c066847 [web] allow admins to clone projects with ranges and entire history (#32739)
* [web] add consistent aria-label to editing/reviewing toggle

* [docstore] add endpoint for getting all docs with ranges

* [history-v1] fix schema of chunkId when deleting old history chunk

* [web] skip duplicate project lookup for resolving rootDocPath

* [web] ignore new limits for root doc path when making debug copy

* [web] allow admins to clone projects with ranges and entire history

* [web] fix tests

* [history-v1] re-order params for cloning project

* [web] fix duplicate import of logger after merge

* [project-history] re-order params for cloning project history metadata

GitOrigin-RevId: 7fa35b4f90885dd453150a348d491ba0ec8de412
2026-04-15 08:05:49 +00:00
Eric Mc Sween
77952e5d21 Merge pull request #32628 from overleaf/em-bg-history-bug
Prevent incorrect merging of ops with different hpos offsets

GitOrigin-RevId: d171a93dcb29e952c7105afd81c3b29ca7e9788e
2026-04-08 08:05:03 +00:00
Domagoj Kriskovic
332588826d [project-history] Fix for invalid range Error (#32198)
* [project-history] Invalid range Error WIP

* Clamp tracked deletes to retention range to prevent negative positions

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GitOrigin-RevId: 408da6fff99b6c413af3d18fa4c399d88ca5f2a2
2026-04-01 08:06:15 +00:00
Jakob Ackermann
ad508b1882 [project-history] migrate simple request usages to fetch-utils (#32539)
* [project-history] remove unused getQueueCounts in tests

* [project-history] migrate simple request usages to fetch-utils

GitOrigin-RevId: 0e299a9d2ea968b87d7f0f2fc1626393ca4e4fdc
2026-04-01 08:05:41 +00:00
Jakob Ackermann
8a67258461 [project-history] remove unused DocumentUpdaterManager (#32537)
GitOrigin-RevId: f2806187e2ae4e768f48a724712daffd4168e4fb
2026-03-31 08:07:43 +00:00
Jakob Ackermann
a8abc22e6c [web] extend project admin page for history debugging (#32437)
* [web] extend project admin page for history debugging

* [web] address review feedback

Co-authored-by: Malik <malik.glossop@overleaf.com>

---------

Co-authored-by: Malik <malik.glossop@overleaf.com>
GitOrigin-RevId: 01866e8c8529bc8332c49baf4ad281e300f8cdd4
2026-03-27 09:05:52 +00:00
Jakob Ackermann
adef5b26fb [web] gracefully handle broken histories when compiling from history (#32386)
* [web] gracefully handle broken histories when compiling from history

* [web] trim down schema

GitOrigin-RevId: 97d59b31eb25644d7de1194a45281def6982b130
2026-03-24 09:06:18 +00:00
Jakob Ackermann
209f660435 [monorepo] remove endpoints for generating a fake error (#31679)
GitOrigin-RevId: d424881e6ebca157b81344705670021677f856de
2026-02-20 09:06:13 +00:00
Jakob Ackermann
7c70b749d4 [monorepo] remove PII and variables from error messages (#31508)
* [monorepo] remove PII and variables from error messages

Exclusions:
- scripts
- tests
- fuzzing
- SplitTestManager (messages are sent to admin frontend)
- Group setup (we may want an error per unique tuple)
- sharejs (unused types; text type errors are shadowed already)
- history-v1 error messages that are used by the ErrorRecorder
- errors that flag issues with configuration/call signatures

I've used these search terms for finding unwanted error messages:
- new Error(`
- new Error\(\n\s+` (regex search)
- new OError(`
- new OError\(\n\s+` (regex search)

* [web] throw NotFoundError from ProjectLocator

* [github-sync] fix OError.tag call in script

Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com>

* [templates] revert changes to test client

---------

Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com>
GitOrigin-RevId: 736857a4fc5d9bfb0f8cb03e0f004eda87e5a220
2026-02-17 09:05:04 +00:00
Domagoj Kriskovic
9bd7171413 [project-history] update getProjectBlobSchema to accept numeric history_id
GitOrigin-RevId: b38d8c9e279e227975a12662d3f0c9e0d21cc1bd
2026-02-02 09:05:33 +00:00
Domagoj Kriskovic
4d6c1138c7 rename validateReq to parseReq
GitOrigin-RevId: 26d1a3adf0793a4f80a919707850477db5374b8d
2026-02-02 09:05:24 +00:00
Domagoj Kriskovic
859c21b4dd [project-history] update schemas to accept numeric project IDs
GitOrigin-RevId: 4dac763223f42eb772c30f34e0da0d22464055dd
2026-02-02 09:05:20 +00:00
Domagoj Kriskovic
da9da896c2 Revert "Revert "[project-history] migrate from joi to zod (#30187)" (#30681)"
This reverts commit 8d66aa15a29216736755c3f86954a4d40aa20a6c.

GitOrigin-RevId: 9d56dafff3da5202204ead896bed30182cc2aceb
2026-02-02 09:05:15 +00:00
Domagoj Kriskovic
da7569e892 Revert "[project-history] migrate from joi to zod (#30187)" (#30681)
This reverts commit f8396a3caadd536edf64c6f971c77f4c941f000a.

GitOrigin-RevId: 8d66aa15a29216736755c3f86954a4d40aa20a6c
2026-01-13 09:07:22 +00:00
Domagoj Kriskovic
6d3dd3601a [project-history] migrate from joi to zod (#30187)
* Add @overleaf/validation-tools in project-history

* use error handler for zod

* Replace joi validations with zod schema

* fix unit tests

* remove Joi validation middleware

* remove optional when there is a default

* fix tests after checking for objectid

* ran build_scripts

* monorepo npm install

GitOrigin-RevId: f8396a3caadd536edf64c6f971c77f4c941f000a
2026-01-13 09:07:00 +00:00
Domagoj Kriskovic
484a01a173 Use history snapshot when doing file/project restore (#28502)
* Add getDocUpdaterCompatibleRanges utility function

* use history snapshot for file/project restore

* move overleaf-editor-core from devDependencies

GitOrigin-RevId: 62481a5304ada9d931e018418be3c0719bccf1f3
2025-09-19 08:07:58 +00:00
Eric Mc Sween
8f0913fafe Merge pull request #27936 from overleaf/em-unit-tests-mongo
Make Mongo available to unit tests in all services

GitOrigin-RevId: b65bbb69883d5bba31d09802b89f35bdc523fe4d
2025-08-25 08:05:19 +00:00
Jakob Ackermann
adf399fb95 [project-history] add support for resync of history-ot ranges (#26475)
* [project-history] add support for resync of history-ot ranges

* [project-history] avoid compressing sharejs and history-ot upgrades

* [document-updater] improve error message of some assertions

... by migrating the assertions like this:
```diff
-stub.calledWith().should.equal(true)
+stub.should.have.been.calledWith()
```
```diff
-stub.called.should.equal(false)
+stub.should.not.have.been.called
```

* [document-updater] move content field in resyncDocContent

* [document-updater] add support for resync of history-ot ranges

GitOrigin-RevId: e6104686a26934a5f25a8f095cbe00c163fbbaa7
2025-06-19 08:05:18 +00:00
Jakob Ackermann
0aa56fbe2c [project-history] fix callback signature when processing no updates (#26420)
* [project-history] fix tests and cover callback for processing updates

The before setup was hiding that some tests were not doing what the
assertions were expecting.

* [project-history] fix callback signature when processing no updates

GitOrigin-RevId: 4fa14d47b9a1afd998316b0c9024d49760785a47
2025-06-16 08:06:36 +00:00
Jakob Ackermann
6f516b25af [project-history] add metrics for compression of updates (#26307)
* [project-history] add metrics for compression of updates

* [project-history] sample compression metrics

GitOrigin-RevId: 1cd67dc4ec7b44285afb436c62392b464f007f97
2025-06-16 08:06:28 +00:00
Jakob Ackermann
4aaf411cd2 [misc] improve logging in history system (#26086)
* [project-history] tag all the errors

* [history-v1] log warnings for unexpected cases

GitOrigin-RevId: 3189fa487eee88985688ff990ec101daad0d13b1
2025-06-04 08:05:50 +00:00
Jakob Ackermann
64984ee86a [history-ot] flush history for projects with short queues ASAP (#25776)
* [document-updater] flush history for projects with short queues ASAP

* [k8s] document-updater: enable short history queue for history-ot demo

* [project-history] flush history for projects with short queues ASAP

* [project-history] wait for mongo before running acceptance tests

* [k8s] project-history: enable short history queue for history-ot demo

* [project-history] change wait-for-mongo step in tests

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

---------

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
GitOrigin-RevId: 3e989c409e8e9887655b35f2659ce0829e61b357
2025-05-23 08:05:35 +00:00
Jakob Ackermann
1e6b13f9d5 [history-ot] rename remaining history-v1-ot references to history-ot (#25428)
* [history-ot] rename remaining history-v1-ot references to history-ot

* [web] rename History-v1 OT -> History OT in admin panel

* [web] rename OT Migration -> History OT Migration in admin panel

GitOrigin-RevId: 103ce816d5320d6379d51009cdc08b8a71aa48e6
2025-05-20 08:06:46 +00:00
Brian Gough
6eada92966 Merge pull request #25406 from overleaf/em-content-hash-validation-resync
Resync project when content hash validation fails

GitOrigin-RevId: ea9b5a78f89c55276fd67835bc262717bc778e92
2025-05-09 08:05:12 +00:00
Jakob Ackermann
e8b5ee2ff9 [history-ot] initial implementation of using doc-level history-ot (#25054)
* [history-v1-ot] initial implementation of using doc-level history-v1-ot

* [web] fix advancing of the otMigrationStage

Use 'nextStage' for the user provided, desired stage when advancing.

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

* [document-updater] document size check in editor-core

* [history-ot] rename history-v1-ot to history-ot and add types

* [history-ot] apply review feedback

- remove extra !!
- merge variable assignment when processing diff-match-match output
- add helper function for getting docstore lines view of StringFileData

Co-authored-by: Alf Eaton <alf.eaton@overleaf.com>

* Revert "[document-updater] add safe rollback point for history-ot (#25283)"

This reverts commit d7230dd14a379a27d2c6ab03a006463a18979d06

Signed-off-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

---------

Signed-off-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
Co-authored-by: Brian Gough <brian.gough@overleaf.com>
Co-authored-by: Alf Eaton <alf.eaton@overleaf.com>
GitOrigin-RevId: 89c497782adb0427635d50d02263d6f535b12481
2025-05-08 08:05:44 +00:00
Eric Mc Sween
fb03fe4d26 Merge pull request #24776 from overleaf/em-project-history-unused-endpoints
Remove unused endpoints in project-history

GitOrigin-RevId: 2940c1c1973177e3200cb78884b307f708fd88c3
2025-04-14 08:05:08 +00:00
Eric Mc Sween
20c7f14b3c Merge pull request #24461 from overleaf/em-non-editable-file-in-history
Graceful fallback for getRangesSnapshot()

GitOrigin-RevId: 2f0e70dbcdd38de87d0b1c7590f7d8a5a7112937
2025-03-26 09:05:21 +00:00
Eric Mc Sween
374acf8119 Merge pull request #24462 from overleaf/em-resync-error
Fix error reporting on resyncs in project-history

GitOrigin-RevId: 9e8a454f746c2b4db7c28fafcd52e50935af5957
2025-03-25 09:05:12 +00:00
Brian Gough
31b57e2991 Merge pull request #24367 from overleaf/bg-add-new-project-history-flush-script
add new project history flush script

GitOrigin-RevId: 4d6f3be1ada7191334b934e34e1c9eac59a816d0
2025-03-24 10:46:34 +00:00
Eric Mc Sween
35dc7faab6 Merge pull request #24224 from overleaf/em-resync-on-flush-failure
Immediately attempt a resync when a history flush fails

GitOrigin-RevId: 098a0a7edf55c0ed47c48e0a3c080e3562cdceaa
2025-03-18 09:05:36 +00:00
Eric Mc Sween
064baf31ad Merge pull request #23478 from overleaf/em-doc-hash-diff
Fix doc hash on delete + insert combination

GitOrigin-RevId: ecea5f8ab01f24a9064be88611256b502500d91f
2025-02-10 09:05:38 +00:00
Jakob Ackermann
6b8a50eb92 [project-history] trim logging (#23408)
* [project-history] trim logging when projectVersion is out of order

* [editor-core] record reason rather than full pathname when not clean

* [editor-core] remove pathname from error messages

* [project-history] avoid logging updates when historyId is inconsistent

* [project-history] avoid logging failed history-v1 requests repeatedly

* [project-history] log once when doc version is out of order in chunk

GitOrigin-RevId: 5ac431ac87b57c00fac9d5ab486ca305b1775372
2025-02-06 09:04:35 +00:00
Jakob Ackermann
81aab1e159 [misc] fix logger.error(err) and logger.warn(err) calls (#23369)
* [misc] fix logger.error(err) calls

The signature is "logger.error({ err }, 'MESSAGE')".

* [project-history] remove duplicate logger.err calls in health check

The call-site is already logging any errors. Also, the logger.err call
signature was not quite right.

* [web] log userId when removeDropbox/removeGithub hook fails

* [misc] fix logger.warn(err) calls

The signature is "logger.warn({ err }, 'MESSAGE')".

* [misc] fix logger.error(OError.tag(err)) calls

* [web] make eslint happy

GitOrigin-RevId: 7f528113a3f7e9f6293b7d2d45adc079380325bb
2025-02-06 09:04:31 +00:00
Eric Mc Sween
39842c9857 Merge pull request #23250 from overleaf/em-project-history-doc-hash
Propagate the doc hash from project-history to history

GitOrigin-RevId: 341df52df41f7a5f8dbebbce53a47f9d5e1f8175
2025-02-04 09:05:03 +00:00
Jakob Ackermann
3a4c5a0d0f [history-v1] add readOnly lookup for raw chunks (#23318)
* [history-v1] add readOnly lookup for raw chunks

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* [history-v1] reduce min poolsize for readOnly pool to 0

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

---------

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: a711c4ee4f3ea3775bd090e620d1ef52689fa1f4
2025-02-04 09:04:52 +00:00
Jakob Ackermann
c6c623da78 [project-history] script for fixing-up files/metadata with bulk resync (#23184)
* [history-v1] add cheap endpoint for checking time of last history write

The /raw endpoint skips the GCS lookup for the chunk.

* [project-history] script for fixing-up files/metadata with bulk resync

* [project-history] upgrade structure only resync when full sync is needed

* [project-history] start resync and process resync updates under lock

* [project-history] stop retrying during graceful shutdown

GitOrigin-RevId: 73184d5786e1d40f5b7e21f387fc37cf43f0ac2d
2025-02-03 09:05:43 +00:00
Jakob Ackermann
b0c9176634 [project-history] add resync for project structure only (#23271)
* [project-history] add resync for project structure only

* [project-history] block resyncProjectStructureOnly that update docs

* [project-history] tweak test description

GitOrigin-RevId: ce2749566c36e04dab21c26dd60dd75d93c0d4c0
2025-02-03 09:05:39 +00:00
Jakob Ackermann
ba60f885a4 [project-history] fetch most recent chunk once when processing updates (#23261)
GitOrigin-RevId: 08ddd1f953b0dbae0541a60b45fec0f88e0a1d06
2025-01-31 09:05:14 +00:00
Jakob Ackermann
72b4083318 [project-history] forward all the optional file attributes during resync (#23260)
Notably, 'createdBlob' was missing. And others like metadata should not
be added if not set.

GitOrigin-RevId: c4a6746c4824d637f7c54b4c68a7025b60c15ff2
2025-01-31 09:05:09 +00:00
Jakob Ackermann
ae171dbced [project-history] fix name for error in logging statement (#23110)
Only the err/error fields will use the Error serializer and emit all the
OError details into the log.

GitOrigin-RevId: 4b0e16c00be5ea7c0aea747f49b46897ebd100cc
2025-01-27 09:05:22 +00:00
Eric Mc Sween
3e4e9b298f Merge pull request #23089 from overleaf/em-fix-ranges-snapshot
Fix edge cases when restoring comments

GitOrigin-RevId: 6ce2426bfb7233a3c0915bcc8c53bf0588702847
2025-01-27 09:05:06 +00:00
Jakob Ackermann
762266cd87 [project-history] block filestore reads from old queue entries (#23096)
GitOrigin-RevId: 9952cb66e542b17a6a3b5e3b2609d53dc8c371fd
2025-01-27 09:04:54 +00:00