Commit Graph
329 Commits
Author SHA1 Message Date
yu-i-i 04b76c7f84 Sandboxed compiles: cwd argument was added to CommandRunner
see upstream commit ce6f9b8
2026-09-22 02:41:41 +02:00
yu-i-i 425594757e Revert "[clsi] remove locking from docker actions (#32373)"
This reverts commit d66a856baa.
2026-09-22 02:41:41 +02:00
yu-i-i bce42463b6 Sandboxed compiles: avoid destroying containers of recently accessed projects
see upstream commit a9c4138
  here is an appropriate DockerRunner.mjs patch
2026-09-22 02:41:40 +02:00
yu-i-i ec41d3c9a2 Sandboxed compiles: convert DockerRunner to ESM 2026-09-22 02:41:40 +02:00
yu-i-i a0acf2f72a Sandboxed Compiles: support configurable texlive image root via env var 2026-09-22 02:41:38 +02:00
yu-i-i c83f53d0b6 Fix: always include repository prefix in sandboxed compiles image name 2026-09-22 02:41:35 +02:00
yu-i-i 79c2579d3b Allow selecting a TeX Live image for a project 2026-09-18 20:42:00 +02: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
Brian Gough 538d04ddb8 Merge pull request #36664 from overleaf/lg-wordcount-sync-resources
[clsi] sync project resources for word count

