From 2e3025a60609fc3a740577684264bc175d7face4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero=20Cantero?= Date: Thu, 22 Oct 2026 17:37:20 +0200 Subject: [PATCH] :books: Streamline the size-gate comments in files_branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shorten the rationale above the size gates and the docstring of get-branching-limits, and say where the numbers were measured. Signed-off-by: Álvaro Tejero Cantero --- backend/src/app/rpc/commands/files_branch.clj | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/app/rpc/commands/files_branch.clj b/backend/src/app/rpc/commands/files_branch.clj index 656d15f51d..9bbd09e371 100644 --- a/backend/src/app/rpc/commands/files_branch.clj +++ b/backend/src/app/rpc/commands/files_branch.clj @@ -63,12 +63,9 @@ ;; --- Size gates ;; -;; Nothing in this feature limited size before, so the failure mode at -;; enterprise scale was a timeout: an operation that never returns and a -;; user who cannot tell whether it is working. Every limit below is a -;; measured cost divided into a 30 s budget and then halved, from the -;; numbers below: -;; +;; For large documents, we are currently slow. To avoid user frustration, we +;; set limits based on waits of at most 30s, and then halve them: + ;; * a merge on the 21,169-shape design system costs about 6 s, which is ;; 0.28 ms per shape, so 30 s is about 105,000 shapes -> 50,000. ;; * a whole-file comparison of 48 pages costs 402 ms, which is 8.4 ms @@ -77,9 +74,10 @@ ;; * one value-derived squash already emits about 19,000 changes for a ;; one-page delta, so a depth limit has to clear that with room -> ;; 100,000 changes. +;; (numbers measured on a devenv running on a laptop) ;; ;; A refusal names the limit, the actual value, and what to do instead. -;; None of them truncates anything. + (defn- branching-limit [key default] @@ -139,9 +137,9 @@ [:map {:title "get-branching-limits"}]) (sv/defmethod ::get-branching-limits - "The size limits this instance refuses beyond, so the UI can publish them - before a user meets one. Read from config on every call: the limits have - exactly one home, and a page that states them must not keep its own copy." + "Return the maximum number of shapes, pages and changes this + instance supports. They are advertised on the UI to prevent + frustration. Read from config on every call to prevent drift." {::doc/added "2.16" ::sm/params schema:get-branching-limits} [_cfg _params] @@ -1904,3 +1902,5 @@ (delete-branch! cfg branch {:profile-id profile-id :session-id session-id})) (audited {:status :deleted} tpoint :delete-branch)))))) + +