fsanyoto commited on
Commit
a35106a
·
verified ·
1 Parent(s): 7907db2

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "d89e0053bd",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "a01a5389d",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- d89e0053bd
 
1
+ a01a5389d
platform/harness/datastore.py CHANGED
@@ -251,6 +251,8 @@ ENTITIES = {
251
  # JSON list of ALL ids. Declared explicitly: a 2-element m2m read would otherwise be
252
  # indistinguishable from an m2o (id, name) pair in _flatten.
253
  "m2m": ["agent_ids"],
 
 
254
  },
255
  "product_product": {
256
  "model": "product.product", "archivable": True,
@@ -1394,11 +1396,7 @@ def _ensure_sync_state(con):
1394
  cursor_wd VARCHAR, rows BIGINT, updated_at VARCHAR)""")
1395
 
1396
 
1397
- # These many2many fields store all source names, despite their singular `_id` suffix.
1398
- NAMED_M2M_FIELDS = {"category_id": "res.partner.category"}
1399
-
1400
-
1401
- def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1402
  out = {"id": rec["id"]}
1403
  for f in m2m:
1404
  v = rec.get(f) or []
@@ -1407,7 +1405,7 @@ def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1407
  out[f] = json.dumps(list(v)) if v else None
1408
  for f in fields:
1409
  v = rec.get(f)
1410
- if f in NAMED_M2M_FIELDS:
1411
  names = (named_m2m_names or {}).get(f, {})
1412
  if any(tag_id not in names or not names[tag_id] for tag_id in (v or [])):
1413
  raise RuntimeError("Source tag names could not be resolved")
@@ -1437,10 +1435,10 @@ def _flatten(rec, fields, m2m=(), *, analytic_names=None, named_m2m_names=None):
1437
  return out
1438
 
1439
 
1440
- def _flatten_records(recs, fields, m2m=()):
1441
  """Resolve analytic and tag names once per source page, without a shared tenant cache."""
1442
  named_m2m_names = {}
1443
- for field, model in NAMED_M2M_FIELDS.items():
1444
  if field not in fields:
1445
  continue
1446
  ids = sorted({tag_id for rec in recs for tag_id in (rec.get(field) or [])})
@@ -1461,7 +1459,7 @@ def _flatten_records(recs, fields, m2m=()):
1461
  [("id", "in", ids[start:start + 1000]), ("active", "in", [True, False])],
1462
  ["name"], limit=1000, order="id asc")
1463
  names.update({account["id"]: account.get("name") for account in accounts})
1464
- return [_flatten(rec, fields, m2m, analytic_names=names,
1465
  named_m2m_names=named_m2m_names) for rec in recs]
1466
 
1467
 
@@ -1620,7 +1618,7 @@ def _cols(spec):
1620
  cols = ["id BIGINT PRIMARY KEY"]
1621
  for f in spec["fields"]:
1622
  base = f.removesuffix("_id")
1623
- if f in NAMED_M2M_FIELDS:
1624
  cols.append(f"{f} VARCHAR")
1625
  elif f.endswith("_id") or f in MANY2ONE_FIELDS:
1626
  cols += [f"{base}_id BIGINT", f"{base}_name VARCHAR"]
@@ -1657,9 +1655,9 @@ def _ensure_columns(con, key, spec):
1657
  return added
1658
 
1659
 
1660
- def _field_cols(f):
1661
  """The store column(s) one spec field materialises into (m2o fields become _id + _name)."""
1662
- if f in NAMED_M2M_FIELDS:
1663
  return [f]
1664
  if f == "analytic_distribution":
1665
  return [f, f + "_details"]
@@ -1730,7 +1728,7 @@ def _backfill_columns(con, key, spec, log=print, max_batches=None, *, repeat=Fal
1730
  last, n = (st[1] or 0, st[2] or 0) if st else (0, 0)
1731
  if last:
1732
  log(f" {key}: {operation} resuming at id {last:,} ({n:,} rows already done)")
1733
- cols = [c for f in fields for c in _field_cols(f)]
1734
  setter = ", ".join(f"{c}=?" for c in cols)
1735
  pages, changed = 0, 0
1736
  while True:
@@ -1740,7 +1738,7 @@ def _backfill_columns(con, key, spec, log=print, max_batches=None, *, repeat=Fal
1740
  break
1741
  if any(field not in rec for rec in recs for field in fields):
1742
  raise RuntimeError(f"{key}: column backfill response omitted a requested field")
1743
- rows = _flatten_records(recs, fields)
1744
  if repeat:
1745
  # UPDATE ... RETURNING counts actual changed mirror rows. Fetched,
1746
  # identical and absent rows must not trigger a product-store rebuild.
@@ -1810,7 +1808,8 @@ def _backfill_m2m(con, key, spec, log=print):
1810
  def _upsert(con, key, spec, recs):
1811
  if not recs:
1812
  return
1813
- rows = _flatten_records(recs, spec["fields"], spec.get("m2m") or ())
 
1814
  colnames = [c.split()[0] for c in _cols(spec)]
1815
  ids = [r["id"] for r in rows]
1816
  con.execute(f"DELETE FROM {key} WHERE id IN ({','.join(map(str, ids))})")
 
251
  # JSON list of ALL ids. Declared explicitly: a 2-element m2m read would otherwise be
252
  # indistinguishable from an m2o (id, name) pair in _flatten.
253
  "m2m": ["agent_ids"],
254
+ # Named many2many fields store source names despite their singular `_id` suffix.
255
+ "named_m2m": {"category_id": "res.partner.category"},
256
  },
257
  "product_product": {
258
  "model": "product.product", "archivable": True,
 
1396
  cursor_wd VARCHAR, rows BIGINT, updated_at VARCHAR)""")
