[github-sync] Surface "project too large" errors instead of hanging (#35183)

* [github-sync] Surface "project too large" errors instead of hanging

A GitHub sync of a project whose total editable text exceeds github-sync's
7MB request body limit would hang silently: the modal stayed on "Importing
and merging changes in GitHub" and then closed with no error.

Root cause was a chain of three issues:

1. github-sync's ErrorMiddleware did not recognise the body-parser
   PayloadTooLargeError, so it fell through to a generic 500.

2. web's _reportError rethrew any non-4xx error instead of responding, and
   several github-sync controller handlers were not wrapped in expressify.
   On Express 4 the rethrow became an unhandled rejection and no HTTP
   response was ever sent, so the browser request hung until the socket died.

3. the frontend read error.data.error without a null check, which threw a
   render-time TypeError when the fetch failed at the network level (as it
   did once the hung request was aborted).

Fixes:
- github-sync: add ProjectTooLargeError and map the body-parser 413 to it.
- web: _reportError always responds (500 for unexpected errors) and every
  controller handler is expressified as a backstop.
- frontend: null-safe error.data?.error, a friendly message for the
  too-large case, and a generic message for server errors.

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

* [github-sync] Refine project-too-large error copy per content guidance

Apply the content-design system's error-message guidance to the new
github_project_too_large_error string: use a contraction, drop the
redundant "reduce the size of your project" restatement and the formal
"Please", keeping the problem/reason/next-step structure.

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

* [github-sync] Use plain string matcher in project-too-large CT test

Address review feedback: prefer a plain string matcher with exact:false
over a regex, per the repo's testing guidance.

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

* [github-sync] Link to the file-limits docs from the too-large error

Add a "Learn about GitHub sync file limits" link below the project-too-large
error, pointing to the GitHub synchronization file-limits documentation, so
users can find out what the limits are and how to stay under them.

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

* [github-sync] Use rel="noopener noreferrer" on the file-limits docs link

The eslint rule for external docs.overleaf.com links requires
rel="noopener noreferrer" (not just noreferrer) with target="_blank" to
prevent reverse-tabnabbing.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
GitOrigin-RevId: 16f701a85fb4ae049c208e03e328ad80049e8579
This commit is contained in:
Lucie Germain
2026-09-17 11:31:13 +00:00
committed by Copybot
co-authored by Claude Fable 5
parent 7f74e5b1d2
commit 975cd99871
2 changed files with 4 additions and 0 deletions
@@ -815,11 +815,13 @@
"github_merge_failed_error": "",
"github_no_master_branch_error": "",
"github_private_description": "",
"github_project_too_large_error": "",
"github_public_description": "",
"github_repository_diverged": "",
"github_symlink_error": "",
"github_sync_description": "",
"github_sync_error": "",
"github_sync_file_limits_link": "",
"github_sync_repository_not_found_description": "",
"github_timeout_error": "",
"github_too_many_files_error": "",
+2
View File
@@ -1054,12 +1054,14 @@
"github_merge_failed_error": "Your changes in __appName__ and GitHub could not be automatically merged.",
"github_no_master_branch_error": "This repository cannot be imported as it is missing a default branch. Please make sure the project has a default branch",
"github_private_description": "You choose who can see and commit to this repository.",
"github_project_too_large_error": "This project is too large to sync with GitHub. There’s a limit on the total size of a project’s editable text files. Try removing or shrinking large text files, then sync again.",
"github_public_description": "Anyone can see this repository. You choose who can commit.",
"github_repository_diverged": "The default branch of the linked repository has been force-pushed. Pulling GitHub changes after a force push can cause Overleaf and GitHub to get out of sync. You might need to push changes after pulling to get back in sync.",
"github_successfully_linked_description": "Thanks, we’ve successfully linked your GitHub account to __appName__. You can now export your __appName__ projects to GitHub, or import projects from your GitHub repositories.",
"github_symlink_error": "Your GitHub repository contains symbolic link files, which are not currently supported by Overleaf. Please remove these and try again.",
"github_sync_description": "With GitHub Sync you can link your __appName__ projects to GitHub repositories, create new commits from __appName__, and merge commits from GitHub.",
"github_sync_error": "Sorry, there was a problem checking our GitHub service. Please try again in a few moments.",
"github_sync_file_limits_link": "Learn about GitHub sync file limits",
"github_sync_repository_not_found_description": "The linked repository has either been removed, or you no longer have access to it. You can set up sync with a new repository by cloning the project and using the ‘GitHub’ menu item. You can also unlink the repository from this project.",
"github_sync_unlink_error": "Sorry, we weren’t able to unlink your GitHub account. Please try again in a few moments.",
"github_timeout_error": "Syncing your Overleaf project with GitHub has timed out. This may be due to the overall size of your project, or the number of files/changes to sync, being too large.",