fsanyoto commited on
Commit
a2d8af4
·
verified ·
1 Parent(s): 95215b6

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "767305c0",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "8af18007",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 767305c0
 
1
+ 8af18007
platform/core/sheets.py CHANGED
@@ -56,6 +56,7 @@ recomputes them. A cell goes stale by being marked stale, not by being read.
56
  from __future__ import annotations
57
 
58
  import copy
 
59
  import hashlib
60
  import json
61
  import math
@@ -1850,6 +1851,17 @@ def _read_workbook_doc(st, key):
1850
  "Try again in a moment.") from exc
1851
 
1852
 
 
 
 
 
 
 
 
 
 
 
 
1853
  def get_workbook(st, workbook_id):
1854
  """One workbook, or a named refusal when the document is not there."""
1855
  wid = _slug_id(workbook_id)
@@ -1857,7 +1869,15 @@ def get_workbook(st, workbook_id):
1857
  if not doc or not doc.get("id"):
1858
  raise SheetRefusal("workbook_missing",
1859
  "That workbook no longer exists.")
1860
- return _carry_write_logs(migrate_workbook(doc), doc)
 
 
 
 
 
 
 
 
1861
 
1862
 
1863
  def put_workbook(st, workbook_id, raw, expect_rev=None, *, actor="", actor_name="", lossless=False):
 
56
  from __future__ import annotations
57
 
58
  import copy
59
+ import functools
60
  import hashlib
61
  import json
62
  import math
 
1851
  "Try again in a moment.") from exc
1852
 
1853
 
1854
+ @functools.lru_cache(maxsize=4)
1855
+ def _validated_workbook_text(raw_text):
1856
+ """Cache pure normalization by the entire stored JSON, never by id or revision.
1857
+
1858
+ Values and permission decisions are still resolved by the caller. The immutable JSON result
1859
+ is decoded for each read so editing one returned workbook cannot change another caller's.
1860
+ Only documents below the size bound in get_workbook reach this four-entry cache.
1861
+ """
1862
+ return json.dumps(migrate_workbook(json.loads(raw_text)), separators=(",", ":"))
1863
+
1864
+
1865
  def get_workbook(st, workbook_id):
1866
  """One workbook, or a named refusal when the document is not there."""
1867
  wid = _slug_id(workbook_id)
 
1869
  if not doc or not doc.get("id"):
1870
  raise SheetRefusal("workbook_missing",
1871
  "That workbook no longer exists.")
1872
+ try:
1873
+ raw_text = json.dumps(doc, separators=(",", ":"))
1874
+ except (TypeError, ValueError):
1875
+ raw_text = None
1876
+ if raw_text is not None and len(raw_text) <= 4 * 1024 * 1024:
1877
+ book = json.loads(_validated_workbook_text(raw_text))
1878
+ else:
1879
+ book = migrate_workbook(doc)
1880
+ return _carry_write_logs(book, doc)
1881
 
1882
 
1883
  def put_workbook(st, workbook_id, raw, expect_rev=None, *, actor="", actor_name="", lossless=False):
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- dcb680d1d275cccc50e9f6c9c899dbd8405f9e10932707e40eac1c78bb169bcb
 
1
+ 5a26c0461bdafb850d7e88223d907926c79e0e3ca113e047936193053dfa32fc