Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- platform/harness/amazon_client.py +3 -1
- platform/harness/amazon_store.py +30 -5
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "6f94f0e07f",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
6f94f0e07f
|
platform/harness/amazon_client.py
CHANGED
|
@@ -365,7 +365,9 @@ REPORT_TYPES = {
|
|
| 365 |
"report": "GET_LEDGER_SUMMARY_VIEW_DATA",
|
| 366 |
"snapshot": True,
|
| 367 |
"dated_snapshot": True,
|
| 368 |
-
|
|
|
|
|
|
|
| 369 |
"entity_read": "AWD v2024-05-09 listInventory (all 200-row pages)",
|
| 370 |
"validates_against": "FBA ledger summary vs detail and AWD API items vs stored AWD rows",
|
| 371 |
"role": "Amazon Fulfillment / Amazon Warehousing and Distribution",
|
|
|
|
| 365 |
"report": "GET_LEDGER_SUMMARY_VIEW_DATA",
|
| 366 |
"snapshot": True,
|
| 367 |
"dated_snapshot": True,
|
| 368 |
+
# D-18058: Amazon names it aggregatedByTimePeriod. A misspelt key falls back to MONTHLY,
|
| 369 |
+
# which returns an empty document for any window shorter than a whole month.
|
| 370 |
+
"options": {"aggregatedByTimePeriod": "DAILY", "aggregateByLocation": "COUNTRY"},
|
| 371 |
"entity_read": "AWD v2024-05-09 listInventory (all 200-row pages)",
|
| 372 |
"validates_against": "FBA ledger summary vs detail and AWD API items vs stored AWD rows",
|
| 373 |
"role": "Amazon Fulfillment / Amazon Warehousing and Distribution",
|
platform/harness/amazon_store.py
CHANGED
|
@@ -7907,6 +7907,15 @@ def _ledger_detail_rows(con, first, last):
|
|
| 7907 |
[first, last]).fetchone()[0])
|
| 7908 |
|
| 7909 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7910 |
def _ledger_date(value):
|
| 7911 |
"""The DAILY ledger uses US dates; normalize dates without inventing a report date."""
|
| 7912 |
value = str(value or "").strip()
|
|
@@ -8019,11 +8028,13 @@ def _replace_legacy_snapshot(con, table, columns, rows, meta, source_count, wind
|
|
| 8019 |
if total != source_count:
|
| 8020 |
raise ValueError(f"Amazon {table} snapshot row count differs from its document")
|
| 8021 |
if table == "inventory" and not total and window:
|
| 8022 |
-
detail = _ledger_detail_rows(con, *window)
|
| 8023 |
-
if detail:
|
|
|
|
|
|
|
| 8024 |
raise ValueError(
|
| 8025 |
-
f"Amazon returned no FBA ledger summary rows for {window[0]} to {window[1]} while
|
| 8026 |
-
f"
|
| 8027 |
"Retry Amazon sync after Amazon finishes those days")
|
| 8028 |
if not counts:
|
| 8029 |
counts[_utc(stamp).date().isoformat()] = 0
|
|
@@ -11955,6 +11966,9 @@ def ledger_window_selftest(log=print, check=None):
|
|
| 11955 |
days["2026-03-08T09:30:00Z"][1] == "2026-03-07" and days["2026-03-08T10:30:00Z"][1] == "2026-03-07")
|
| 11956 |
ck("summer reads Pacific daylight time",
|
| 11957 |
days["2026-07-01T06:30:00Z"][1] == "2026-06-29" and days["2026-07-01T07:30:00Z"][1] == "2026-06-30")
|
|
|
|
|
|
|
|
|
|
| 11958 |
window = _ledger_window(at("2026-11-27T00:54:23Z"))
|
| 11959 |
ck("the request spans whole closed days",
|
| 11960 |
window == {"start": "2026-11-23T00:00:00Z", "end": "2026-11-25T23:59:59Z"})
|
|
@@ -12003,6 +12017,17 @@ def ledger_window_selftest(log=print, check=None):
|
|
| 12003 |
con.execute("SELECT COUNT(*) FROM amzn_inventory").fetchone()[0] == 3)
|
| 12004 |
|
| 12005 |
con.execute("DELETE FROM amzn_inventory_ledger_detail WHERE date >= '2026-11-23'")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12006 |
landed(con, "", "ledger-truly-empty")
|
| 12007 |
marker = json.loads(_read_state(con, "amzn_reconcile_inventory")["detail"])
|
| 12008 |
ck("a truly empty seller still lands its empty proof",
|
|
@@ -12138,7 +12163,7 @@ def snapshot_selftest(log=print, check=None):
|
|
| 12138 |
con.execute("SELECT COUNT(*), COUNT(DISTINCT (date, msku, disposition, location)), "
|
| 12139 |
"COUNT(DISTINCT _snapshot_date), MIN(CAST(_snapshot_date AS VARCHAR)) "
|
| 12140 |
"FROM amzn_inventory").fetchone() == (3, 3, 1, "2026-09-24")
|
| 12141 |
-
and calls[0].get("options", {}).get("
|
| 12142 |
payload[0] = ledger_header + "09/24/2026\tA\tFA\tAA\tSELLABLE\tUS\t9\n"
|
| 12143 |
sync(rt.key, tables=[table], since=start, rt=rt, log=lambda *_a: None)
|
| 12144 |
# S67-T32 (D-3031, reversed): the next document replaces every earlier FBA date.
|
|
|
|
| 7907 |
[first, last]).fetchone()[0])
|
| 7908 |
|
| 7909 |
|
| 7910 |
+
def _fba_summary_units(con):
|
| 7911 |
+
"""Units the FBA inventory API summaries hold now, or None when that mirror is absent."""
|
| 7912 |
+
mirror = table_name("fba_inventory")
|
| 7913 |
+
if "total_quantity" not in _columns_of(con, mirror):
|
| 7914 |
+
return None
|
| 7915 |
+
return int(con.execute(
|
| 7916 |
+
f"SELECT COALESCE(SUM(GREATEST(TRY_CAST(total_quantity AS BIGINT), 0)), 0) FROM {mirror}").fetchone()[0])
|
| 7917 |
+
|
| 7918 |
+
|
| 7919 |
def _ledger_date(value):
|
| 7920 |
"""The DAILY ledger uses US dates; normalize dates without inventing a report date."""
|
| 7921 |
value = str(value or "").strip()
|
|
|
|
| 8028 |
if total != source_count:
|
| 8029 |
raise ValueError(f"Amazon {table} snapshot row count differs from its document")
|
| 8030 |
if table == "inventory" and not total and window:
|
| 8031 |
+
detail, units = _ledger_detail_rows(con, *window), _fba_summary_units(con)
|
| 8032 |
+
if detail or units:
|
| 8033 |
+
evidence = (f"the ledger detail holds {detail} rows for those days" if detail
|
| 8034 |
+
else f"the FBA inventory summaries hold {units} units")
|
| 8035 |
raise ValueError(
|
| 8036 |
+
f"Amazon returned no FBA ledger summary rows for {window[0]} to {window[1]} while "
|
| 8037 |
+
f"{evidence}, so the last inventory rows are kept. "
|
| 8038 |
"Retry Amazon sync after Amazon finishes those days")
|
| 8039 |
if not counts:
|
| 8040 |
counts[_utc(stamp).date().isoformat()] = 0
|
|
|
|
| 11966 |
days["2026-03-08T09:30:00Z"][1] == "2026-03-07" and days["2026-03-08T10:30:00Z"][1] == "2026-03-07")
|
| 11967 |
ck("summer reads Pacific daylight time",
|
| 11968 |
days["2026-07-01T06:30:00Z"][1] == "2026-06-29" and days["2026-07-01T07:30:00Z"][1] == "2026-06-30")
|
| 11969 |
+
options = _client().REPORT_TYPES["inventory"].get("options") or {}
|
| 11970 |
+
ck("the summary asks DAILY rows under Amazon's own option name",
|
| 11971 |
+
options.get("aggregatedByTimePeriod") == "DAILY" and "aggregateByTimePeriod" not in options)
|
| 11972 |
window = _ledger_window(at("2026-11-27T00:54:23Z"))
|
| 11973 |
ck("the request spans whole closed days",
|
| 11974 |
window == {"start": "2026-11-23T00:00:00Z", "end": "2026-11-25T23:59:59Z"})
|
|
|
|
| 12017 |
con.execute("SELECT COUNT(*) FROM amzn_inventory").fetchone()[0] == 3)
|
| 12018 |
|
| 12019 |
con.execute("DELETE FROM amzn_inventory_ledger_detail WHERE date >= '2026-11-23'")
|
| 12020 |
+
con.execute("CREATE TABLE amzn_fba_inventory (seller_sku VARCHAR, total_quantity BIGINT)")
|
| 12021 |
+
con.execute("INSERT INTO amzn_fba_inventory VALUES ('S1', 0), ('S2', 7)")
|
| 12022 |
+
try:
|
| 12023 |
+
landed(con, "", "ledger-empty-with-fba-stock")
|
| 12024 |
+
refused = ""
|
| 12025 |
+
except ValueError as exc:
|
| 12026 |
+
refused = str(exc)
|
| 12027 |
+
ck("an empty summary refuses while the FBA summaries hold stock and the detail lags",
|
| 12028 |
+
"FBA inventory summaries hold 7 units" in refused
|
| 12029 |
+
and con.execute("SELECT COUNT(*) FROM amzn_inventory").fetchone()[0] == 3)
|
| 12030 |
+
con.execute("UPDATE amzn_fba_inventory SET total_quantity = 0")
|
| 12031 |
landed(con, "", "ledger-truly-empty")
|
| 12032 |
marker = json.loads(_read_state(con, "amzn_reconcile_inventory")["detail"])
|
| 12033 |
ck("a truly empty seller still lands its empty proof",
|
|
|
|
| 12163 |
con.execute("SELECT COUNT(*), COUNT(DISTINCT (date, msku, disposition, location)), "
|
| 12164 |
"COUNT(DISTINCT _snapshot_date), MIN(CAST(_snapshot_date AS VARCHAR)) "
|
| 12165 |
"FROM amzn_inventory").fetchone() == (3, 3, 1, "2026-09-24")
|
| 12166 |
+
and calls[0].get("options", {}).get("aggregatedByTimePeriod") == "DAILY")
|
| 12167 |
payload[0] = ledger_header + "09/24/2026\tA\tFA\tAA\tSELLABLE\tUS\t9\n"
|
| 12168 |
sync(rt.key, tables=[table], since=start, rt=rt, log=lambda *_a: None)
|
| 12169 |
# S67-T32 (D-3031, reversed): the next document replaces every earlier FBA date.
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
4e1a2ac1607ea2a15706786c19eeae787738683043e6aa5a429e20f09f735bc2
|