fsanyoto commited on
Commit
f11dd69
·
verified ·
1 Parent(s): d462547

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "d8d4aff34",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "3661e26c0",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- d8d4aff34
 
1
+ 3661e26c0
api/amazon_relational.py CHANGED
@@ -493,10 +493,13 @@ def restore_pending(rt=None):
493
  return True
494
 
495
 
496
- def missing_source(key, rt=None):
497
- """The ONE sentence every door gives for an Amazon table this server's mirror does not hold yet."""
 
 
 
498
  label = key.removeprefix(PREFIX).replace("_", " ")
499
- if restore_pending(rt):
500
  return {"missing": f"Amazon {label} is still loading after a server restart, "
501
  "so ask again in 5 minutes."}
502
  return {"missing": f"Amazon {label} is still loading from Amazon, "
 
493
  return True
494
 
495
 
496
+ def missing_source(key, rt=None, *, pending=None):
497
+ """The ONE sentence every door gives for an Amazon table this server's mirror does not hold yet.
498
+
499
+ `pending` is a `restore_pending()` answer the caller already holds, so a listing reads the keychain once.
500
+ """
501
  label = key.removeprefix(PREFIX).replace("_", " ")
502
+ if restore_pending(rt) if pending is None else pending:
503
  return {"missing": f"Amazon {label} is still loading after a server restart, "
504
  "so ask again in 5 minutes."}
505
  return {"missing": f"Amazon {label} is still loading from Amazon, "
api/assistant_mirror.py CHANGED
@@ -107,6 +107,14 @@ class ReadinessSnapshot:
107
  self._phases = {}
108
  self._loading = {}
109
  self._amazon_learned = False
 
 
 
 
 
 
 
 
110
 
111
  def source(self, key):
112
  if self._sources is None:
@@ -159,6 +167,8 @@ def unavailable_reason(table_key, definition=None, *, snapshot=None):
159
  if key.startswith("ut_amzn_"):
160
  import amazon_relational as amazon
161
  if key in amazon.SOURCE:
 
 
162
  return amazon.missing_source(key)["missing"]
163
  spec = snapshot.source(key) if snapshot is not None else _rot()._sources().get(key)
164
  if spec and not spec.get("missing"):
@@ -258,6 +268,9 @@ def is_bound(cur, table_key, *, snapshot=None):
258
  import amazon_relational as amazon
259
  if key not in amazon.SOURCE:
260
  return False
 
 
 
261
  current = amazon.grid_source(cur, key) or {}
262
  return bool(current) and not current.get("missing")
263
  if not spec or spec.get("missing"):
 
107
  self._phases = {}
108
  self._loading = {}
109
  self._amazon_learned = False
110
+ self._amazon_pending = None
111
+
112
+ def amazon_pending(self):
113
+ """`amazon_relational.restore_pending()`, read once per listing: a data fact, never a permission."""
114
+ if self._amazon_pending is None:
115
+ import amazon_relational
116
+ self._amazon_pending = bool(amazon_relational.restore_pending())
117
+ return self._amazon_pending
118
 
119
  def source(self, key):
120
  if self._sources is None:
 
167
  if key.startswith("ut_amzn_"):
168
  import amazon_relational as amazon
169
  if key in amazon.SOURCE:
170
+ if snapshot is not None:
171
+ return amazon.missing_source(key, pending=snapshot.amazon_pending())["missing"]
172
  return amazon.missing_source(key)["missing"]
173
  spec = snapshot.source(key) if snapshot is not None else _rot()._sources().get(key)
174
  if spec and not spec.get("missing"):
 
268
  import amazon_relational as amazon
269
  if key not in amazon.SOURCE:
270
  return False
271
+ # A yes/no: no columns is unbound. `grid_source` would read the keychain to word why.
272
+ if not amazon.mirror_columns(cur, amazon.SOURCE[key]):
273
+ return False
274
  current = amazon.grid_source(cur, key) or {}
275
  return bool(current) and not current.get("missing")
276
  if not spec or spec.get("missing"):
api/deps.py CHANGED
@@ -1067,8 +1067,27 @@ def assistant_permitted_sources(session: Session, databases):
1067
  if row["permitted"]}
1068
 
1069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
  def assistant_source_status(session: Session, databases=None):
1071
- """Report source availability, using one permissioned event to probe native activity.
1072
 
1073
  ⭐⭐ `answerable` EXISTS BECAUSE `permitted` IS NOT THE QUESTION THE READER IS ASKING.
1074
  Measured on tenant #0, signed in, 2026-08-15: the Assistant offered **twelve** source chips
@@ -1262,8 +1281,7 @@ def assistant_source_status(session: Session, databases=None):
1262
  row["permitted"] = True
1263
  if key == "ut_activity":
1264
  try:
1265
- import routes_tables
1266
- routes_tables.query_activity(session, limit=1)
1267
  row["answerable"] = True
1268
  except Exception:
1269
  row["reason"] = "Activity is unavailable right now. Try again shortly."
 
1067
  if row["permitted"]}
1068
 
1069
 
1070
+ def _assistant_activity_available(session: Session):
1071
+ """Raise unless native Activity can be read here. Authorizes no event and reads no event page.
1072
+
1073
+ The checks `routes_tables.query_activity` runs before its read: storage binding, the table
1074
+ wall, and the rows-free field assembly. `query_activity(limit=1)` used to answer this and
1075
+ authorized a 1,000-event page, loading a workbook per Sheet event.
1076
+ """
1077
+ from core import activity_log
1078
+ import routes_tables
1079
+
1080
+ key = activity_log.DATABASE_KEY
1081
+ activity_log._backend(session.runtime)
1082
+ context_store = routes_tables._table_lend(session.runtime, key, defs_only=True)
1083
+ routes_tables._defn_or_refuse(session, key, st=context_store, defs_only=True, scope_applied=True)
1084
+ routes_tables._compute_ut_assembly(session, key, st=context_store, with_rows=False,
1085
+ fields_only=True, include_usage=False,
1086
+ include_measures=False)
1087
+
1088
+
1089
  def assistant_source_status(session: Session, databases=None):
1090
+ """Report source availability. Native Activity is probed without reading an event.
1091
 
1092
  ⭐⭐ `answerable` EXISTS BECAUSE `permitted` IS NOT THE QUESTION THE READER IS ASKING.
1093
  Measured on tenant #0, signed in, 2026-08-15: the Assistant offered **twelve** source chips
 
1281
  row["permitted"] = True
1282
  if key == "ut_activity":
1283
  try:
1284
+ _assistant_activity_available(session)
 
1285
  row["answerable"] = True
1286
  except Exception:
1287
  row["reason"] = "Activity is unavailable right now. Try again shortly."
platform/harness/amazon_store.py CHANGED
@@ -6711,6 +6711,16 @@ def selftest(log=print):
6711
  ck("NC-AZ27 the public purge wrapper deletes and reads back an isolated tenant file",
6712
  public_ok, public_detail)
6713
 
 
 
 
 
 
 
 
 
 
 
6714
  ck("NC-AZ28 margin fixtures and red-first controls", margin_selftest(log) == 0)
6715
  ck("NC-AZ29 SQP fixtures and red-first controls", sqp_selftest(log) == 0)
6716
  ck("NC-AZ30 group a fixtures and red-first controls", group_a_selftest(log) == 0)
@@ -6719,7 +6729,7 @@ def selftest(log=print):
6719
  ck("NC-AZ34 a spooled document parses and counts exactly as its text does", same, detail)
6720
  bounded, detail = _bounded_document_selftest()
6721
  ck("NC-AZ35 a large synthetic report parses and writes in bounded memory", bounded, detail)
6722
- log(f"\n{'GREEN' if not fails else 'RED'}: {35 - len(fails)}/35")
6723
  return 0 if not fails else 1
6724
 
6725
 
@@ -6763,7 +6773,7 @@ def _spooled_parse_selftest():
6763
  misses.append(f"flat count {index}")
6764
  documents = ['', '[]', '{"rows": []}', '{"rows": {"a": 1}}', '{"rows": [1]}', '{"rows": [{"a": 1},]}',
6765
  '{"rows": [{"a": 1}]} x', '{"rows": [{"a": 1}], "rows": [{"b": 2}]}', '{"other": 1}',
6766
- ' {"spec": {"q": [1, [2]]}, "rows": [{"a": 1, "b": null, "n": {"c": "\u2014"}}, '
6767
  '{"a": 2.5, "l": [1, 2]}], "tail": [[1], []]} ',
6768
  '{"rows": [{"_report_document_id": "vendor"}]}', '{"rows": [{"buyerEmail": "e", "a": 123456789012345678901}]}',
6769
  '{"x": NaN, "rows": [{"v": Infinity, "w": -0.0, "s": "\\ud83d"}]}']
@@ -6791,7 +6801,7 @@ def _bounded_document_selftest(rows=24_000):
6791
  out.write('{"reportSpecification": {"reportType": "selftest"}, "dataByDepartmentAndSearchTerm": [')
6792
  for i in range(rows):
6793
  out.write(("," if i else "") + json.dumps({
6794
- "departmentName": "Amazon.com", "searchTerm": f"term {i} \u2014 caf\u00e9",
6795
  "searchFrequencyRank": i + 1, "clickedAsin": f"B0{i:08d}",
6796
  "clickedItemName": f"Product title number {i} with several words", "clickShareRank": i % 3 + 1,
6797
  "clickShare": round(i / 7 % 1, 4), "conversionShare": round(i / 11 % 1, 4)}))
@@ -6886,4 +6896,6 @@ def main(argv=None):
6886
 
6887
 
6888
  if __name__ == "__main__":
6889
- sys.exit(main())
 
 
 
6711
  ck("NC-AZ27 the public purge wrapper deletes and reads back an isolated tenant file",
6712
  public_ok, public_detail)
6713
 
6714
+ # W-8734: "AttributeError: 'Runtime' object has no attribute 'assert_datastore_matches'" at NC-AZ28,
6715
+ # run as a script: the patches below land on this module, sync resolves harness.amazon_store's store.
6716
+ ck("NC-AZ36 the selftest runs in the module whose store the Amazon mirror resolves",
6717
+ _mirrors.for_connector("amazon") is _MIRROR_STORE, __name__)
6718
+ import importlib.util
6719
+ spec = importlib.util.spec_from_file_location(f"_amazon_store_copy_{os.getpid()}", __file__)
6720
+ second = importlib.util.module_from_spec(spec)
6721
+ spec.loader.exec_module(second)
6722
+ ck("NC-AZ37 a second copy of this file holds a store the Amazon mirror never resolves",
6723
+ _mirrors.for_connector("amazon") is not second._MIRROR_STORE)
6724
  ck("NC-AZ28 margin fixtures and red-first controls", margin_selftest(log) == 0)
6725
  ck("NC-AZ29 SQP fixtures and red-first controls", sqp_selftest(log) == 0)
6726
  ck("NC-AZ30 group a fixtures and red-first controls", group_a_selftest(log) == 0)
 
6729
  ck("NC-AZ34 a spooled document parses and counts exactly as its text does", same, detail)
6730
  bounded, detail = _bounded_document_selftest()
6731
  ck("NC-AZ35 a large synthetic report parses and writes in bounded memory", bounded, detail)
6732
+ log(f"\n{'GREEN' if not fails else 'RED'}: {37 - len(fails)}/37")
6733
  return 0 if not fails else 1
6734
 
6735
 
 
6773
  misses.append(f"flat count {index}")
6774
  documents = ['', '[]', '{"rows": []}', '{"rows": {"a": 1}}', '{"rows": [1]}', '{"rows": [{"a": 1},]}',
6775
  '{"rows": [{"a": 1}]} x', '{"rows": [{"a": 1}], "rows": [{"b": 2}]}', '{"other": 1}',
6776
+ ' {"spec": {"q": [1, [2]]}, "rows": [{"a": 1, "b": null, "n": {"c": "\u201c"}}, '
6777
  '{"a": 2.5, "l": [1, 2]}], "tail": [[1], []]} ',
6778
  '{"rows": [{"_report_document_id": "vendor"}]}', '{"rows": [{"buyerEmail": "e", "a": 123456789012345678901}]}',
6779
  '{"x": NaN, "rows": [{"v": Infinity, "w": -0.0, "s": "\\ud83d"}]}']
 
6801
  out.write('{"reportSpecification": {"reportType": "selftest"}, "dataByDepartmentAndSearchTerm": [')
6802
  for i in range(rows):
6803
  out.write(("," if i else "") + json.dumps({
6804
+ "departmentName": "Amazon.com", "searchTerm": f"term {i} \u2122 caf\u00e9",
6805
  "searchFrequencyRank": i + 1, "clickedAsin": f"B0{i:08d}",
6806
  "clickedItemName": f"Product title number {i} with several words", "clickShareRank": i % 3 + 1,
6807
  "clickShare": round(i / 7 % 1, 4), "conversionShare": round(i / 11 % 1, 4)}))
 
6896
 
6897
 
6898
  if __name__ == "__main__":
6899
+ # Run harness.amazon_store, the copy mirror_store resolves, never this __main__ copy.
6900
+ from harness import amazon_store as _canonical # noqa: E402
6901
+ sys.exit(_canonical.main())
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- d2fa594401382fc3c0d95832d3ecdf94f78659e63af0618b6e5a6b6241a5f9f3
 
1
+ 814984825ac558b3e207f799a27e2eb0ce820d7831cf56b7e9149fe90ea43205