1397
 
1398
 
1399
+ def _flatten(rec, fields, m2m=(), *, named_m2m=None, analytic_names=None, named_m2m_names=None):
 
 
 
 
1400
  out = {"id": rec["id"]}
1401
  for f in m2m:
1402
  v = rec.get(f) or []
 
1405
  out[f] = json.dumps(list(v)) if v else None
1406
  for f in fields:
1407
  v = rec.get(f)
1408
+ if f in (named_m2m or {}):
1409
  names = (named_m2m_names or {}).get(f, {})
1410
  if any(tag_id not in names or not names[tag_id] for tag_id in (v or [])):
1411
  raise RuntimeError("Source tag names could not be resolved")
 
1435
  return out
1436
 
1437
 
1438
+ def _flatten_records(recs, fields, m2m=(), *, named_m2m=None):
1439
  """Resolve analytic and tag names once per source page, without a shared tenant cache."""
1440
  named_m2m_names = {}
1441
+ for field, model in (named_m2m or {}).items():
1442
  if field not in fields:
1443
  continue
1444
  ids = sorted({tag_id for rec in recs for tag_id in (rec.get(field) or [])})
 
1459
  [("id", "in", ids[start:start + 1000]), ("active", "in", [True, False])],
1460
  ["name"], limit=1000, order="id asc")
1461
  names.update({account["id"]: account.get("name") for account in accounts})
1462
+ return [_flatten(rec, fields, m2m, named_m2m=named_m2m, analytic_names=names,
1463
  named_m2m_names=named_m2m_names) for rec in recs]
1464
 
1465
 
 
1618
  cols = ["id BIGINT PRIMARY KEY"]
1619
  for f in spec["fields"]:
1620
  base = f.removesuffix("_id")
1621
+ if f in (spec.get("named_m2m") or {}):
1622
  cols.append(f"{f} VARCHAR")
1623
  elif f.endswith("_id") or f in MANY2ONE_FIELDS:
1624
  cols += [f"{base}_id BIGINT", f"{base}_name VARCHAR"]
 
1655
  return added
1656
 
1657
 
1658
+ def _field_cols(f, *, named_m2m=None):
1659
  """The store column(s) one spec field materialises into (m2o fields become _id + _name)."""
1660
+ if f in (named_m2m or {}):
1661
  return [f]
1662
  if f == "analytic_distribution":
1663
  return [f, f + "_details"]
 
1728
  last, n = (st[1] or 0, st[2] or 0) if st else (0, 0)
1729
  if last:
1730
  log(f" {key}: {operation} resuming at id {last:,} ({n:,} rows already done)")
1731
+ cols = [c for f in fields for c in _field_cols(f, named_m2m=spec.get("named_m2m"))]
1732
  setter = ", ".join(f"{c}=?" for c in cols)
1733
  pages, changed = 0, 0
1734
  while True:
 
1738
  break
1739
  if any(field not in rec for rec in recs for field in fields):
1740
  raise RuntimeError(f"{key}: column backfill response omitted a requested field")
1741
+ rows = _flatten_records(recs, fields, named_m2m=spec.get("named_m2m"))
1742
  if repeat:
1743
  # UPDATE ... RETURNING counts actual changed mirror rows. Fetched,
1744
  # identical and absent rows must not trigger a product-store rebuild.
 
1808
  def _upsert(con, key, spec, recs):
1809
  if not recs:
1810
  return
1811
+ rows = _flatten_records(recs, spec["fields"], spec.get("m2m") or (),
1812
+ named_m2m=spec.get("named_m2m"))
1813
  colnames = [c.split()[0] for c in _cols(spec)]
1814
  ids = [r["id"] for r in rows]
1815
  con.execute(f"DELETE FROM {key} WHERE id IN ({','.join(map(str, ids))})")
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 6abf783df8d49a69ef3aeb898fa5d5d124494e6c5998fb6d3221c673f5cad6a1
 
1
+ a798717a57b0a8bb56d5f5a5a002423a524329aebd485b6c6ffada4a43a92107