Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/main.py +10 -1
- api/routes_odoo_tables.py +1 -1
- api/routes_sheet.py +60 -9
- platform/harness/mirror_store.py +71 -10
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/connectors/ConnectorsPage.tsx +22 -13
- web/src/connectors/DatabasesTab.tsx +50 -2
- web/src/customer-grid/GridActivity.tsx +8 -3
- web/src/sheet/SheetCatchUp.tsx +9 -1
- web/src/sheet/sheetApi.ts +7 -1
- web/src/styles/sdlc73/sheet.css +7 -0
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "e39ffb9a4",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
e39ffb9a4
|
api/main.py
CHANGED
|
@@ -736,6 +736,8 @@ def _seed_and_sync_store():
|
|
| 736 |
_ds.reconcile_deletes(entities=selected_entities, log=lambda *a, **k: None)
|
| 737 |
except Exception:
|
| 738 |
pass
|
|
|
|
|
|
|
| 739 |
print(f"[aios-api] datastore sync done in {_t.time() - t0:.1f}s "
|
| 740 |
f"(ready={_ds.ready()})")
|
| 741 |
# ⭐⭐ 2026-08-09 (wave 28, D-107) — THE RELATIONAL REBUILD RUNS AT BOOT, HERE.
|
|
@@ -999,6 +1001,8 @@ class _DeskAwareOdooClient:
|
|
| 999 |
self._factory = factory
|
| 1000 |
self._client = None
|
| 1001 |
self._next_desk = 0.0
|
|
|
|
|
|
|
| 1002 |
|
| 1003 |
def __getattr__(self, name):
|
| 1004 |
if name not in {"search_read", "search_count", "read_group", "fields_get"}:
|
|
@@ -1010,7 +1014,7 @@ class _DeskAwareOdooClient:
|
|
| 1010 |
result, finished = {}, threading.Event()
|
| 1011 |
|
| 1012 |
def serve_desk():
|
| 1013 |
-
if time.monotonic() >= self._next_desk:
|
| 1014 |
outcome = {}
|
| 1015 |
_run_sync_requests(outcome, during_odoo=True)
|
| 1016 |
self._next_desk = time.monotonic() + (30 if "continuing" in outcome.values() else 0.25)
|
|
@@ -2146,6 +2150,11 @@ def _resync_mirror_pass(manual, passes, entities=None):
|
|
| 2146 |
_resync_log(f"failed after {_pass_clock.monotonic() - pass_started:.1f}s ({type(e).__name__})")
|
| 2147 |
# A partial report must never be mistaken for a confirmed zero-change pass.
|
| 2148 |
return None, None, _classify_resync_error(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2149 |
|
| 2150 |
|
| 2151 |
def _absent_mirror_entities(ds, entities=None):
|
|
|
|
| 736 |
_ds.reconcile_deletes(entities=selected_entities, log=lambda *a, **k: None)
|
| 737 |
except Exception:
|
| 738 |
pass
|
| 739 |
+
if isinstance(getattr(_odoo._tlocal, "client", None), _DeskAwareOdooClient):
|
| 740 |
+
_odoo._tlocal.client.desk = False # the rebuild below must not serve the desk
|
| 741 |
print(f"[aios-api] datastore sync done in {_t.time() - t0:.1f}s "
|
| 742 |
f"(ready={_ds.ready()})")
|
| 743 |
# ⭐⭐ 2026-08-09 (wave 28, D-107) — THE RELATIONAL REBUILD RUNS AT BOOT, HERE.
|
|
|
|
| 1001 |
self._factory = factory
|
| 1002 |
self._client = None
|
| 1003 |
self._next_desk = 0.0
|
| 1004 |
+
# Only the Odoo pull serves the desk; the relational rebuild after it on this thread must not.
|
| 1005 |
+
self.desk = True
|
| 1006 |
|
| 1007 |
def __getattr__(self, name):
|
| 1008 |
if name not in {"search_read", "search_count", "read_group", "fields_get"}:
|
|
|
|
| 1014 |
result, finished = {}, threading.Event()
|
| 1015 |
|
| 1016 |
def serve_desk():
|
| 1017 |
+
if self.desk and time.monotonic() >= self._next_desk:
|
| 1018 |
outcome = {}
|
| 1019 |
_run_sync_requests(outcome, during_odoo=True)
|
| 1020 |
self._next_desk = time.monotonic() + (30 if "continuing" in outcome.values() else 0.25)
|
|
|
|
| 2150 |
_resync_log(f"failed after {_pass_clock.monotonic() - pass_started:.1f}s ({type(e).__name__})")
|
| 2151 |
# A partial report must never be mistaken for a confirmed zero-change pass.
|
| 2152 |
return None, None, _classify_resync_error(e)
|
| 2153 |
+
finally:
|
| 2154 |
+
# The rebuild reuses this thread's client: a desk served there ran the Amazon first load inside it.
|
| 2155 |
+
_client = getattr(getattr(sys.modules.get("core.odoo"), "_tlocal", None), "client", None)
|
| 2156 |
+
if isinstance(_client, _DeskAwareOdooClient):
|
| 2157 |
+
_client.desk = False
|
| 2158 |
|
| 2159 |
|
| 2160 |
def _absent_mirror_entities(ds, entities=None):
|
api/routes_odoo_tables.py
CHANGED
|
@@ -399,7 +399,7 @@ def _catch_up_status(session):
|
|
| 399 |
try:
|
| 400 |
status = mirror_store.catch_up_status(session.runtime)
|
| 401 |
except Exception:
|
| 402 |
-
return {"active": True, "done": 0, "total": 0, "newest": {}}
|
| 403 |
status["newest"] = {key: value for key, value in status["newest"].items()
|
| 404 |
if perm_scope.may_read(session.user, key, st=session.runtime)}
|
| 405 |
return status
|
|
|
|
| 399 |
try:
|
| 400 |
status = mirror_store.catch_up_status(session.runtime)
|
| 401 |
except Exception:
|
| 402 |
+
return {"active": True, "done": 0, "total": 0, "newest": {}, "sources": {}}
|
| 403 |
status["newest"] = {key: value for key, value in status["newest"].items()
|
| 404 |
if perm_scope.may_read(session.user, key, st=session.runtime)}
|
| 405 |
return status
|
api/routes_sheet.py
CHANGED
|
@@ -138,10 +138,36 @@ def _sheet_catch_up(session):
|
|
| 138 |
|
| 139 |
|
| 140 |
def _database_catching_up(session, database):
|
| 141 |
-
"""Connected mirrors wait for C1; native authored tables remain readable."""
|
| 142 |
-
|
|
|
|
| 143 |
return False
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
def _database_connected(session, database):
|
|
@@ -2626,6 +2652,7 @@ def read_sheet_activity(workbook_id: str, session: Session = Depends(require_ses
|
|
| 2626 |
def read_sheet_catch_up(workbook_id: str, session: Session = Depends(require_session)):
|
| 2627 |
"""Scope C1 to the workbook, including tabs the browser has not loaded."""
|
| 2628 |
from core import sheets
|
|
|
|
| 2629 |
try:
|
| 2630 |
book = sheets.get_workbook(_store(session), workbook_id)
|
| 2631 |
_require_reader(session, book)
|
|
@@ -2633,20 +2660,44 @@ def read_sheet_catch_up(workbook_id: str, session: Session = Depends(require_ses
|
|
| 2633 |
raise _refuse(exc)
|
| 2634 |
session._sheet_scope_context = {}
|
| 2635 |
status = _sheet_catch_up(session)
|
| 2636 |
-
if status.get("
|
|
|
|
|
|
|
|
|
|
| 2637 |
for tab in book.get("sheets") or []:
|
| 2638 |
for cell in (tab.get("cells") or {}).values():
|
| 2639 |
binding = cell.get("binding") or {}
|
| 2640 |
if not binding.get("database"):
|
| 2641 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2642 |
try:
|
| 2643 |
-
|
| 2644 |
-
if _binding_catching_up(session, binding):
|
| 2645 |
-
|
| 2646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2647 |
except HTTPException:
|
| 2648 |
continue
|
| 2649 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2650 |
|
| 2651 |
|
| 2652 |
@router.get("/sheets/{workbook_id}/refresh-history")
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
def _database_catching_up(session, database):
|
| 141 |
+
"""Connected mirrors wait for their own source's C1; native authored tables remain readable."""
|
| 142 |
+
status = _sheet_catch_up(session)
|
| 143 |
+
if status.get("active") is not True:
|
| 144 |
return False
|
| 145 |
+
if not _database_connected(session, database):
|
| 146 |
+
return False
|
| 147 |
+
# An unmapped database, or a status without per-source progress, waits for the tenant.
|
| 148 |
+
own = (status.get("sources") or {}).get(_database_source(session, database))
|
| 149 |
+
return not isinstance(own, dict) or own.get("active") is True
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
#: The connector name each catch-up source shows a person.
|
| 153 |
+
_SOURCE_LABELS = {"odoo": "Odoo", "amazon": "Amazon", "meta": "Meta Ads"}
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def _database_source(session, database):
|
| 157 |
+
"""Name the catch-up source a connected database waits on, or None when it is unknown."""
|
| 158 |
+
import odoo_relational as rel
|
| 159 |
+
from core import connector_spec
|
| 160 |
+
database = str(database or "")
|
| 161 |
+
if (database in rel._REGISTRY_GRID_FIELDS or database == rel.SHIPMENTS_KEY
|
| 162 |
+
or any(database == key for _, key, _, _ in rel.TABLES)):
|
| 163 |
+
return "odoo"
|
| 164 |
+
connector = connector_spec.connector_of(database) or next((name for prefix, name in (
|
| 165 |
+
("ut_amzn_", "amazon"), ("ut_meta_", "meta"), ("ut_odoo_", "odoo"),
|
| 166 |
+
) if database.startswith(prefix)), None)
|
| 167 |
+
if connector is None and database in {"customer_data", "product_data"}:
|
| 168 |
+
connector = "odoo"
|
| 169 |
+
connector = connector_spec.CONNECTOR_SPEC_KEYS.get(connector, connector)
|
| 170 |
+
return connector if connector in _SOURCE_LABELS else None
|
| 171 |
|
| 172 |
|
| 173 |
def _database_connected(session, database):
|
|
|
|
| 2652 |
def read_sheet_catch_up(workbook_id: str, session: Session = Depends(require_session)):
|
| 2653 |
"""Scope C1 to the workbook, including tabs the browser has not loaded."""
|
| 2654 |
from core import sheets
|
| 2655 |
+
from modules import sheet as sheet_mod
|
| 2656 |
try:
|
| 2657 |
book = sheets.get_workbook(_store(session), workbook_id)
|
| 2658 |
_require_reader(session, book)
|
|
|
|
| 2660 |
raise _refuse(exc)
|
| 2661 |
session._sheet_scope_context = {}
|
| 2662 |
status = _sheet_catch_up(session)
|
| 2663 |
+
sources = status.get("sources") if isinstance(status.get("sources"), dict) else {}
|
| 2664 |
+
behind = {name for name, entry in sources.items() if isinstance(entry, dict) and entry.get("behind")}
|
| 2665 |
+
held, bound, readable = set(), set(), {}
|
| 2666 |
+
if status.get("active") is True or behind:
|
| 2667 |
for tab in book.get("sheets") or []:
|
| 2668 |
for cell in (tab.get("cells") or {}).values():
|
| 2669 |
binding = cell.get("binding") or {}
|
| 2670 |
if not binding.get("database"):
|
| 2671 |
continue
|
| 2672 |
+
# The page polls every 2 s, so each distinct database is checked once per read.
|
| 2673 |
+
if binding["database"] not in readable:
|
| 2674 |
+
try:
|
| 2675 |
+
_require_database(session, binding["database"])
|
| 2676 |
+
readable[binding["database"]] = _database_source(session, binding["database"])
|
| 2677 |
+
except HTTPException:
|
| 2678 |
+
readable[binding["database"]] = HTTPException
|
| 2679 |
+
if readable[binding["database"]] is HTTPException:
|
| 2680 |
+
continue
|
| 2681 |
try:
|
| 2682 |
+
bound.add(readable[binding["database"]])
|
| 2683 |
+
if status.get("active") is True and _binding_catching_up(session, binding):
|
| 2684 |
+
database = str(binding["database"])
|
| 2685 |
+
nodes, _ = _binding_filter_nodes(session, database, binding)
|
| 2686 |
+
targets = [database] + [_binding_related_entry(session, database, via)["target"]
|
| 2687 |
+
for via in sheet_mod.related_vias(nodes)]
|
| 2688 |
+
held.update(_database_source(session, target) for target in targets
|
| 2689 |
+
if _database_catching_up(session, target))
|
| 2690 |
except HTTPException:
|
| 2691 |
continue
|
| 2692 |
+
if held:
|
| 2693 |
+
# C1's newest map can name unrelated databases. Return only the held sources' progress.
|
| 2694 |
+
if None in held or not held <= set(sources):
|
| 2695 |
+
return {"catchUp": {key: status.get(key) for key in ("active", "done", "total")}}
|
| 2696 |
+
return {"catchUp": {"active": True, "done": sum(sources[name].get("done", 0) for name in held),
|
| 2697 |
+
"total": sum(sources[name].get("total", 0) for name in held)}}
|
| 2698 |
+
lines = [{"source": _SOURCE_LABELS[name], "reason": sources[name]["behind"]}
|
| 2699 |
+
for name in _SOURCE_LABELS if name in behind and name in bound]
|
| 2700 |
+
return {"catchUp": {"active": False, "behind": lines} if lines else {"active": False}}
|
| 2701 |
|
| 2702 |
|
| 2703 |
@router.get("/sheets/{workbook_id}/refresh-history")
|
platform/harness/mirror_store.py
CHANGED
|
@@ -66,7 +66,8 @@ def _catch_up_source(rt, connector):
|
|
| 66 |
connector = connector_spec.CONNECTOR_SPEC_KEYS.get(connector, connector)
|
| 67 |
return _CATCH_UP.setdefault(identity, {}).setdefault(connector, {
|
| 68 |
"current": False, "parts": set(), "part_total": 0,
|
| 69 |
-
"passes": 0, "pass_pending": False, "newest": {}, "refused": False
|
|
|
|
| 70 |
|
| 71 |
|
| 72 |
def connected_sources(rt):
|
|
@@ -90,17 +91,60 @@ def catch_up_status(rt, sources=None):
|
|
| 90 |
if sources is None:
|
| 91 |
sources = connected_sources(rt)
|
| 92 |
with _CATCH_UP_LOCK:
|
| 93 |
-
states =
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
|
| 100 |
def source_catching_up(rt, connector):
|
| 101 |
return catch_up_status(rt, [connector])["active"]
|
| 102 |
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
def _record_newest(con, connector):
|
| 105 |
"""Measure record dates, never checkpoint time or the sync cursor."""
|
| 106 |
preferred = ("invoice_date", "date_order", "date", "purchase_date", "posted_date",
|
|
@@ -165,8 +209,16 @@ def tracked_sync(connector, runtime, pull, *args, _catch_up_complete=True, **kwa
|
|
| 165 |
with _CATCH_UP_LOCK:
|
| 166 |
state = _catch_up_source(rt, connector)
|
| 167 |
if not state["current"]:
|
| 168 |
-
state
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
completed, current = _sync_result(connector, report)
|
| 171 |
current = current and _catch_up_complete and Path(rt.datastore_path).exists()
|
| 172 |
newest = None
|
|
@@ -188,7 +240,15 @@ def tracked_sync(connector, runtime, pull, *args, _catch_up_complete=True, **kwa
|
|
| 188 |
if newest and not state["refused"]:
|
| 189 |
state["newest"] = newest
|
| 190 |
if current and not state["refused"]:
|
| 191 |
-
state.update(current=True, pass_pending=False, newest=newest or {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
return report
|
| 193 |
|
| 194 |
|
|
@@ -587,7 +647,8 @@ class MirrorStore:
|
|
| 587 |
newest = _record_newest(con, self.connector)
|
| 588 |
with _CATCH_UP_LOCK:
|
| 589 |
_catch_up_source(rt, self.connector).update(
|
| 590 |
-
current=current, pass_pending=not current, newest=newest
|
|
|
|
| 591 |
except Exception as exc:
|
| 592 |
result["state"] = "refused"
|
| 593 |
message = (f"{self.label} mirror restore refused ({type(exc).__name__}); saved manifest, checksums, "
|
|
|
|
| 66 |
connector = connector_spec.CONNECTOR_SPEC_KEYS.get(connector, connector)
|
| 67 |
return _CATCH_UP.setdefault(identity, {}).setdefault(connector, {
|
| 68 |
"current": False, "parts": set(), "part_total": 0,
|
| 69 |
+
"passes": 0, "pass_pending": False, "newest": {}, "refused": False, "misses": 0, "behind": "",
|
| 70 |
+
"attempt_at": 0.0, "missed_at": 0.0, "miss_reason": ""})
|
| 71 |
|
| 72 |
|
| 73 |
def connected_sources(rt):
|
|
|
|
| 91 |
if sources is None:
|
| 92 |
sources = connected_sources(rt)
|
| 93 |
with _CATCH_UP_LOCK:
|
| 94 |
+
states = {connector_spec.CONNECTOR_SPEC_KEYS.get(name, name): _catch_up_source(rt, name)
|
| 95 |
+
for name in dict.fromkeys(sources)}
|
| 96 |
+
# A behind source has settled: its pending pass no longer holds the tenant or its count.
|
| 97 |
+
behind = {name: _behind(s) for name, s in states.items()}
|
| 98 |
+
per = {name: {"active": not s["current"] and not behind[name],
|
| 99 |
+
"done": len(s["parts"]) + s["passes"],
|
| 100 |
+
"total": s["part_total"] + s["passes"] + int(s["pass_pending"] and not behind[name]),
|
| 101 |
+
"behind": behind[name]} for name, s in states.items()}
|
| 102 |
+
return {"active": any(p["active"] for p in per.values()),
|
| 103 |
+
"done": sum(p["done"] for p in per.values()),
|
| 104 |
+
"total": sum(p["total"] for p in per.values()),
|
| 105 |
+
"newest": {k: v for s in states.values() for k, v in s["newest"].items()},
|
| 106 |
+
"sources": per}
|
| 107 |
|
| 108 |
|
| 109 |
def source_catching_up(rt, connector):
|
| 110 |
return catch_up_status(rt, [connector])["active"]
|
| 111 |
|
| 112 |
|
| 113 |
+
#: Consecutive unsettled passes before a source reads behind. Odoo retries within minutes;
|
| 114 |
+
#: Amazon and Meta pass about daily, so one unsettled pass names them behind.
|
| 115 |
+
BEHIND_AFTER_PASSES = {"odoo": 3}
|
| 116 |
+
#: A miss that no new pass followed within this many seconds also reads behind.
|
| 117 |
+
BEHIND_AFTER_SECONDS = 900
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def _behind(state):
|
| 121 |
+
"""The settled reason, or the last miss's reason once no retry followed it in time."""
|
| 122 |
+
if state["behind"] or state["current"] or not state["misses"]:
|
| 123 |
+
return state["behind"]
|
| 124 |
+
waited = state["missed_at"] >= state["attempt_at"] and time.time() - state["missed_at"] >= BEHIND_AFTER_SECONDS
|
| 125 |
+
return state["miss_reason"] if waited else ""
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def _record_miss(connector, state, reason):
|
| 129 |
+
"""Count one unsettled pass on a source that is not current, and name it behind at the limit."""
|
| 130 |
+
if state["current"]:
|
| 131 |
+
return
|
| 132 |
+
state["misses"] += 1
|
| 133 |
+
if state["refused"]:
|
| 134 |
+
reason = "Its saved copy could not be restored."
|
| 135 |
+
state.update(missed_at=time.time(), miss_reason=reason)
|
| 136 |
+
if state["misses"] >= BEHIND_AFTER_PASSES.get(connector, 1):
|
| 137 |
+
state["behind"] = reason
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def _skipped_pass(report):
|
| 141 |
+
"""An empty report ran no pass, so it neither settles nor misses."""
|
| 142 |
+
if not isinstance(report, dict) or not report:
|
| 143 |
+
return True
|
| 144 |
+
return ("tables" in report and not report.get("tables") and not report.get("problems")
|
| 145 |
+
and not report.get("audit_problems"))
|
| 146 |
+
|
| 147 |
+
|
| 148 |
def _record_newest(con, connector):
|
| 149 |
"""Measure record dates, never checkpoint time or the sync cursor."""
|
| 150 |
preferred = ("invoice_date", "date_order", "date", "purchase_date", "posted_date",
|
|
|
|
| 209 |
with _CATCH_UP_LOCK:
|
| 210 |
state = _catch_up_source(rt, connector)
|
| 211 |
if not state["current"]:
|
| 212 |
+
state.update(pass_pending=True, attempt_at=time.time())
|
| 213 |
+
try:
|
| 214 |
+
report = pull(*args, **kwargs)
|
| 215 |
+
except Exception as exc:
|
| 216 |
+
if _catch_up_complete:
|
| 217 |
+
with _CATCH_UP_LOCK:
|
| 218 |
+
_record_miss(connector, _catch_up_source(rt, connector),
|
| 219 |
+
"Its last update is held for review." if isinstance(exc, PublicationHeld)
|
| 220 |
+
else "Its last sync failed.")
|
| 221 |
+
raise
|
| 222 |
completed, current = _sync_result(connector, report)
|
| 223 |
current = current and _catch_up_complete and Path(rt.datastore_path).exists()
|
| 224 |
newest = None
|
|
|
|
| 240 |
if newest and not state["refused"]:
|
| 241 |
state["newest"] = newest
|
| 242 |
if current and not state["refused"]:
|
| 243 |
+
state.update(current=True, pass_pending=False, newest=newest or {}, misses=0, behind="")
|
| 244 |
+
elif not _catch_up_complete or _skipped_pass(report):
|
| 245 |
+
pass
|
| 246 |
+
elif completed and connector == "odoo" and not state["refused"]:
|
| 247 |
+
# A bounded Odoo backfill pass is progress: the next pass resumes it.
|
| 248 |
+
state["misses"] = 0
|
| 249 |
+
else:
|
| 250 |
+
_record_miss(connector, state, "Its last sync left some tables unavailable." if completed
|
| 251 |
+
else "Its last sync did not finish.")
|
| 252 |
return report
|
| 253 |
|
| 254 |
|
|
|
|
| 647 |
newest = _record_newest(con, self.connector)
|
| 648 |
with _CATCH_UP_LOCK:
|
| 649 |
_catch_up_source(rt, self.connector).update(
|
| 650 |
+
current=current, pass_pending=not current, newest=newest,
|
| 651 |
+
**({"misses": 0, "behind": ""} if current else {}))
|
| 652 |
except Exception as exc:
|
| 653 |
result["state"] = "refused"
|
| 654 |
message = (f"{self.label} mirror restore refused ({type(exc).__name__}); saved manifest, checksums, "
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
e596fa70d4aa9744f1890c1d5adba0d9b461af083a558fc1a337fdff28fcc7f2
|
web/src/connectors/ConnectorsPage.tsx
CHANGED
|
@@ -55,8 +55,11 @@ import type { ConnectorTab } from "./ConnectorModal";
|
|
| 55 |
import MonidRunDialog from "./MonidRunDialog";
|
| 56 |
import {
|
| 57 |
DatabaseSyncSummary,
|
|
|
|
| 58 |
catchUpLabel,
|
|
|
|
| 59 |
parseDatabaseSyncHealth,
|
|
|
|
| 60 |
useConnectorCatchUp,
|
| 61 |
type ConnectorCatchUp,
|
| 62 |
type DatabaseSyncHealth,
|
|
@@ -802,10 +805,13 @@ export default function ConnectorsPage({
|
|
| 802 |
const hasOdooCard =
|
| 803 |
load.phase === "ready" &&
|
| 804 |
load.rows.some((row) => row.key === "odoo" && row.state === "connected" && !!row.manage);
|
| 805 |
-
const
|
| 806 |
load.phase === "ready" &&
|
| 807 |
-
load.rows.some((row) =>
|
| 808 |
-
const catchUpStatus = useConnectorCatchUp(
|
|
|
|
|
|
|
|
|
|
| 809 |
const [odooWarnings, setOdooWarnings] = useState<string[]>([]);
|
| 810 |
useEffect(() => {
|
| 811 |
if (!hasOdooCard) return;
|
|
@@ -934,7 +940,7 @@ export default function ConnectorsPage({
|
|
| 934 |
onOpen={() => openConnector(row)}
|
| 935 |
onPullReviews={pullHandler(row)}
|
| 936 |
syncWarnings={row.key === "odoo" ? odooWarnings : undefined}
|
| 937 |
-
catchUp={row
|
| 938 |
catchUpError={row.key === "odoo" ? catchUpStatus.error : undefined}
|
| 939 |
catchUpLoading={row.key === "odoo" && catchUpStatus.loading}
|
| 940 |
/>
|
|
@@ -957,7 +963,7 @@ export default function ConnectorsPage({
|
|
| 957 |
onOpen={() => openConnector(row)}
|
| 958 |
onPullReviews={pullHandler(row)}
|
| 959 |
syncWarnings={row.key === "odoo" ? odooWarnings : undefined}
|
| 960 |
-
catchUp={row
|
| 961 |
catchUpError={row.key === "odoo" ? catchUpStatus.error : undefined}
|
| 962 |
catchUpLoading={row.key === "odoo" && catchUpStatus.loading}
|
| 963 |
/>
|
|
@@ -1139,8 +1145,9 @@ export function OdooSyncStatus({ onOpenDatabases }: { onOpenDatabases?: () => vo
|
|
| 1139 |
});
|
| 1140 |
return () => controller.abort();
|
| 1141 |
}, []);
|
|
|
|
| 1142 |
const shownDatabaseHealth = databaseHealth.filter((database) => database.health
|
| 1143 |
-
||
|
| 1144 |
if (problem) return <section className="w45-contract-card"><h4>Sync</h4><p className="set-error">{problem}</p></section>;
|
| 1145 |
if (!status || !schema) return <section className="w45-contract-card"><h4>Sync</h4><p>Loading connector status…</p></section>;
|
| 1146 |
return (
|
|
@@ -1149,9 +1156,10 @@ export function OdooSyncStatus({ onOpenDatabases }: { onOpenDatabases?: () => vo
|
|
| 1149 |
<OdooFreshnessNote lines={freshnessWarnings(freshness)} />
|
| 1150 |
<dl className="voice-agent-details">
|
| 1151 |
<div><dt>Schedule</dt><dd>{status.schedule || "Not scheduled"}</dd></div>
|
| 1152 |
-
<div><dt>Health</dt><dd>{
|
| 1153 |
-
: catchUpStatus.error || (catchUpStatus.loading ? "Checking sync"
|
| 1154 |
-
|
|
|
|
| 1155 |
<div><dt>Last run</dt><dd>{status.lastRun || "No run reported"}</dd></div>
|
| 1156 |
{freshness ? (
|
| 1157 |
<div>
|
|
@@ -1166,8 +1174,8 @@ export function OdooSyncStatus({ onOpenDatabases }: { onOpenDatabases?: () => vo
|
|
| 1166 |
<div key={database.key}>
|
| 1167 |
<strong>{database.label}</strong>
|
| 1168 |
<DatabaseSyncSummary health={database.health} databaseKey={database.key}
|
| 1169 |
-
catchUp={catchUpStatus.catchUp
|
| 1170 |
-
catchUpLoading={catchUpStatus.loading} />
|
| 1171 |
</div>
|
| 1172 |
)) : <p>No database sync state has been published.</p>}
|
| 1173 |
<h4>Field catalog</h4>
|
|
@@ -1334,9 +1342,10 @@ export function ConnectorCard({
|
|
| 1334 |
return (
|
| 1335 |
<div className="conn-card" data-connector={row.key}>
|
| 1336 |
<ConnectorCardHead row={row} />
|
| 1337 |
-
{catchUp?.active || catchUpError || catchUpLoading ? (
|
| 1338 |
<span className="conn-card-status conn-catch-up" role="status">
|
| 1339 |
-
{catchUp?.active ? catchUpLabel(catchUp) : catchUpError
|
|
|
|
| 1340 |
{catchUp?.active && catchUpError ? `, ${catchUpError}` : ""}
|
| 1341 |
</span>
|
| 1342 |
) : syncWarnings?.length ? (
|
|
|
|
| 55 |
import MonidRunDialog from "./MonidRunDialog";
|
| 56 |
import {
|
| 57 |
DatabaseSyncSummary,
|
| 58 |
+
behindLabel,
|
| 59 |
catchUpLabel,
|
| 60 |
+
catchUpSourceKey,
|
| 61 |
parseDatabaseSyncHealth,
|
| 62 |
+
sourceCatchUp,
|
| 63 |
useConnectorCatchUp,
|
| 64 |
type ConnectorCatchUp,
|
| 65 |
type DatabaseSyncHealth,
|
|
|
|
| 805 |
const hasOdooCard =
|
| 806 |
load.phase === "ready" &&
|
| 807 |
load.rows.some((row) => row.key === "odoo" && row.state === "connected" && !!row.manage);
|
| 808 |
+
const hasConnectedSourceCard =
|
| 809 |
load.phase === "ready" &&
|
| 810 |
+
load.rows.some((row) => ["odoo", "amazon_sp", "meta_ads"].includes(row.key) && row.state === "connected");
|
| 811 |
+
const catchUpStatus = useConnectorCatchUp(hasConnectedSourceCard);
|
| 812 |
+
// Each source card shows its own catch-up; the Odoo card alone reports a status read error.
|
| 813 |
+
const sourceCard = (row: ConnectorRow) => ["odoo", "amazon_sp", "meta_ads"].includes(row.key)
|
| 814 |
+
? sourceCatchUp(catchUpStatus.catchUp, catchUpSourceKey(row.key)) : undefined;
|
| 815 |
const [odooWarnings, setOdooWarnings] = useState<string[]>([]);
|
| 816 |
useEffect(() => {
|
| 817 |
if (!hasOdooCard) return;
|
|
|
|
| 940 |
onOpen={() => openConnector(row)}
|
| 941 |
onPullReviews={pullHandler(row)}
|
| 942 |
syncWarnings={row.key === "odoo" ? odooWarnings : undefined}
|
| 943 |
+
catchUp={sourceCard(row)}
|
| 944 |
catchUpError={row.key === "odoo" ? catchUpStatus.error : undefined}
|
| 945 |
catchUpLoading={row.key === "odoo" && catchUpStatus.loading}
|
| 946 |
/>
|
|
|
|
| 963 |
onOpen={() => openConnector(row)}
|
| 964 |
onPullReviews={pullHandler(row)}
|
| 965 |
syncWarnings={row.key === "odoo" ? odooWarnings : undefined}
|
| 966 |
+
catchUp={sourceCard(row)}
|
| 967 |
catchUpError={row.key === "odoo" ? catchUpStatus.error : undefined}
|
| 968 |
catchUpLoading={row.key === "odoo" && catchUpStatus.loading}
|
| 969 |
/>
|
|
|
|
| 1145 |
});
|
| 1146 |
return () => controller.abort();
|
| 1147 |
}, []);
|
| 1148 |
+
const odooCatchUp = sourceCatchUp(catchUpStatus.catchUp, "odoo");
|
| 1149 |
const shownDatabaseHealth = databaseHealth.filter((database) => database.health
|
| 1150 |
+
|| odooCatchUp?.active || odooCatchUp?.newest[database.key] || catchUpStatus.error);
|
| 1151 |
if (problem) return <section className="w45-contract-card"><h4>Sync</h4><p className="set-error">{problem}</p></section>;
|
| 1152 |
if (!status || !schema) return <section className="w45-contract-card"><h4>Sync</h4><p>Loading connector status…</p></section>;
|
| 1153 |
return (
|
|
|
|
| 1156 |
<OdooFreshnessNote lines={freshnessWarnings(freshness)} />
|
| 1157 |
<dl className="voice-agent-details">
|
| 1158 |
<div><dt>Schedule</dt><dd>{status.schedule || "Not scheduled"}</dd></div>
|
| 1159 |
+
<div><dt>Health</dt><dd>{odooCatchUp?.active ? catchUpLabel(odooCatchUp)
|
| 1160 |
+
: catchUpStatus.error || (catchUpStatus.loading ? "Checking sync"
|
| 1161 |
+
: odooCatchUp?.behind ? behindLabel(odooCatchUp.behind) : status.health)}
|
| 1162 |
+
{odooCatchUp?.active && catchUpStatus.error ? `, ${catchUpStatus.error}` : ""}</dd></div>
|
| 1163 |
<div><dt>Last run</dt><dd>{status.lastRun || "No run reported"}</dd></div>
|
| 1164 |
{freshness ? (
|
| 1165 |
<div>
|
|
|
|
| 1174 |
<div key={database.key}>
|
| 1175 |
<strong>{database.label}</strong>
|
| 1176 |
<DatabaseSyncSummary health={database.health} databaseKey={database.key}
|
| 1177 |
+
catchUp={sourceCatchUp(catchUpStatus.catchUp, catchUpSourceKey(database.key))}
|
| 1178 |
+
catchUpError={catchUpStatus.error} catchUpLoading={catchUpStatus.loading} />
|
| 1179 |
</div>
|
| 1180 |
)) : <p>No database sync state has been published.</p>}
|
| 1181 |
<h4>Field catalog</h4>
|
|
|
|
| 1342 |
return (
|
| 1343 |
<div className="conn-card" data-connector={row.key}>
|
| 1344 |
<ConnectorCardHead row={row} />
|
| 1345 |
+
{catchUp?.active || catchUp?.behind || catchUpError || catchUpLoading ? (
|
| 1346 |
<span className="conn-card-status conn-catch-up" role="status">
|
| 1347 |
+
{catchUp?.active ? catchUpLabel(catchUp) : catchUpError
|
| 1348 |
+
|| (catchUp?.behind && !catchUpLoading ? behindLabel(catchUp.behind) : "Checking sync")}
|
| 1349 |
{catchUp?.active && catchUpError ? `, ${catchUpError}` : ""}
|
| 1350 |
</span>
|
| 1351 |
) : syncWarnings?.length ? (
|
web/src/connectors/DatabasesTab.tsx
CHANGED
|
@@ -124,11 +124,22 @@ function syncStamp(value: unknown): string | null {
|
|
| 124 |
return text && Number.isFinite(Date.parse(text)) ? text : null;
|
| 125 |
}
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
export interface ConnectorCatchUp {
|
| 128 |
active: boolean;
|
| 129 |
done: number;
|
| 130 |
total: number;
|
| 131 |
newest: Record<string, string>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
/** Missing catchUp is compatible; a malformed status is not a settled sync. */
|
|
@@ -149,7 +160,40 @@ export function parseConnectorCatchUp(value: unknown): ConnectorCatchUp | null {
|
|
| 149 |
if (!stamp) throw new Error("Sync status unavailable");
|
| 150 |
newest[key] = stamp;
|
| 151 |
}
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
export async function readConnectorCatchUp(signal: AbortSignal): Promise<ConnectorCatchUp | null> {
|
|
@@ -162,6 +206,10 @@ export function catchUpLabel(catchUp: ConnectorCatchUp): string {
|
|
| 162 |
return `Updating ${catchUp.done.toLocaleString()} of ${catchUp.total.toLocaleString()}`;
|
| 163 |
}
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
export function useConnectorCatchUp(enabled: boolean) {
|
| 166 |
const [state, setState] = useState<{
|
| 167 |
catchUp: ConnectorCatchUp | null; error: string; loading: boolean;
|
|
@@ -2375,7 +2423,7 @@ const DatabasesTab = forwardRef<DatabasesTabHandle, {
|
|
| 2375 |
<td colSpan={showsPopulation ? 8 : 7}>
|
| 2376 |
<DatabaseSyncSummary health={databaseSync.states[database.key]}
|
| 2377 |
error={databaseSync.error}
|
| 2378 |
-
databaseKey={database.key} catchUp={catchUpStatus.catchUp}
|
| 2379 |
catchUpError={catchUpStatus.error} catchUpLoading={catchUpStatus.loading}
|
| 2380 |
errorCovered={showsAmazonSync && amazonSync.states[database.key]?.refused === true} />
|
| 2381 |
<DatabasePanel
|
|
|
|
| 124 |
return text && Number.isFinite(Date.parse(text)) ? text : null;
|
| 125 |
}
|
| 126 |
|
| 127 |
+
interface ConnectorSourceCatchUp {
|
| 128 |
+
active: boolean;
|
| 129 |
+
done: number;
|
| 130 |
+
total: number;
|
| 131 |
+
behind: string;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
export interface ConnectorCatchUp {
|
| 135 |
active: boolean;
|
| 136 |
done: number;
|
| 137 |
total: number;
|
| 138 |
newest: Record<string, string>;
|
| 139 |
+
/** Per-source progress; null when the server reports only the tenant total. */
|
| 140 |
+
sources: Record<string, ConnectorSourceCatchUp> | null;
|
| 141 |
+
/** Set when this status is scoped to one source that settled behind. */
|
| 142 |
+
behind?: string;
|
| 143 |
}
|
| 144 |
|
| 145 |
/** Missing catchUp is compatible; a malformed status is not a settled sync. */
|
|
|
|
| 160 |
if (!stamp) throw new Error("Sync status unavailable");
|
| 161 |
newest[key] = stamp;
|
| 162 |
}
|
| 163 |
+
let sources: Record<string, ConnectorSourceCatchUp> | null = null;
|
| 164 |
+
if (Object.prototype.hasOwnProperty.call(raw, "sources")) {
|
| 165 |
+
const rawSources = syncObject(raw.sources);
|
| 166 |
+
sources = {};
|
| 167 |
+
for (const [name, value] of Object.entries(rawSources)) {
|
| 168 |
+
const entry = syncObject(value);
|
| 169 |
+
const sourceDone = syncCount(entry.done);
|
| 170 |
+
const sourceTotal = syncCount(entry.total);
|
| 171 |
+
if (typeof entry.active !== "boolean" || sourceDone === null || sourceTotal === null
|
| 172 |
+
|| sourceDone > sourceTotal || typeof entry.behind !== "string") {
|
| 173 |
+
throw new Error("Sync status unavailable");
|
| 174 |
+
}
|
| 175 |
+
sources[name] = { active: entry.active, done: sourceDone, total: sourceTotal,
|
| 176 |
+
behind: syncText(entry.behind) };
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
return { active: raw.active, done, total, newest, sources };
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/** The catch-up source a connector card or database waits on. */
|
| 183 |
+
export function catchUpSourceKey(key: string): string {
|
| 184 |
+
if (key === "amazon_sp" || key === "amazon" || key.startsWith("ut_amzn_")) return "amazon";
|
| 185 |
+
if (key === "meta_ads" || key === "meta" || key.startsWith("ut_meta_")) return "meta";
|
| 186 |
+
return "odoo";
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/** Scope the tenant status to one source; an older server keeps the tenant total on Odoo only. */
|
| 190 |
+
export function sourceCatchUp(catchUp: ConnectorCatchUp | null, source: string): ConnectorCatchUp | null {
|
| 191 |
+
if (!catchUp) return null;
|
| 192 |
+
if (catchUp.sources === null) return source === "odoo" ? catchUp : null;
|
| 193 |
+
const own = catchUp.sources[source];
|
| 194 |
+
if (!own) return null;
|
| 195 |
+
return { ...catchUp, active: catchUp.active && own.active, done: own.done, total: own.total,
|
| 196 |
+
behind: own.behind || undefined };
|
| 197 |
}
|
| 198 |
|
| 199 |
export async function readConnectorCatchUp(signal: AbortSignal): Promise<ConnectorCatchUp | null> {
|
|
|
|
| 206 |
return `Updating ${catchUp.done.toLocaleString()} of ${catchUp.total.toLocaleString()}`;
|
| 207 |
}
|
| 208 |
|
| 209 |
+
export function behindLabel(reason: string): string {
|
| 210 |
+
return `Behind. ${reason}`;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
export function useConnectorCatchUp(enabled: boolean) {
|
| 214 |
const [state, setState] = useState<{
|
| 215 |
catchUp: ConnectorCatchUp | null; error: string; loading: boolean;
|
|
|
|
| 2423 |
<td colSpan={showsPopulation ? 8 : 7}>
|
| 2424 |
<DatabaseSyncSummary health={databaseSync.states[database.key]}
|
| 2425 |
error={databaseSync.error}
|
| 2426 |
+
databaseKey={database.key} catchUp={sourceCatchUp(catchUpStatus.catchUp, "odoo")}
|
| 2427 |
catchUpError={catchUpStatus.error} catchUpLoading={catchUpStatus.loading}
|
| 2428 |
errorCovered={showsAmazonSync && amazonSync.states[database.key]?.refused === true} />
|
| 2429 |
<DatabasePanel
|
web/src/customer-grid/GridActivity.tsx
CHANGED
|
@@ -135,11 +135,16 @@ export function GridActivity({ database }: { database: string }) {
|
|
| 135 |
if (!response.ok) throw new Error("status unavailable");
|
| 136 |
const body = await response.json() as {
|
| 137 |
tables?: Record<string, unknown>;
|
| 138 |
-
catchUp?: { active: boolean; done: number; total: number; newest: Record<string, string>
|
|
|
|
| 139 |
};
|
| 140 |
connected = Object.hasOwn(body.tables ?? {}, database);
|
| 141 |
-
// C1 owns catch-up;
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
} catch {
|
| 144 |
if (live) setCatchUp({ database, active: false });
|
| 145 |
} finally {
|
|
|
|
| 135 |
if (!response.ok) throw new Error("status unavailable");
|
| 136 |
const body = await response.json() as {
|
| 137 |
tables?: Record<string, unknown>;
|
| 138 |
+
catchUp?: { active: boolean; done: number; total: number; newest: Record<string, string>;
|
| 139 |
+
sources?: Record<string, { active?: boolean }> };
|
| 140 |
};
|
| 141 |
connected = Object.hasOwn(body.tables ?? {}, database);
|
| 142 |
+
// C1 owns catch-up for this database's own source; an unscoped status holds every source.
|
| 143 |
+
const source = database.startsWith("ut_amzn_") ? "amazon"
|
| 144 |
+
: database.startsWith("ut_meta_") ? "meta" : "odoo";
|
| 145 |
+
const own = body.catchUp?.sources?.[source];
|
| 146 |
+
if (live) setCatchUp({ database, active: connected && body.catchUp?.active === true
|
| 147 |
+
&& (own ? own.active === true : true) });
|
| 148 |
} catch {
|
| 149 |
if (live) setCatchUp({ database, active: false });
|
| 150 |
} finally {
|
web/src/sheet/SheetCatchUp.tsx
CHANGED
|
@@ -35,7 +35,15 @@ export default function SheetCatchUp({ workbookId, revision, children }: {
|
|
| 35 |
};
|
| 36 |
}, [workbookId, revision]);
|
| 37 |
|
| 38 |
-
if (!status.active)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
const { done, total } = status;
|
| 40 |
const measured = typeof done === "number" && Number.isSafeInteger(done) && done >= 0
|
| 41 |
&& typeof total === "number" && Number.isSafeInteger(total) && total > 0 && done <= total;
|
|
|
|
| 35 |
};
|
| 36 |
}, [workbookId, revision]);
|
| 37 |
|
| 38 |
+
if (!status.active) {
|
| 39 |
+
if (!status.behind?.length) return children;
|
| 40 |
+
return <>
|
| 41 |
+
<span className="sheet-catch-up-behind" role="status">
|
| 42 |
+
{status.behind.map((entry) => `${entry.source} is behind. ${entry.reason}`).join(" ")}
|
| 43 |
+
</span>
|
| 44 |
+
{children}
|
| 45 |
+
</>;
|
| 46 |
+
}
|
| 47 |
const { done, total } = status;
|
| 48 |
const measured = typeof done === "number" && Number.isSafeInteger(done) && done >= 0
|
| 49 |
&& typeof total === "number" && Number.isSafeInteger(total) && total > 0 && done <= total;
|
web/src/sheet/sheetApi.ts
CHANGED
|
@@ -63,12 +63,18 @@ export interface SheetCatchUpStatus {
|
|
| 63 |
active: boolean;
|
| 64 |
done?: number;
|
| 65 |
total?: number;
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
export const readSheetCatchUp = (workbookId: string, signal?: AbortSignal): Promise<Result<SheetCatchUpStatus>> =>
|
| 69 |
call(`/sheets/${encodeURIComponent(workbookId)}/catch-up`, { method: "GET", signal }, body => {
|
| 70 |
const status = (body as { catchUp?: SheetCatchUpStatus } | null)?.catchUp;
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
});
|
| 73 |
|
| 74 |
const errorOf = (body: unknown): { code: string; message: string; rev_current?: number } => {
|
|
|
|
| 63 |
active: boolean;
|
| 64 |
done?: number;
|
| 65 |
total?: number;
|
| 66 |
+
/** Sources this workbook binds that settled behind, each with a plain reason. */
|
| 67 |
+
behind?: { source: string; reason: string }[];
|
| 68 |
}
|
| 69 |
|
| 70 |
export const readSheetCatchUp = (workbookId: string, signal?: AbortSignal): Promise<Result<SheetCatchUpStatus>> =>
|
| 71 |
call(`/sheets/${encodeURIComponent(workbookId)}/catch-up`, { method: "GET", signal }, body => {
|
| 72 |
const status = (body as { catchUp?: SheetCatchUpStatus } | null)?.catchUp;
|
| 73 |
+
if (status?.active === true) return status;
|
| 74 |
+
const listed = status?.behind;
|
| 75 |
+
const behind = (Array.isArray(listed) ? listed : []).filter((entry) =>
|
| 76 |
+
typeof entry?.source === "string" && entry.source && typeof entry.reason === "string" && entry.reason);
|
| 77 |
+
return behind.length ? { active: false, behind } : { active: false };
|
| 78 |
});
|
| 79 |
|
| 80 |
const errorOf = (body: unknown): { code: string; message: string; rev_current?: number } => {
|
web/src/styles/sdlc73/sheet.css
CHANGED
|
@@ -160,6 +160,13 @@
|
|
| 160 |
font-variant-numeric: tabular-nums;
|
| 161 |
}
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
.sheet-last-edit {
|
| 164 |
appearance: none;
|
| 165 |
border: 0;
|
|
|
|
| 160 |
font-variant-numeric: tabular-nums;
|
| 161 |
}
|
| 162 |
|
| 163 |
+
.sheet-catch-up-behind {
|
| 164 |
+
padding: 8px 0;
|
| 165 |
+
color: var(--lp-muted);
|
| 166 |
+
font-size: var(--lp-fs-2xs);
|
| 167 |
+
white-space: nowrap;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
.sheet-last-edit {
|
| 171 |
appearance: none;
|
| 172 |
border: 0;
|