Spaces:
Running

fsanyoto commited on
Commit
8d9928e
·
verified ·
1 Parent(s): 320cee9

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "cf8ee97b45",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "666562d9d6",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- cf8ee97b45
 
1
+ 666562d9d6
api/odoo_relational.py CHANGED
@@ -7472,7 +7472,7 @@ def _publish_discovered_model(rt, client, choice, catalogue_row, *, username, to
7472
  if type(after) is not int or count != total or after != total:
7473
  raise Refused("Odoo returned an incomplete or changed population. The prior database was preserved.")
7474
  save("live")
7475
- datastore._save_state(con, source, "live", last, None)
7476
  con, _path = datastore._mirror_connection(rt.key, rt)
7477
  try:
7478
  spec = dynamic_model_source(con, key, tenant_key=rt.key)
 
7472
  if type(after) is not int or count != total or after != total:
7473
  raise Refused("Odoo returned an incomplete or changed population. The prior database was preserved.")
7474
  save("live")
7475
+ datastore._save_populated_state(con, source, last)
7476
  con, _path = datastore._mirror_connection(rt.key, rt)
7477
  try:
7478
  spec = dynamic_model_source(con, key, tenant_key=rt.key)
platform/harness/datastore.py CHANGED
@@ -3458,6 +3458,12 @@ def _connection_pending(con, key):
3458
  if not (prefix == key + "." and name.startswith(key + ".connection."))]
3459
 
3460
 
 
 
 
 
 
 
3461
  def _flatten(rec, fields, m2m=(), *, named_m2m=None, analytic_names=None, named_m2m_names=None,
3462
  list_fields=()):
3463
  out = {"id": rec["id"]}
@@ -4015,6 +4021,15 @@ def _save_state(con, key, phase, last_id, cursor_wd):
4015
  [_connection_state_key(key), phase, last_id, cursor_wd, n, time.strftime("%Y-%m-%d %H:%M:%S")])
4016
 
4017
 
 
 
 
 
 
 
 
 
 
4018
  def _base_domain(spec):
4019
  return list(spec.get("domain") or ()) + ([("active", "in", [True, False])] if spec["archivable"] else [])
4020
 
@@ -4029,7 +4044,8 @@ def sync_entity(key, max_batches=200, batch=BATCH, log=print, report=None):
4029
  # A recurring refresh may report changed pages to a bespoke cursor, but a
4030
  # tenant pass cannot claim completion until those private pages finish too.
4031
  pending = _connection_pending(candidate["con"], key)
4032
- if phase == "live" and any(row[1] != "done" for row in pending if not row[0].endswith(".pass")):
 
4033
  phase = "backfill"
4034
  return phase, pulled
4035
  rt = _resident_odoo_runtime()
@@ -4083,8 +4099,7 @@ def _sync_entity(key, max_batches=200, batch=BATCH, log=print):
4083
  limit=batch, order="id asc")
4084
  if not recs:
4085
  # backfill complete → switch to live mode anchored at max write_date seen
4086
- wd = con.execute(f"SELECT max(write_date) FROM {key} WHERE {_connection_where()}").fetchone()[0]
4087
- _save_state(con, key, "live", last_id, wd or "1970-01-01 00:00:00")
4088
  log(f" {key}: BACKFILL COMPLETE ({st['rows'] + pulled:,} rows) -> live mode")
4089
  return ("live" if columns_ready else "backfill"), pulled
4090
  _upsert(con, key, spec, recs)
@@ -4177,7 +4192,8 @@ def _sync_entity(key, max_batches=200, batch=BATCH, log=print):
4177
  pending = _connection_pending(con, key)
4178
  # Recurring refreshes have their own bounded cycle, separate from schema
4179
  # readiness. The public source wrapper also requires that cycle to finish.
4180
- columns_ready = columns_ready and all(phase == "done" for marker, phase in pending
 
4181
  if not marker.startswith(_connection_state_key(key + ".refresh.")))
4182
  return ("live" if columns_ready and delta_complete else "backfill"), pulled + refreshed
4183
  finally:
 
3458
  if not (prefix == key + "." and name.startswith(key + ".connection."))]
3459
 
3460
 
3461
+ def _connection_marker_complete(key, marker, phase):
3462
+ """Population markers finish live, while migration and refresh markers finish done."""
3463
+ dynamic = marker.startswith(_connection_state_key(key + ".dynamic."))
3464
+ return phase == ("live" if dynamic else "done")
3465
+
3466
+
3467
  def _flatten(rec, fields, m2m=(), *, named_m2m=None, analytic_names=None, named_m2m_names=None,
3468
  list_fields=()):
3469
  out = {"id": rec["id"]}
 
4021
  [_connection_state_key(key), phase, last_id, cursor_wd, n, time.strftime("%Y-%m-%d %H:%M:%S")])
4022
 
4023
 
4024
+ def _save_populated_state(con, key, last_id):
4025
+ """Anchor static deltas to populated dates and leave dynamic population cursors unassigned."""
4026
+ cursor = None
4027
+ if key in ENTITIES:
4028
+ cursor = con.execute(f"SELECT max(write_date) FROM {key} WHERE {_connection_where()}").fetchone()[0]
4029
+ cursor = cursor or "1970-01-01 00:00:00"
4030
+ _save_state(con, key, "live", last_id, cursor)
4031
+
4032
+
4033
  def _base_domain(spec):
4034
  return list(spec.get("domain") or ()) + ([("active", "in", [True, False])] if spec["archivable"] else [])
4035
 
 
4044
  # A recurring refresh may report changed pages to a bespoke cursor, but a
4045
  # tenant pass cannot claim completion until those private pages finish too.
4046
  pending = _connection_pending(candidate["con"], key)
4047
+ if phase == "live" and any(not _connection_marker_complete(key, marker, state)
4048
+ for marker, state in pending if not marker.endswith(".pass")):
4049
  phase = "backfill"
4050
  return phase, pulled
4051
  rt = _resident_odoo_runtime()
 
4099
  limit=batch, order="id asc")
4100
  if not recs:
4101
  # backfill complete → switch to live mode anchored at max write_date seen
4102
+ _save_populated_state(con, key, last_id)
 
4103
  log(f" {key}: BACKFILL COMPLETE ({st['rows'] + pulled:,} rows) -> live mode")
4104
  return ("live" if columns_ready else "backfill"), pulled
4105
  _upsert(con, key, spec, recs)
 
4192
  pending = _connection_pending(con, key)
4193
  # Recurring refreshes have their own bounded cycle, separate from schema
4194
  # readiness. The public source wrapper also requires that cycle to finish.
4195
+ columns_ready = columns_ready and all(_connection_marker_complete(key, marker, phase)
4196
+ for marker, phase in pending
4197
  if not marker.startswith(_connection_state_key(key + ".refresh.")))
4198
  return ("live" if columns_ready and delta_complete else "backfill"), pulled + refreshed
4199
  finally:
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 44b1144b27ff7dfd033840544e7099a4f226be7252ab1792391ca2d4a6ef76b4
 
1
+ 4d4cc10ec2881b9e3ae1d029c787d659cdf399ab8848076ca6f80891aac53db3