Commit Graph
100 Commits
Author SHA1 Message Date
Jakob Ackermann 37e27bb22e [saas-e2e] reduce disk IO and webpack overhead (#36997)
* [monorepo] reduce writes from chrome in cypress

Chrome puts its shared memory in /dev/shm, and docker's default 64MB is far
too small for it - which is why Cypress passes --disable-dev-shm-usage,
spilling those segments to files on the container's writable layer instead.
Under one spec that is a few hundred MB of write-then-delete churn; under the
CI fan-out it was most of the disk bandwidth on the whole box.

So every service built from dockerfiles/cypress gets shm_size 1gb and every
cypress config drops the flag again: the SaaS e2e service, web's CI and local
component-test services plus its standalone cypress one, and server-ce's e2e
and native cypress services. Both e2e-open variants inherit the setting
through `extends`; the native one is a service of its own, and would be left
running Chrome against 64MB once the flag is gone.

* [monorepo] adopt cypress-pnp-reporter

Materializing the reporter packages copied 267 packages / 3779 files
(59MB) into /tmp on every container start, once per spec. Resolving them
through PnP inside Cypress's Electron process instead drops that to
zero: the entrypoint shell went from 55.6MB of write_bytes to 0.

* [web] serve built assets from a prepared buffer between builds

Serving a chunk cost ~2ms whatever its size, and an editor page pulls ~144
of them, so webpack-dev-server burned 2-3 cores through an e2e run purely
answering requests for output that had not changed since the last build.

It is not bytes: cutting the bundle 2.6x with a cheaper devtool moved CPU
by 8%, and an empty 304 cost nearly as much as the full body. It is the
per-request work - reading the asset out of the in-memory filesystem and
re-hashing the whole body for a strong ETag, on every request.

Three things a build does that this has to respect, each found by tracing
the hooks rather than by reading them:

- `done` fires twice per build, for the compilation and for the manifest,
  both with the same hash. A flag would have been cleared by the second
  while the first was still running, so the gate is a counter.
- An incremental `done` reports only the assets it rewrote - 16, not 630 -
  so asset names accumulate. Resetting them on `invalid` left the
  manifest's two behind and nothing was served from here again.
- webpack-dev-middleware holds requests during a rebuild. This sits in
  front of it, so it steps aside for that window and drops the cache when
  a rebuild starts. Whether a response can be kept is then decided as it
  ends rather than as it began: an epoch bumped on `invalid` names the
  build its bytes were read from, and only a response from the current
  build with no rebuild in flight is stored. A rebuild starting
  mid-response can no longer write the previous build's bytes in behind
  the cache being dropped, which eviction by asset name could not catch
  anyway - an incremental build does not name the assets it left alone.

Measured on the editor entrypoint, 16 concurrent clients:
0.26-0.31s -> 0.045-0.050s of webpack CPU per page load, and 0.0455s
immediately after a rebuild. Same chunk graph, byte-identical output.

GitOrigin-RevId: 08b4ab2d665414069bc01b4763dd64faa9b4e5cb
2026-09-17 12:07:28 +00:00
Jakob AckermannandClaude Opus 5 04871d6049 [editor-core] extract more shared utils (#36954)
* [editor-core] share the blob hash and the doc-vs-file rule

The git blob hash and the rule that decides whether a file is a doc or a binary
file both have to reach the same answer in every service that writes to history,
so they move into overleaf-editor-core rather than being spelled out again on
each side.

blob_utils takes over lib/blob_string_length.js: hashing and the string-length
rule answered two halves of the same question -- what history needs to know
about content before it can store it -- and each carried the same warning about
staying off index.js, which is bundled for the browser. One module states it
once, and blobForFile joins them, describing content on disk as the blob it
amounts to. The hashing functions are flat rather than a namespace of their own:
in a module that also holds the string-length rule, a bare fromStream says
nothing about what it makes. history-v1's blob store and recover_zip follow the
module to its new name.

file_type_detector holds the doc-vs-file rule, Node-only and deep-imported for
the same reason. It takes textExtensions, editableFilenames and maxDocLength as
configuration rather than reading settings: the limit is web's 2 MiB and not
editor-core's own 3 MiB, and the surrogate check covers both halves of a pair
where editor-core's covers the high half.

buildSetContentOperations' test spelled the blob header out for itself, with the
separator as a literal NUL byte, which had git reading the file as binary. It
hashes through blobHashFromString now, so it does not spell the header at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [editor-core] name the client a change came from on the origin itself

`EditorOrigin` carried an `editorId` that only an editor change could have. What
the id is for -- recognising a change again, so history does not apply a resend
twice and the client does not apply its own change back -- is a property of the
client that submitted it rather than of what it did, so it moves onto `Origin` as
an optional `historyClientId` and `EditorOrigin` goes.

- `Origin` takes `(kind, historyClientId)` and answers `getHistoryClientId()`;
  `dropHistoryClientId()` is what the chunk store uses to strip the id from all
  but a client's latest change, which now leaves the rest of the origin alone --
  a restore that a client submitted stays a restore.
- `toRaw` is built a layer at a time: the base writes the kind and the id, a
  subclass spreads that and adds the fields it owns.
- The named kinds are their own schemas and discriminate on `kind`, so a payload
  claiming one is checked against that shape and the error says what it got
  wrong. The catch-all cannot join them -- its kind is any string -- so it sits
  alongside and is refined to refuse the named kinds, which it used to swallow:
  `{kind: 'restore'}` validated as a kind and nothing else, then read back as a
  restore that recorded nothing about what it restored.
- `lib/origin/*.js` gains `// @ts-check`. Without it the annotations in there
  were decorative: the lazily required subclasses were `any`, so nothing handed
  to them was checked, and `fromRaw` narrows with `in` to drop the catch-all
  variant, which a kind check cannot.

The callers that stamp the id -- real-time's handshake flag, web's applyChange
body -- come with the rest of the branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [editor-core] recognise a change a writer that is not an editor placed

The counterpart of `isSameEditorChange` for writers that are not an editor
client: an integration that commits a batch on a user's behalf has to recognise
that batch coming back, because a lost response does not say whether the commit
landed and resubmitting one that did applies its removes twice.

It compares the same three fields, and for the same reason -- a rebase rewrites a
change's operations but leaves its origin, authors and timestamp alone -- with
the timestamp compared as a point in time rather than as a string, so that two
spellings of the same instant cannot read as different changes. github-sync is
the first caller, and comes with the rest of the branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [editor-core] load an editable file's content, or say it has none

Only an editable file has content: any other kind is bytes addressed by hash, and
hollow data records the size of content it does not have. Both answer
`getContent()` with null, so every caller that wants the content of a doc loaded
it, checked the data's class, and reached for its own error when the check failed.
`File#loadEager` does that once and answers the data that always has the content.

`buildSetContentOperations` takes a `ReadWriteBlobStore` -- everything but
looking a blob up by hash, which is all it takes to build operations over content
-- so a caller holding a store that cannot answer `getBlob` can still use it. Its
metadata argument is `FileMetadata` rather than `Object`, which is what the schema
already says a file's metadata is.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [editor-core] say that a pair of operations that do not fit is unprocessable

compose and transform threw a bare Error when the two operations do not describe
the same content. Everything that answers a client for these -- history-v1's
import routes, the git-bridge push, project-history's resync -- decides on
UnprocessableError, so a bare Error reached them as an internal failure: a 500,
which reads as worth retrying, for a pair that fails the same way every time.
A client that resubmits on a 500 resubmits forever.

The guards that cannot be reached through the API keep their bare Error: a
TextOperation composed with something that is not one, and the branch whose
message says it should not happen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* [history-v1] hash blobs with the rule editor-core holds

storage/lib/blob_hash.js was a bluebird-era implementation of the same git blob
hash editor-core holds, exported from the storage barrel and used across the
storage layer, the api and the tests. All of it reads the shared rule now, and
the test that existed only to check the copy is gone -- editor-core's suite
covers the same non-ASCII case.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitOrigin-RevId: 5a0c1e9a06170a0164c01a26a7bb2d205726d531
2026-09-17 12:07:15 +00:00
Jakob Ackermann 7cebd46047 [monorepo] fix error code for failed ESM import (#36946)
GitOrigin-RevId: 3576cba8f3b18c749b45b8f4baaaaaeb8d598c6a
2026-09-17 12:06:56 +00:00
Jakob Ackermann 2317fd6edb [web] remove generic analytics service proxy (#36934)
GitOrigin-RevId: 19b3613b7cc84e73ad556067da1b3cd2f956e1c5
2026-09-17 12:06:50 +00:00
Jakob AckermannandClaude Opus 5 6caa5fc3a3 [monorepo] read empty content from its hash, in a shared blob store base (#36831)
The hash of empty content is a property of the content rather than of anything
stored: every project's empty file has it, whether or not a blob was ever written
under it, and a file may reference it before anything has. Eight blob stores were
each paying a lookup -- a database query, an HTTP request, a read of a cache that
offline mode may be the only thing standing in for -- to be told what the hash
already says, and clsi had already reinvented the answer on its own.

overleaf-editor-core gains BlobStoreBase, which answers getString for that hash
and delegates the rest to the fetchString its subclasses provide. getObject comes
with it: four stores spelled out the same JSON.parse of getString, and a fifth
wrapped it in a log line.

Adopted by history-v1's BlobStore, BackupBlobStore, HashCheckBlobStore and
recover_zip's RecoveryBlobStore, by project-history's BlobStore, by clsi's
BlobStore, and by web's HistoryBlobStore, SimpleBlobStore and FrontendBlobStore.
history-v1 keeps its own answers in getStream, getBlob and getBlobs, which no
other store implements. Writing and copying a blob are untouched, so a project
that wrote empty content still has a blob for it and a read answers the same
either way.

Two paths could not handle a project holding a tracked change or a comment at
all. Loading such a file needs the ranges blob its rangesHash points at, and
hashing one again needs to write it back, so a store missing getObject or
putObject fails outright:

- recover_zip died on `blobStore.getObject is not a function`, making every such
  project unrecoverable. The test covering it asserts a tracked delete is absent
  from the zip, which the script already asked for and never reached.
- GET /projects/:project_id/latest/hashed_content returned 500 from the same
  cause, then would have hit a missing putObject in snapshot.store.
  HashCheckBlobStore becomes a class over the base and gains putObject.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
GitOrigin-RevId: c84f62465beff6cf77ffac26aa772984e1b554cb
2026-09-17 12:06:30 +00:00
Jakob Ackermann 7608d738a6 [monorepo] speed up development in Codespaces (#36912)
* [monorepo] put volumes of ephemeral test containers on tmpfs

* [github] reduce IOWAIT in codespaces

* [monorepo] avoid yarn exec wrapper process for dev-env services

* [monorepo] exec from sh -c wrappers in dev-env services

* [github] reduce bloat with overlay2 storage driver

* [monorepo] reduce memory usage with yarn pnp

* [monorepo] add retries to docker builds

* [monorepo] fix formatting for .pnp.register.mjs

* [server-ce] test: fix re-use of users across reconfiguring

* [monorepo] adopt incoming resolve context conditions

GitOrigin-RevId: fe5d810a064f15cf8ca9f8a292b91ac054a578b0
2026-09-17 12:06:24 +00:00
Jakob Ackermann 5cbf586b70 [web] log failed create/refresh actions for linked files (#36925)
GitOrigin-RevId: 127ca0fe976d704468842107f6fe6d0200acdb6c
2026-09-17 12:06:21 +00:00
Jakob AckermannandClaude Opus 5 7ae8db6b12 [editor-core] extract shared pieces for history-ot in editor (#36828)
* [editor-core] share the pieces the editor, real-time and history-v1 all need

Project-level history-OT has the browser, real-time and history-v1 all reason
about the same changes, so the rules they reason with move into the shared
library rather than being reimplemented on each side.

- `origin/editor_origin.js` plus `EDITOR_ORIGIN_KIND` and its schema entry: the
  origin an editor client's change carries, holding the editorId that scopes a
  change's timestamp.
- `change_identity.js`: how a submission is recognised when it comes back, so a
  resend of a change that already landed is deduplicated rather than applied
  twice.
- `rebase.js`: transforming a change onto concurrent ones, in the same order on
  both sides, which is what lets the server acknowledge a change with only the
  version it landed at.
- `text_file_defaults.js`: the doc-vs-file extension lists, now read from here
  by web's settings instead of being spelled out again.
- `blob_string_length.js`: the string length of a blob, used by history-v1's
  blob store and by web when it writes an uploaded file into history.
- `file_tree_diff.js`: file-tree operations to a diff, used by
  project-history's FileTreeDiffGenerator.
- `Blob.EMPTY_HASH`, so callers can answer for the empty blob without storing
  it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* [project-history] build the file-tree diff with the shared helper

FileTreeDiffGenerator's hand-rolled walk over add/edit/move/delete operations
becomes a call to `buildFileTreeDiff` from overleaf-editor-core, so the editor
and project-history read a file-tree change the same way. Adds the unit tests
the decaffeinated original never had.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* [web] read the editable-file lists from overleaf-editor-core

web's settings spelled out the text extensions and editable filenames that
decide whether a file becomes a doc, and every other service that has to make
that call carried its own copy. The lists now live in overleaf-editor-core and
web builds settings.textExtensions and settings.editableFilenames from them,
keeping the ADDITIONAL_TEXT_EXTENSIONS override for Server CE/Pro on top.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* [history-v1] read a blob's string length from overleaf-editor-core

Two copies of getStringLengthOfFile lived here, the one in recover_zip.js
carrying a TODO asking for exactly this. Both now import the shared
implementation, which the blob store keeps re-exporting for backupArchiver.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
GitOrigin-RevId: 31948332f416f56848e3b0dfb5142a4c9f93f508
2026-09-17 12:06:17 +00:00
Jakob Ackermann 9b44fd075b [monorepo] downgrade ranges ids back to strings for now (#36857)
GitOrigin-RevId: 6c85715bc85adc2f641bfd0e9f3bb6a8f2c839c2
2026-09-17 12:03:33 +00:00
Jakob AckermannandClaude Opus 5 91bf8f13ba [validation-tools] add a throw+log mode to parseReq (#36821)
REQ_VALIDATION_MODE=enforce-log rejects schema failures exactly as 'enforce'
does, but logs them first at instrumented call sites, so the visibility built
for the 'log' rollout (sanitized issues, caller trace, logFields values, per
schema/signature dedup) survives moving out of 'log' mode.

opts no longer change the outcome in this mode: logOnly does not suppress the
throw, the error is classified from the primary schema (not the fallback), and
fallbackSchema is only re-parsed to tag the log entry -- 'enforced-fallback-
passed' marks a rejection the looser pre-refinement schema would have avoided,
i.e. one the tightened schema newly introduces.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitOrigin-RevId: 0743322990e6c570ffbae166b4586285a18221df
2026-09-17 12:03:25 +00:00
Jakob AckermannandThomas Mees e276104da8 Relax split test import schema to allow staging export fields (#36832)
* Relax split test import schema to allow staging export fields

The staging split test export includes fields (variant.active, version.__v,
splitTest.customerIoEnabled) that aren't otherwise written by the app but
are present in Mongo exports. The strict zod schema was rejecting the
import; mark these as optional so a staging export can be imported into a
local dev environment.

* [web] allow split-test import in dev-env and CI

* [web] ensure that the zod schema for split-tests covers all fields

---------

Co-authored-by: Thomas Mees <thomas.mees@overleaf.com>
GitOrigin-RevId: eab633e8498e351a64dc9a9dad85759e80744da0
2026-09-17 12:03:21 +00:00
f671c3dc59 [web] read a linked project file's source from history (#36817)
* [web] read a linked project file's source from history

Behind the `linked-file-from-history` flag, a linked `project_file` import reads
the source out of the source project's latest history snapshot rather than out of
its file tree in mongo, where docs and files are two kinds of thing.

- `ProjectFileAgent` gains `_importFromHistory` alongside the existing
  `_importFromProject`, and the flag picks between them. The snapshot only holds
  what has reached history, so the source project is flushed through
  document-updater and project-history first. A file that is editable is loaded
  eagerly, which applies the edit operations sitting on top of its blob; one that
  is not keeps its hash and is streamed. The file is promisified on the way.
- `History/HistoryOTContentManager.mjs` reads the latest chunk and rolls its
  changes into a snapshot, retrying the read. `History/HistoryBlobStore.mjs` is
  the blob store overleaf-editor-core asks for while loading a file.
- `LinkedFilesController` resolves the flag, including from the referer: the
  import endpoints have no query string of their own. Every agent takes the
  assignment so that the ones that do not read it still pass it along.
- `linked-file-from-history.spec.ts` drives the flag from the editor url, over
  three imports from another project: a file uploaded to the source project and
  then refreshed from it, an edit the source project has only made in its editor,
  and a binary file. Both sources produce the same file, so which one was read is
  asserted in the acceptance tests rather than here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [saas-e2e] add test coverage for tracked-delete in linked file source

* Apply suggestions from code review

Co-authored-by: Mathias Jakobsen <mathias.jakobsen@overleaf.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Mathias Jakobsen <mathias.jakobsen@overleaf.com>
GitOrigin-RevId: 3907d6d399e4b5315e68bf833663c06bc72f4011
2026-09-17 12:02:47 +00:00
Jakob Ackermann f62b8525f2 [web] gracefully handle empty relativePath in uppy uploads (#36773)
GitOrigin-RevId: 640094f69cf53ba9f33a5bdc3b6d532547431d01
2026-09-17 12:01:55 +00:00
Jakob Ackermann 58e2396d91 [web] remove legacy body field for rootDoc_id (#36608)
The migration finished in 2014, there are no more clients using it.

REF: 175dfae085
GitOrigin-RevId: 6fc21e93c5ef34622e9cf6259e7105f3202d66ae
2026-09-17 12:01:26 +00:00
Jakob Ackermann 640a2e1c60 [web] remove unused link=false flag from /user/oauth-unlink (#36566)
GitOrigin-RevId: 5a8af17bf339df62a6cf54d6c372bff4cbe88eb3
2026-09-17 12:01:23 +00:00
Jakob Ackermann 4e80d65efc [ranges-tracker] add legacy orderedRejections field in tracked-changes (#36565)
* [docstore] use more realistic test stubs for ranges

* [monorepo] define ranges schemas in @overleaf/ranges-tracker

* [ranges-tracker] add legacy orderedRejections field in tracked-changes

* [monorepo] resolve @overleaf/ranges-tracker subpath imports in typescript

* [real-time] validate comment thread ids and tracked change id seeds

* [ranges-tracker] require ObjectId ids and tracked change metadata in ranges

* [monorepo] require ObjectId tracked change ids on the accept routes

* [web] use ObjectId comment thread ids in the DocumentController tests

GitOrigin-RevId: 58b20dec311d85b917ef63f9efbe745a265a2de6
2026-09-17 12:01:19 +00:00
Jakob Ackermann cd7ac6f2fc [editor-core] gracefully handle verbose project_output_file details (#36552)
GitOrigin-RevId: 2c549db61dc05c02729bf80c8fbd3f31d52f1e9c
2026-09-17 11:56:28 +00:00
Jakob Ackermann a6792af5b1 Merge pull request #36225 from overleaf/jpa-zod-web-final
[web] fully adopt strict zod schema and enforce in tests

GitOrigin-RevId: 1bb03ed3a819be6de38c8ca5758b3909cfa23318
2026-09-17 11:55:44 +00:00
Jakob Ackermann de0d1a7226 Merge pull request #36219 from overleaf/jpa-zod-web-platform
[web] platform: adopt strict zod schema and extend test coverage

GitOrigin-RevId: e3a0b7b4c52ac116f28be0d284284e3bd3994cda
2026-09-17 11:55:40 +00:00
Jakob Ackermann 55c23b6812 Merge pull request #36223 from overleaf/jpa-zod-web-core-2
[web] core-2: adopt strict zod schema and extend test coverage

GitOrigin-RevId: f26d349fefb6bf9e042cb39117395120c3f7c877
2026-09-17 11:55:37 +00:00
Jakob Ackermann e2564f356c Merge pull request #36222 from overleaf/jpa-zod-web-core-1
[web] core-1: adopt strict zod schema and extend test coverage

GitOrigin-RevId: 6dc74a100989e6eca1565480a9ecb5f24404ef96
2026-09-17 11:55:33 +00:00
Jakob Ackermann f26a48fc4c Merge pull request #36221 from overleaf/jpa-zod-web-b2c
[web] b2c: adopt strict zod schema and extend test coverage

GitOrigin-RevId: 5c612e3ce83b81cfff7b8f1c5bc4522d6feb665a
2026-09-17 11:55:30 +00:00
Jakob Ackermann 784b9c64ec Merge pull request #36220 from overleaf/jpa-zod-web-b2b
[web] b2b: adopt strict zod schema and extend test coverage

GitOrigin-RevId: ae9bb04cfe1034ff36dec33ba5e77aceecd71db7
2026-09-17 11:55:27 +00:00
Jakob Ackermann 2566455740 [web] mock the changes/users request in EditorProviders (#36435)
GitOrigin-RevId: 5f8f5b9317d089ca52ff17ad1307d58d625709d5
2026-09-17 11:52:22 +00:00
Jakob Ackermann 975cf90357 [editor-core] gracefully handle any legacy v1 import agent (#36354)
GitOrigin-RevId: 186afa70c03e69b3288af66d85a0a3e431780d14
2026-09-17 11:50:47 +00:00
Jakob Ackermann 49969f6e0d [history-v1] adopt strict zod types and extend test coverage (#36089)
GitOrigin-RevId: 7bdffe2c05c7c17be6eb3e4296d8df05d650c53e
2026-09-17 11:49:08 +00:00
Jakob Ackermann 95e3444a6e [editor-core] refine zod schemas for rawTextOperation and rawFileMetadata (#36253)
* [editor-core] gracefully handle no-op TextOperation

* [editor-core] add support for legacy url imports

* [editor-core] reorder rawFileMetadata entries

GitOrigin-RevId: f5c3158def00183d4a60a5b934abd921716e2339
2026-09-17 11:48:47 +00:00
Jakob Ackermann b4937905bb [linked-url-proxy] adopt strict zod types and extend test coverage (#36166)
GitOrigin-RevId: 1edbd4ea3240cc8973d0a7e6488a8b882422a42b
2026-09-17 11:48:43 +00:00
Jakob Ackermann 2e8f6f0d03 [chat] adopt strict zod types (#36102)
GitOrigin-RevId: eb3e245599f5db2d29366ce5d8e0993ec6b20338
2026-09-17 11:48:40 +00:00
Jakob Ackermann 4e79741e78 [latexqc] integrate latexqc closer into build scripts (#36252)
* [monorepo] drop unused --docker-repos build script flag

* [latexqc] integrate latexqc closer into build scripts

- Generate Dockerfile
- Drop now unused --only-jenkins-include-file

* [monorepo] update header for custom Dockerfiles in build scripts

GitOrigin-RevId: 84d0b100e731ae41db132f676e7837e17c17542e
2026-09-17 11:48:37 +00:00
Jakob Ackermann 4e6e98941a [latexqc] adopt strict zod types and extend test coverage (#36165)
GitOrigin-RevId: 339aa5c5b51dc2ab97178e482142f64d7324a57b
2026-09-17 11:48:33 +00:00
Jakob Ackermann a80f9d4803 [github-sync] adopt strict zod types and extend test coverage (#36050)
GitOrigin-RevId: cd4060778455e9bc252588e449d5588852648592
2026-09-17 11:48:27 +00:00
Jakob Ackermann 6ca58edf72 [web] add infrastructure level zod change (#36190)
* [web] add infrastructure level zod change

* [web] set req validation mode for tests to 'enforce'

GitOrigin-RevId: 6dbc8bff7ed9f89045c398df93d84bca589de4e9
2026-09-17 11:48:19 +00:00
Jakob Ackermann 731ed50f78 [clsi] address zod violations (#36199)
* [editor-core] gracefully handle no-op TextOperation

* [web] avoid sending sync to pdf requests without a ?file

* [validation-tools] log deeper nested violations

* [editor-core] fix round trip of EditNoOperation

* [web] use custom error for sync to pdf w/o file, fix tests

* [validation-tools] include request params in log msg for violation

* Revert "[editor-core] gracefully handle no-op TextOperation"

This reverts commit c1d37261d5db72b37dbf39428c54edcfb5423f41.

* [web] gracefully handle rejected sync to pdf from context menu

GitOrigin-RevId: 21de7dc96b23575b0d67b6eb0c68ed9c2f86292b
2026-09-17 11:48:12 +00:00
Jakob Ackermann deec57e54e [chat] gracefully handle projects without threads/messages when cloning (#36101)
GitOrigin-RevId: 0623a4b801f469b7d55412f2be8aac782cb6ab19
2026-09-17 11:47:52 +00:00
Jakob Ackermann 4ca028cb4c [validation-tools] eventName: accept upper case letters (#36188)
GitOrigin-RevId: 979ec5c744d5304232d447ff5fff076ee081721f
2026-09-17 11:47:25 +00:00
Jakob Ackermann 591b9f5d39 [clsi] adopt strict zod types and extend test coverage (#36090)
GitOrigin-RevId: ce11933ccc10ac74baf5c78cec194b5532a357a2
2026-09-17 11:47:13 +00:00
Jakob Ackermann 0776357d1a [document-updater] address zod violations (#36147)
* [editor-core] address zod violation for group_id

* [monorepo] use discriminated union in zod schemas where possible

* [editor-core] v1_source_doc_id is a number

GitOrigin-RevId: 38f591b07cca4e22954bfe30bf855545a6af675d
2026-09-17 11:46:42 +00:00
Jakob Ackermann b1dece55c8 [docstore] adopt strict zod types and extend test coverage (#36076)
GitOrigin-RevId: b9f1b965dbdb763ce541dabbe89300ce6d044217
2026-09-17 11:46:14 +00:00
Jakob Ackermann 0a08c78987 [clsi-cache] adopt strict zod types and extend test coverage (#36078)
GitOrigin-RevId: 92c01afb3bfb22ab7c14447dda510ca6361c9879
2026-09-17 11:46:11 +00:00
Jakob Ackermann 4e80098424 [document-updater] adopt strict zod types and extend test coverage (#36077)
* [document-updater] adopt strict zod types and extend test coverage

* [saas-e2e] add test for project restore with binary and linked file

GitOrigin-RevId: a8e45bd1e46b6ac8a293da24c8b8ad7b236fd9bd
2026-09-17 11:46:05 +00:00
Jakob Ackermann a57d8449ef [third-party-datastore] adopt strict zod types and extend test coverage (#36082)
GitOrigin-RevId: 30b8dbcc72844ab421d73991701234f8264e8569
2026-09-17 11:46:02 +00:00
Jakob Ackermann f48132a70e [notifications] adopt strict zod types and extend test coverage (#36049)
* [notifications] adopt strict zod types and extend test coverage

* [notifications] validate expires date via schema

GitOrigin-RevId: 25dee0578ec443447e4c38a50a7e6c8b44831fe7
2026-09-17 11:45:58 +00:00
Jakob Ackermann eb36edac6d [project-history] report a resync that is still pending after a flush (#36122)
GitOrigin-RevId: ccd4390048c09f732531d2e02a40336fce88a952
2026-09-17 11:45:55 +00:00
Jakob Ackermann 9be1b4edb4 [monorepo] refine prettier setup (#36142)
- Trigger monorepo-check on Jenkins init scripts and fix violations
- Ignore all the json-dashboards in terraform folders

GitOrigin-RevId: f27b46d6fb81f5ac731f56b065951bede7d1a9e4
2026-09-17 11:45:52 +00:00
Jakob Ackermann d62f8fb716 [filestore] adopt strict zod types and extend test coverage (#36112)
GitOrigin-RevId: a761477f2b412133da2d71748233c712c5728fae
2026-09-17 11:45:41 +00:00
Jakob Ackermann daf4a0e412 [third-party-references] adopt strict zod types and extend test coverage (#36083)
GitOrigin-RevId: d8c1679bb088feb2c0827d94a71e2e006ab71ba1
2026-09-17 11:45:23 +00:00
Jakob Ackermann 52e5fb3498 [project-history] adopt strict zod types and extend test coverage (#36087)
GitOrigin-RevId: ce1396e87926fc8816afa424c9db2a052c7da5e6
2026-09-17 11:45:20 +00:00
Jakob Ackermann 6a0f70bb23 [idp] adopt strict zod types and extend test coverage (#36038)
GitOrigin-RevId: d9887f877b44e03b501072f738387e4646a1431a
2026-09-17 11:45:16 +00:00
Jakob Ackermann 405b675740 [freegeoip] adopt strict zod types and extend test coverage (#36039)
GitOrigin-RevId: 889ea0fa67cfdf2ad2469936e0fd737169868ff1
2026-09-17 11:44:26 +00:00
Jakob Ackermann 2f69caef63 [editor-core] allow empty ranges on rawAddCommentOperation (#36073)
GitOrigin-RevId: 8674a2b458770439925047aab9a129242eb984d4
2026-09-17 11:44:12 +00:00
Jakob Ackermann 469f5629d2 [saas-e2e] run all the spec files (#35993)
* [saas-e2e] run all the spec files

* [saas-e2e] add addComment helper

* [saas-e2e] add replyToComment helper

* [saas-e2e] check latexqc report for errors

* [saas-e2e] fail fast when the login request failed

* [monorepo] upsert the minimal v1 db entries in all environments

* [monorepo] serve the CDN assets from nginx to avoid session mix

* [monorepo] avoid loading fonts from Cypress UI via web

* [monorepo] effectively disable login + loadEditor rate-limit in dev-env

* [saas-e2e] project-list: generate unique project name on re-run

* [saas-e2e] add debug logs for latexqc

GitOrigin-RevId: 778003759414a3c993578062a631d083ecb1d2e6
2026-09-17 11:43:07 +00:00
Jakob Ackermann 05885f9943 [templates] adopt strict zod types and extend test coverage (#36030)
GitOrigin-RevId: d99894d42fac538f7acf799a05c57fd8630ce22b
2026-09-17 11:43:01 +00:00
Jakob Ackermann f6bb5ce1bd [real-time] adopt strict zod types and extend test coverage (#36031)
* [editor-core] extend coverage of zod schemas

* [real-time] adopt strict zod types and extend test coverage

* [project-history] make type check happy

* [web] make type check happy

GitOrigin-RevId: e1a65b9b3560b31ad2af817067a4b549865a5bb1
2026-09-17 11:42:50 +00:00
Jakob Ackermann 81df324bcc [monorepo] prepare for zod everywhere epic (#36027)
GitOrigin-RevId: f082ae7fc7857fa72b2c1823645050bd4f6df305
2026-09-17 11:42:46 +00:00
Jakob Ackermann 03cbfbe90f [web] fix open redirect via utm tags (#36019)
GitOrigin-RevId: 1304c1578adf1d3248abcaa01902467422e8d8f6
2026-09-17 11:41:34 +00:00
Jakob Ackermann 275d381656 [monorepo] remove some dead code (#35901)
* [history-v1] remove unused duplicate file from swagger migration

* [web] drop unused ?scribtex_path

* [github] update path to security middleware in history-v1

* [dependency-management] update .jenkinsIncludeFile

GitOrigin-RevId: 8c59d0d1e3e9108a8498e33e4768992ecd342f00
2026-09-17 11:41:07 +00:00
Jakob Ackermann be9ab57d18 [web] speed up CI: bin-pack module acceptance tests (#35965)
GitOrigin-RevId: 92a33b4531d541c676018b3152c7abf74edd2eec
2026-09-17 11:40:52 +00:00
Jakob Ackermann e947f3c4aa [web] improve logging for failed requests on MockApis (#35958)
- Prepare for zod usage in mocks
- Fix logging of the mock name

GitOrigin-RevId: 3c4d2981010992c293a9ece45935ce13cadd8dde
2026-09-17 11:40:09 +00:00
Jakob Ackermann e8070def26 [document-updater] fix typo in test stub (#35950)
tid does not exist anywhere else in document-updater at
sha 3d76f4b9bf when
the typo was added. The comment id was read from .t only.
Doc-snapshots are copied the ranges literally without any
normalizing of nested structures.

GitOrigin-RevId: f76fbc930fdf02d9367603b5b1d6414de8d9f559
2026-09-17 11:40:01 +00:00
Jakob Ackermann 8fa62d2864 [document-updater] drop support for tc in briefly (#35864)
GitOrigin-RevId: 00d04d911249b81abc5eb4f9d9dfde4c7f2316b3
2026-09-17 11:39:22 +00:00
Jakob Ackermann 7a0a9c3ce5 [document-updater] implement HTTP endpoints for comments (#35833)
GitOrigin-RevId: 06b4f222a55e21b3def432d6e84d9ab4bf65b64d
2026-09-17 11:39:19 +00:00
Jakob Ackermann 8be65f1f93 [document-updater] add support for flush/restore of tc with history-ot (#35823)
GitOrigin-RevId: a79b0ca97c930ca2e2f3ffeea20defbc6973468c
2026-09-17 11:39:15 +00:00
Jakob Ackermann 00a2765d01 [document-updater] add track-changes support to setDoc (#35820)
GitOrigin-RevId: 5d39dd1945e710ec3f7068830fb2476e59f0f2a5
2026-09-17 11:39:12 +00:00
Jakob Ackermann a77a4782cc [history-v1] add setContent endpoint (#35799)
* [history-v1] add setContent endpoint

* [history-v1] refactor setContent to return a change+v

* [history-v1] make typescript happy

GitOrigin-RevId: e2cb0281367c01aa9cd842f250f2016d591ec0fc
2026-09-17 11:39:09 +00:00
Jakob Ackermann 5425202247 [e2e] cut down flakeyness (#35896)
* [saas-e2e] conversion: wait for initial compile before looking at PDF

* [eslint-plugin] s/before/beforeWithReRunOnTestRetry/ in e2e tests

* [server-ce] remove filestore migration scripts and E2E tests

* [server-ce] test: trim down upgrading tests to 5.x -> latest

GitOrigin-RevId: 2426ec4a4f3d67a5e0e7850ea84a942ae4619f94
2026-09-17 11:38:44 +00:00
Jakob Ackermann 94cad14caf [chat] migrate to express with strict zod schema (#35742)
GitOrigin-RevId: edffacde0c069768def849f45364d519d9f76f1e
2026-09-17 11:36:35 +00:00
Jakob Ackermann a1d1145df1 [web] fix settings override in acceptance tests (#35798)
GitOrigin-RevId: ee64407a47ef2dac28ca82bd46659c4735e02b6f
2026-09-17 11:36:01 +00:00
Jakob Ackermann c6d1cea177 [monorepo] make format_fix happy (#35660)
GitOrigin-RevId: 6f070a87c5240317960c7227dfa8f868e781d2a0
2026-09-17 11:35:30 +00:00
Jakob Ackermann c821cc695c [real-time] delete PubSubRace test (#35746)
With the removal of per-doc rooms, there is nothing to race anymore.
The next lower timeout is 0, i.e. useless check.

GitOrigin-RevId: effb6cc0525f5fd785c7dce8df4e279de1f1b13f
2026-09-17 11:34:30 +00:00
Jakob Ackermann aab08b4c28 [document-updater] remove doc lock from per-doc operations (#35696)
GitOrigin-RevId: c45c1dbf11049c0fab8a7d788006a698ede0d510
2026-09-17 11:34:14 +00:00
Jakob Ackermann e714810632 [real-time] remove per-doc rooms (#35691)
* [real-time] remove applied-ops pub/sub

* [real-time] remove per-doc rooms

GitOrigin-RevId: ec3b76b37a029df15bf20d6f2832fb7c089c0042
2026-09-17 11:34:11 +00:00
Jakob Ackermann bc9d25d385 [monorepo] clean up the per-project pub/sub migration (#35686)
GitOrigin-RevId: 4bbb97d1d2750f21751ef54e206e3e720b88615a
2026-09-17 11:33:51 +00:00
Jakob Ackermann 3565f51a84 [monorepo] prepare for per-project pub/sub for applied ops (#35663)
GitOrigin-RevId: 11d45addf366c3449cad432272ed03d4c8dae49d
2026-09-17 11:33:01 +00:00
Jakob Ackermann e1358c4507 [document-updater] remove unused script (#35614)
GitOrigin-RevId: 95717884ce4b5207ef7289108eb64a84d4ed5dd4
2026-09-17 11:32:11 +00:00
Jakob Ackermann 324f011d80 [document-updater] add script for flushing/discarding stuck docs (#35603)
GitOrigin-RevId: 099e1e0a38515b35decbdc608acd75f59de0ec6f
2026-09-17 11:31:56 +00:00
Jakob Ackermann 68352783b0 [monorepo] clean up per-project queue migration (#35573)
GitOrigin-RevId: 988df4cdc7d929efc921e7e99d803c6ce6e52c57
2026-09-17 11:31:52 +00:00
Jakob Ackermann da808cf653 [k8s] document-updater: advance PENDING_UPDATES_MIGRATION_PHASE=3 (#35551)
* [k8s] document-updater: advance PENDING_UPDATES_MIGRATION_PHASE=3

* [document-updater] add logging to check script

GitOrigin-RevId: e74de189e7bb2036fb0fbfe9e8ba44f8f87af110
2026-09-17 11:29:48 +00:00
Jakob Ackermann 04c9e583a3 [real-time] fix gradual draining of connected clients (#35542)
* [real-time] add regression tests for gradual draining

* [real-time] fix gradual draining of connected clients

GitOrigin-RevId: d9985d2ec72176b567c17f066551cd4f205b0219
2026-09-17 11:29:29 +00:00
Jakob Ackermann 8270641b42 [web] optimize project lookup for tpds operations (#35466)
* [web] store ObjectIds in addUserToProject acceptance test helper

* [web] optimize project lookup for tpds operations

GitOrigin-RevId: 03db9fc450556072f177d56f640fcc6114b295d4
2026-09-17 11:28:44 +00:00
Jakob Ackermann cdba372dfc [monorepo] prepare per-project queues (#35386)
GitOrigin-RevId: ab020603ec04c705d08be466563adac0ce30bc04
2026-09-17 11:26:50 +00:00
Jakob Ackermann b68a013751 [web] add endpoint for resolving a project for writes from tpds (#35408)
* [web] add endpoint for resolving a project for writes from tpds

* [web] return historyId from new endpoint for resolving projects

* [web] add zod validation to new endpoint for resolving projects

GitOrigin-RevId: 0e607e56442117a4150a08373169c44b53dd4fdf
2026-09-17 11:26:03 +00:00
Jakob AckermannandAndrew Rumble 9519dc5e66 [fetch-utils] use default agent with a 1s timeout and 3 attempts in connect phase (#35406)
Co-authored-by: Andrew Rumble <andrew.rumble@overleaf.com>
GitOrigin-RevId: cb1e854d61ce623fa557ae003dc7159b096e1f86
2026-09-17 11:24:37 +00:00
Jakob Ackermann 89f12e6b1f [document-updater] wrap doc locks in project lock (#35416)
* [document-updater] wrap doc locks in project lock

* [document-updater] use BlockingProject as redis key prefix

* [redis-wrapper] update comment

GitOrigin-RevId: 0ce50e76386871e6c29481494febc8d6b37e7df5
2026-09-17 11:24:34 +00:00
ff72ccf5ba [web] set a few more explicit timeouts on fetch requests (#35402)
* [web] set a few more explicit timeouts on fetch requests

Co-authored-by: Andrew Rumble <andrew.rumble@overleaf.com>
Co-authored-by: Brian Gough <brian.gough@overleaf.com>

* [web] update test mocks to expect signal

---------

Co-authored-by: Andrew Rumble <andrew.rumble@overleaf.com>
Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: 356b97207f6e9a2628e54ff15b034a8e694a4524
2026-09-17 11:24:31 +00:00
Jakob Ackermann bccef96581 [editor-core] fix TextOperation.isNoop() for tracked-changes (#35389)
* [editor-core] add regression test for composing no-op tracked change

* [editor-core] fix TextOperation.isNoop() for tracked-changes

GitOrigin-RevId: 345ee20275db9bf32ad32037013dde2bda507027
2026-09-17 11:23:53 +00:00
Jakob Ackermann 926b7c534b [agents] allow running all the test-runner skill commands (#35247)
* [agents] allow running all the test-runner skill commands

* [agents] move linting into AGENTS.md

* [agents] double down on permissions and cwd

* [saas-e2e] add support for MOCHA_GREP

* [saas-e2e] fail fast by default outside CI

* [agents] avoid need for Codespace detection

* [agents] work around missing trust prompt in Codespaces

* [saas-e2e] e2e_test_setup: merge split-tests in dev-env

GitOrigin-RevId: f1c1cd2a732e98b2e6125ef86a2b2cda5d3aabb6
2026-09-17 11:20:53 +00:00
Jakob AckermannandBrian Gough 84c6a68eae [web] enforce size limit on individual files when cloning project (#35211)
* [web] enforce size limit on individual files when cloning project

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

* [web] improve test coverage

* [agents] speed up running frontend tests

* [web] gracefully handle project too large error

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: c7b35a3a9688e15a9bb51c61816da82d39e0d29d
2026-09-17 11:20:03 +00:00
Jakob Ackermann f62bd990d4 [clsi-cache] add support for png2pdf (#35200)
GitOrigin-RevId: ebc505528f2a001923acf2d39e6dd43107f5f35e
2026-09-17 11:20:00 +00:00
Jakob Ackermann 0354f03612 [eslint-plugin] integrate with build scripts (#35176)
GitOrigin-RevId: cc042f70981da3862f2660c695193190b0c62000
2026-09-17 11:19:04 +00:00
Jakob Ackermann 70a9069015 [web] add retries to history calls in compile from history (#35191)
* [web] add retries to history calls in compile from history

* [web] address review feedback

GitOrigin-RevId: f22e0d1515dd22a0a43a0faf28c370e4f196e1da
2026-09-17 11:17:58 +00:00
Jakob AckermannandBrian Gough 69ccb3c316 [clsi] integrate png2pdf (#34796)
* Add png to pdf converter for optimising image loading in pdftex

* refactor

* move fixtures

* refactor and add unit tests

* Remove gamma correction from PNG processing and update related tests

* Add crc32fast dependency and enhance PNG processing tests

* Add fixture test cases for PNG processing

* fix alpha channel to match pdftex

pdftex always uses an 8 bit alpha channel in the output even for 16 bit images

* Refactor PNG processing to use Option for alpha stream and update related logic

* Enhance PDF writing by adding DecodeParms for alpha stream and optimize PNG encoding process

* Add pixel dimensions support in PNG processing and PDF writing

* [copybara] move clsi excludes

* [clsi] move gitignore rules

* [png2pdf] move into dockerfiles folder

* [png2pdf] use atomic writes

* [clsi] integrate png2pdf

* [saas-e2e] add coverage for png2pdf

* [png2pdf] make compatible with seccomp profile in clsi

* [copybara] remove exclude following move of png2pdf

* [copybara] remove spurious excludes

* fix broken detection of malformed chunk headers

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

* [project-history] add build script flag for depending on doc-updater types

* [png2pdf] run tests as part of clsi pipeline

* [png2pdf] fix calculation of PDF page size

* [web] put png2pdf behind feature flag and make it opt-in

* [web] fix ClsiManager.promises.sendRequest invocation after merge

* extend is_copy_safe function to follow pdftex

see the conditions in pdftex's writepng.c
https://svn.tug.org:8369/texlive/trunk/Build/source/texk/web2c/pdftexdir/writepng.c?revision=78081&view=markup#l575

the criteria are not an exact match because the png crate does not support all the
png chunk types
https://github.com/image-rs/image-png/issues/116

if the criteria result in a png being converted or skipped the final result should be the same.

in one case the conversion will be done by pdftex (at runtime)
in the other case the conversion will be done by png2pdf -

both conversions should give the same result.

* include tests in png2pdf Dockerfile

* [clsi] explicitly disable png2pdf conversion for project conversion

* [clsi] png2pdf: count converted files

* [png2pdf] bump date in docker image tag

* [web] make draft-setting option wider when png2pdf is available

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: d0d952ee009bf93c72bba2ffe763ae0160d396e4
2026-09-17 11:17:28 +00:00
Jakob Ackermann 966728d5a2 [clsi-lb] add health check and alerting for stalled poll loop (#35117)
* [clsi-lb] add settings entry for pollInterval

* [clsi-lb] add health check and alerting for stalled poll loop

* [k8s] clsi-lb: switch livenessProbe to config writer

* Revert "[k8s] clsi-lb: switch livenessProbe to config writer"

This reverts commit ae0c8624528db4bdf35a27fac836ffeecfc1682c.

* [clsi-lb] fix docker build

* [clsi-lb] throw when app.listen fails

* [clsi-lb] expose gc

* [clsi-lb] refactor lastPolledAt to Date

GitOrigin-RevId: 88542d9c10d5f63a4283ffab32badcdea1d3a95a
2026-09-17 11:16:48 +00:00
Jakob Ackermann b6208ee52f [real-time] gracefully handle undefined meta.tc (#35049)
GitOrigin-RevId: c375373585e4cb2405eac778bbe2dd987c342a19
2026-09-17 11:15:38 +00:00
Jakob Ackermann 9f1a2e058a [web] avoid sending empty sharejs op (#35066)
* [web] add frontend tests for sharejs transform

* [web] extend tests for sharejs transform to flush eventually

* [web] full coverage for sharejs transform

* [web] add tests for sharejs events

* [web] add tests for sharejs callbacks

* [web] avoid sending empty sharejs op

* [web] add tests for resending after reconnecting

* [web] avoid resending of empty sharejs op after reconnecting

GitOrigin-RevId: 226fe47a7069cb877fd5a60454f86cc5855d9a0e
2026-09-17 11:15:33 +00:00
Jakob Ackermann b51275ca2d [real-time] add strict validation for incoming applyOtUpdate messages (#35045)
GitOrigin-RevId: 13156762e320db9c177c3cf82195baff42f68141
2026-09-17 11:14:16 +00:00
Jakob Ackermann 7932c99cfc [saas-e2e] add tests for reviewer role (#35024)
* [real-time] update tests for more realistic applyOtUpdate messages

* [saas-e2e] add tests for reviewer role

GitOrigin-RevId: f0a5307230beb00be3a1387129e06eb5b2106c09
2026-09-17 11:14:09 +00:00
Jakob Ackermann 8e2edc4d8d [web] remove limit when fetching split-tests (#35010)
GitOrigin-RevId: aa166d28359da83385b632ba2077a85384d08c36
2026-09-17 11:13:03 +00:00
Jakob Ackermann a6c98365d9 [web] use client-side filtering for split tests in admin panel (#34975)
* [web] use client-side filtering for split tests in admin panel

Filtering on non-indexed fields is not allowed with notablescan.

* [web] add initial value for DEFAULT_FILTERS.active

* [web] unset error before fetching split tests

GitOrigin-RevId: 0813873c5a90d57c4fdbfd0043fcc325f00408aa
2026-06-26 08:08:10 +00:00
Jakob Ackermann 1b553c0455 [migrations] only apply non-blocking migrations in CI (#34665)
* [migrations] only apply non-blocking migrations in CI

* [migrations] use "yarn run migrations" instead of "npm run migrations"

GitOrigin-RevId: d9f96db398adf2febcd82333295fb8d5eab741bb
2026-06-26 08:08:05 +00:00