GitOrigin-RevId: fe96c936e7aba22ab94416a102dcb7e4835e1256
2026-09-17 12:03:09 +00:00
Jimmy Domagala-TangandTim Gibbon baa9cf78d9 Adding 2025 and 2026 incremental compiles options (#35850)
* feat: adding 2025 and 2026 incremental compiles options

* feat: remove dmtcp from compiler list and autoselect checkpointing version with labs inclusion

* feat: updating seccomp profile for checkpointing

* feat: disable non-premium dmtcp compiles, and align checkpoint version detection between clsi and web

* feat: adding in reminder of checkpoint experiment, and using session based split test retrieval

* Increase Packer build.sh timeout from 1h15m to 1h30m as build takes approx 1h

* fix: moving checkpointing check from tag name based to hasCheckpointing flag set as part of allowed_images, and removing uneeded seccomp rule

* feat: move variant/ image selection to CLSI, and have web control only what options to set for a compile. removing uneeded extra variants from webs list of allowed images

* feat: adding compile timer as a query string as well

---------

Co-authored-by: Tim Gibbon <tim.gibbon@overleaf.com>
GitOrigin-RevId: cdbdf76a62dcd5a585925f18d64b6cb9cd6ed373
2026-09-17 12:00:46 +00:00
Brian Gough 6b3d95cea4 add optimisable png count and compile stats to compile-with-optimizable-pngs event (#36279)
* add count of optimisable pngs to HistoryResourceWriter

* add optimisable png count and compile stats to compile-with-optimizable-pngs event

GitOrigin-RevId: 5c528d727473ec2d3082845d8d5b60844f3434f6
2026-09-17 11:49:41 +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
Jimmy Domagala-TangandBrian Gough 35ba44f22b Adding project PNG optimization check to compile analytics (#35925)
* feat: adding in check for if the project could have had a png optimized as part of the compile-result-backend event

* feat: updating using new compile metrics to filter for only eligible project compiles

* move projectHasUnconvertedPngs to stats

* add e2e test for projectHasUnconvertedPngs

* add unit tests for compile-with-optimizable-pngs analytics event

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: 97e9d184420c34fc1d3e9f6cfe63f6b916f0202f
2026-09-17 11:44:29 +00:00
Brian Gough fd87cf1ddd Merge pull request #35966 from overleaf/bg-return-optimised-image-stats-and-timings
return image stats and timings in compile response

GitOrigin-RevId: ec700b8cb6680bfd8f28ad0f1f2bbdb0479398bc
2026-09-17 11:44:22 +00:00
Brian Gough 9ff7e66b99 Merge pull request #35504 from overleaf/bg-png2pdf-on-slow-images-only
run png2pdf on slow images only

GitOrigin-RevId: 2d0ecd35bfcfc308773502c28eeb5a722055a5a9
2026-09-17 11:29:12 +00:00
Brian Gough aad50452af Merge pull request #35333 from overleaf/bg-png2pdf-minimum-size-threshold
enforce a minimum size threshold on png2pdf conversions

GitOrigin-RevId: fa558afb5455ff5d0373e3d50e57f7207a923fcb
2026-09-17 11:29:09 +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
Brian Gough 0dd69cb143 add clsi metrics for png2pdf (#35239)
* add clsi metrics for png2pdf

* update metrics to use png2pdf boolean

GitOrigin-RevId: 0d96020b659b31cdf16f5d26c128928dae45f8f9
2026-09-17 11:20:34 +00:00
Jakob Ackermann f62bd990d4 [clsi-cache] add support for png2pdf (#35200)
GitOrigin-RevId: ebc505528f2a001923acf2d39e6dd43107f5f35e
2026-09-17 11:20:00 +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
Brian Gough 6f9b7031f4 pass through checkpoint setting (#34631)
GitOrigin-RevId: 50e9791b468253ee966b0eac822b2a01321a0ece
2026-06-16 08:07:14 +00:00
Brian Gough be4108a573 add glob matching to isExtraneousFile (#34633)
GitOrigin-RevId: f12aedb52195cfc9e3254936f1db6189f49c3f37
2026-06-16 08:07:09 +00:00
Mathias Jakobsen b7946791f4 Merge pull request #34553 from overleaf/mj-pandoc-html-mathml
[clsi] Add mathml option to HTML export

GitOrigin-RevId: c0736f0ae78020c2c554e8aaed9472f050323fd4
2026-06-16 08:06:25 +00:00
Jakob Ackermann 58970cd6ea [clsi] prepare for non-representative clsiServerIds (#34546)
* [clsi] forward instanceType to web

* [clsi] expose zone in compile response

* [clsi-perf] add new fields for instanceType and zone

* [clsi] expose isPreEmptible flag in compile response

* [clsi-perf] also add isPreEmptible field

* [clsi] rename isPreEmptible -> isSpotInstance

GitOrigin-RevId: 2bc2d772e0b14da83afb51f5f3e4fefd3f60b733
2026-06-15 08:08:00 +00:00
Mathias Jakobsen f52dccbee5 Merge pull request #34350 from overleaf/mj-pandoc-texinputs
[clsi] Add TEXINPUTS variable to compressing conversion

GitOrigin-RevId: 7d708f106f6abf344707a87ba75a6e41f4023bd8
2026-06-09 08:06:05 +00:00
Mathias Jakobsen fc31a88767 Merge pull request #34145 from overleaf/ds-download-html-using-pandoc-clsi-1
[CLSI] Download as HTML feature

GitOrigin-RevId: 374101c1f957a00eda423a6be0363c08b5de7a95
2026-06-05 08:06:03 +00:00
Jakob AckermannandBrian Gough df61bfc788 [clsi] initial version of /convert/pdf-to-jpeg (#33752)
* [monorepo] consolidate clsi-lb host/ip env-vars

Target env-var is CLSI_LB_HOST. Keep CLSI_LB_IP populated for a week.

* [clsi] initial version of /convert/pdf-to-jpeg

* [rails] use fake-secrets in CI and Codespaces

* [rails] adapt tests for using clsi to convert PDFs to image

* [rails] add rake task for comparing clsi conversion with transloadit

* [clsi] double check that output.jpg is a regular file

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

* [clsi] fix composing basename

* [monorepo] fix clsi-lb host env-var post merge

* [monorepo] sort dev-environment.env hosts

* [rails] use local pdf file rather than downloading it again

Download from the old renderer code path still. It's dead code.

* [terraform] clsi: enable pdf to jpg conversion

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: 5ecaa8559d299486340bb3961f06b29f7c4dfcca
2026-06-05 08:05:55 +00:00
Jakob Ackermann e7a202a0bf [clsi] fix duplicate import of Errors module (#34068)
GitOrigin-RevId: e1dec5e5d439e5d178f9f7400c0873e0be6e90f8
2026-05-28 08:08:10 +00:00
Jakob Ackermann 7e4820f0b0 [clsi] migrate convert project to document to compile from history (#33985)
* [clsi] add request flag for isCompileFromHistory

* [clsi] derive cacheKey for history snapshot from compile dir

* [clsi] migrate convert project to document to compile from history

* [clsi] address review feedback

* [web] determine root doc at the time of converting the project

* [web] wait for flush before starting document conversion

* [saas-e2e] add tests for root doc override when converting project

GitOrigin-RevId: 71c578030949b89f3a74e7f7ab882dfa9c98c17a
2026-05-28 08:08:06 +00:00
Mathias Jakobsen 68e9572fbb [clsi] Forward pandoc errors to web (#33971)
* [clsi] Forward pandoc errors to web

* [clsi] Remove unused import

* [clsi] Align warning logs

* [clsi] Update HTTP response for errors

* [clsi] Update acceptance test with 422

* [clsi] Always return json body on 422

* [clsi] Include stderr in logs for non user facing errors

GitOrigin-RevId: 4284c8d4e8b7b45eac4997cd9e52ca4894b20412
2026-05-28 08:07:58 +00:00
Miguel Serrano 4cfaea4621 [clsi] Fix compile stop detection in local runner (#33024)
* [clsi] Fix compile stop detection in local runner

* Tighten compilation cancelled message

* Cleanup process PID on `error`

GitOrigin-RevId: 61495466b98c127402b256d629ea58e7b9be6df7
2026-05-28 08:05:44 +00:00
Mathias Jakobsen ce6f9b8e8c Merge pull request #33705 from overleaf/mj-clsi-cwd-for-conversions
[clsi] Add cwd argument to CommandRunner and use to simplify conversions

GitOrigin-RevId: 5333e3262a99e602ab5470ae1e23facb5b28a170
2026-05-19 08:04:51 +00:00
Mathias Jakobsen 32da6548c8 Merge pull request #33277 from overleaf/mj-pandoc-clsi-two-step-download
[clsi] Use clsi-nginx for downloading pandoc exports

GitOrigin-RevId: b6013fae6f53c7af714634d700ceed491d724653
2026-05-08 08:09:18 +00:00
Mathias Jakobsen ae31ad218c Merge pull request #33104 from overleaf/mj-pandoc-arguments
[clsi] Add pandoc arguments for better conversions

GitOrigin-RevId: 76cddc5959237d6d2801c56471d8d3f63d111200
2026-05-08 08:09:12 +00:00
Mathias Jakobsen 5dc67db403 Merge pull request #33089 from overleaf/ds-export-md-files-pandoc
[WEB + CLSI] Download as markdown

GitOrigin-RevId: 181eddf2513e9c5edacbab37e93f9cac2191ee1a
2026-05-08 08:09:07 +00:00
Mathias Jakobsen eddcc5a42e Merge pull request #32857 from overleaf/ds-pandoc-import-md
[WEB + CLSI] Import markdown files using pandoc

GitOrigin-RevId: adad7831ddb13a8fcb8063871166bde13cbbf1b6
2026-05-08 08:09:02 +00:00
Davinder Singh be5a7b56c8 [WEB + CLSI] Download as docx file feature (#32851)
* using CLSI logic for fetching the project contents and skip the .zip export

* Use unique conversion directory for project-to-docx export to avoid corrupting the shared compile
  directory when a compile runs concurrently

* Remove X-Accel-Buffering header — not needed as CLSI does not run behind nginx

* moving log before sending the data

* Return CLSI stream directly instead of buffering to disk on web

  Previously convertProjectToDocx wrote the CLSI response to a temp file
  on disk, then the controller read it back to stream to the client.
  Now the stream is returned directly and piped to the response,
  avoiding unnecessary disk I/O on the web server.

* Use href redirect for docx export instead of fetching blob into memory

* making functions and files more generic so they can be used in future for other documents exports as well

* adding export-docx split test

* adding unit tests

* adding cypress E2E test

* format:fix

* renaming the route to download from convert

* adding new icon for export docx button

* format:fix

* remove unused showExportDocumentErrorToast export and adding guard against invalid Content-Length header from CLSI

* format:fix

* refactor(clsi): move promisify(parse) into RequestParser

* refactor: generic conversion endpoint with type as route
  param

* refactor: use type→extension map for validated conversion types

* refactor(clsi): remove --standalone flag and fix rejection test

* fixing the href in cypress test

* renaming function

* adding type to Metrics.inc

* fix: rename exportProjectDocument, add WithLock wrapper and metrics type label

* format:fix

* fix: hide docx export from anonymous users and add WithLock wrapper

* format fix

* remove redundant Content-Length validation from DocumentConversionManager

* format:fix

* removing trailing icon

GitOrigin-RevId: e9764fefac2c4b625d23be9e942ea4a8b283c70d
2026-04-24 08:06:10 +00:00
Jakob Ackermann 926d6bccd7 [clsi] reduce write traffic to clsi-cache from free users (#32958)
GitOrigin-RevId: c01cc21c3c82f361c7d82843e65bb087b21434ed
2026-04-22 08:05:59 +00:00
Jakob Ackermann 0544aded40 [clsi] handle draft mode and tikzexternalize as part of sync phase (#32516)
* [clsi] handle draft mode and tikzexternalize as part of sync phase

* [clsi] emit empty string from SafeReader on ENOENT

* [clsi] persist history state after clearing dirty state without changes

GitOrigin-RevId: d9dcd2e6887017f7935b5e95bdbdc6e11a3b18f5
2026-03-31 08:07:19 +00:00
Jakob AckermannandAnna Claire Fields d66a856baa [clsi] remove locking from docker actions (#32373)
* [clsi] remove locking from docker actions

Start:
- We have an in-memory lock on the compile request

Destroy:
- as part of run: see above
- as part of cleanup: we check the last access time now, so it cannot
  happen concurrent to compiling anymore.

Co-authored-by: Anna Claire Fields <anna.fields@overleaf.com>

* [clsi] update comment

---------

Co-authored-by: Anna Claire Fields <anna.fields@overleaf.com>
GitOrigin-RevId: a58df45416ae31c0b38d5efec7f9371d747303df
2026-03-27 09:06:28 +00:00
Mathias JakobsenandJakob Ackermann 9c97876268 [web]+clsi] Allow docx import via pandoc (#32004)
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 246b3290ec04867f71545b1a7c5d95d0f68379ff
2026-03-27 09:06:23 +00:00
Jakob AckermannandEric Mc Sween 07397bbdde [clsi] avoid server error when clearing cache while compiling (#32349)
* [clsi] avoid server error when clearing cache while compiling

* [clsi] tweak API around releasing locks

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

---------

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
GitOrigin-RevId: d3f171467d3bc26941758dd333f30049b37a05c8
2026-03-23 09:06:18 +00:00
Jakob Ackermann 3aa69c6ffa [k8s] clsi-cache: double the number of shards (#32323)
* [k8s] clsi-cache: double the number of shards

* [monorepo] add missing clsi-cache env vars to dev-env

* [clsi] flip direction of clsi-cache shard migration

* [clsi] remove upper bound from clsi-cache shard migration

GitOrigin-RevId: a325a11c3ac9e22a12ad2d8ea802b91d2e175e24
2026-03-20 09:07:11 +00:00
Jakob Ackermann 6377624d25 [clsi] ignore download errors for binary files in compile from history (#32263)
GitOrigin-RevId: 3c1940b2d56701ec4b07d1457ee1af2de317a047
2026-03-19 09:07:00 +00:00
Brian Gough 9f1e4d99e5 handle old versions of latexmk in run count extraction (#30597)
* handle old versions of latexmk in run count extraction

the log lines for the run number change from stderr to stdout in TL2022

* extend SimpleLatexFileTest to include TL2017

* reset metrics for each scenario in SimpleLatexFileTests

* fix buildscript merge conflict

GitOrigin-RevId: fb74f2025d21ddf43be6a3b90ac6f7df4d975db6
2026-03-19 09:06:55 +00:00
Jakob Ackermann 69a7927267 [clsi] shard clsi_compiles_total metric by syncType (#32255)
GitOrigin-RevId: 43111697323ec6697ef5f42cf17807ea564181a0
2026-03-19 09:05:55 +00:00
Jakob Ackermann c2130dccb9 [clsi] use cheapest gzip compression level for history snapshot (#32251)
memoir manual with 1.5MiB snapshot:

level |load/decompress time | store/compress time |  size   | ratio | total sync time
 ---  | ---                 | ---                 |  ---    | ---   | ---
 6    | 18ms                | 57ms                |  412KiB | 26%   | 88ms
 1    | 17ms                | 28ms                |  509KiB | 32%   | 53ms
 0    |  8ms                | 10ms                | 1578KiB | 0%    | 33ms

total sync: read snapshot, walk dir, sync files to disk, save snapshot

GitOrigin-RevId: a2b1ee063af5aa749014f942db5e08bb1e685848
2026-03-19 09:05:50 +00:00
Jakob Ackermann f947b549e4 [clsi-perf] migrate to compile from history mode (#32234)
* [clsi] only download history snapshot from clsi-cache when enabled

* [clsi-perf] migrate to compile from history mode

GitOrigin-RevId: 2dd54e032bd85d6335488741c039a5a1bd60090d
2026-03-18 09:07:51 +00:00
Jakob Ackermann 2e389c5a41 [rails] migrate compiles of conversions/submissions to history mode (#32053)
* [saas-e2e] test gallery templates with binary file

* [rails] add make target for fixing rubocop errors

* [rails] migrate compiles of conversions/submissions to history mode

* [rails] forward version to clsi request

* [rails] trim down compile request

* [saas-e2e] source v1 secrets after make install

GitOrigin-RevId: 65269e1df1051c9f3b4f1813d2e9dcf32a01be50
2026-03-18 09:07:22 +00:00
Jakob Ackermann d5b55b831d [clsi] make last access tracking more robust (#32192)
* [clsi] do not overwrite last access during initial scan

* [clsi] cleanup submission cache 5-10min after startup

* [clsi] address review comments

GitOrigin-RevId: e03beec1b3deaee50629ada72b0242a8a2b2ae66
2026-03-18 09:07:10 +00:00