Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- platform/harness/amazon_store.py +44 -8
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "b07ce2572",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
b07ce2572
|
platform/harness/amazon_store.py
CHANGED
|
@@ -618,7 +618,15 @@ def _pricing_asins(rows):
|
|
| 618 |
|
| 619 |
|
| 620 |
def _apply_competitive(con, table, responses):
|
| 621 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
rows = _competitive_rows(responses)
|
| 623 |
if not rows:
|
| 624 |
return 0, 0
|
|
@@ -628,13 +636,15 @@ def _apply_competitive(con, table, responses):
|
|
| 628 |
raise ValueError("Pricing mirror has no ASIN column; sync Sales and Traffic before price enrichment")
|
| 629 |
types = _ensure(con, table, cols, rows)
|
| 630 |
assignments = ", ".join(f'"{c}"=?' for c in cols)
|
|
|
|
|
|
|
|
|
|
| 631 |
updated = 0
|
| 632 |
for row in rows:
|
| 633 |
asin = row["competitive_body_asin"]
|
| 634 |
values = [_cell(row.get(c), types.get(c, "VARCHAR")) for c in cols]
|
| 635 |
-
result = con.execute(
|
| 636 |
-
|
| 637 |
-
values + [asin] * len(match_columns))
|
| 638 |
try:
|
| 639 |
updated += int(result.fetchone()[0])
|
| 640 |
except Exception: # noqa: BLE001
|
|
@@ -3737,10 +3747,14 @@ def _sync_candidate(tenant_key="royal-imports", tables=None, since=None, log=pri
|
|
| 3737 |
if table == "pricing":
|
| 3738 |
if first_load:
|
| 3739 |
# Completion can be in another process/pass than the recent ASIN report.
|
|
|
|
|
|
|
| 3740 |
available = {row[1] for row in con.execute(f"PRAGMA table_info('{mirror}')").fetchall()}
|
| 3741 |
-
|
| 3742 |
-
|
| 3743 |
-
|
|
|
|
|
|
|
| 3744 |
state_key = ENTITY_STATE_KEYS[table]
|
| 3745 |
if not pricing_asins:
|
| 3746 |
_record_state(con, state_key, "unproven", 0,
|
|
@@ -6132,6 +6146,28 @@ def selftest(log=print):
|
|
| 6132 |
ck("NC-AZ19 competitive summary enriches every matching report row without appending",
|
| 6133 |
response_count == 1 and updated == 2 and enriched == 2,
|
| 6134 |
(response_count, updated, enriched))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6135 |
|
| 6136 |
mem.execute("""CREATE TABLE _sync_state (
|
| 6137 |
entity VARCHAR PRIMARY KEY, phase VARCHAR, last_id BIGINT,
|
|
@@ -6267,7 +6303,7 @@ def selftest(log=print):
|
|
| 6267 |
ck("NC-AZ29 SQP fixtures and red-first controls", sqp_selftest(log) == 0)
|
| 6268 |
ck("NC-AZ30 group a fixtures and red-first controls", group_a_selftest(log) == 0)
|
| 6269 |
ck("NC-AZ31 legacy snapshot fixtures", snapshot_selftest(log) == 0)
|
| 6270 |
-
log(f"\n{'GREEN' if not fails else 'RED'}: {
|
| 6271 |
return 0 if not fails else 1
|
| 6272 |
|
| 6273 |
|
|
|
|
| 618 |
|
| 619 |
|
| 620 |
def _apply_competitive(con, table, responses):
|
| 621 |
+
"""Replace the mirror's competitive fields with this pass's responses on matching ASIN rows.
|
| 622 |
+
|
| 623 |
+
⛔ A row whose ASIN did not answer this pass is cleared, never left holding an older price
|
| 624 |
+
shown as current; `validate()` counts competitive ASINs against this pass's responses.
|
| 625 |
+
"""
|
| 626 |
+
have = _columns_of(con, table)
|
| 627 |
+
stale = sorted(c for c in have if c.startswith("competitive_"))
|
| 628 |
+
if stale:
|
| 629 |
+
con.execute(f"UPDATE {table} SET " + ", ".join(f'"{c}"=NULL' for c in stale))
|
| 630 |
rows = _competitive_rows(responses)
|
| 631 |
if not rows:
|
| 632 |
return 0, 0
|
|
|
|
| 636 |
raise ValueError("Pricing mirror has no ASIN column; sync Sales and Traffic before price enrichment")
|
| 637 |
types = _ensure(con, table, cols, rows)
|
| 638 |
assignments = ", ".join(f'"{c}"=?' for c in cols)
|
| 639 |
+
# A parent ASIN's summary prices only a row with no child ASIN, never that parent's SKU rows.
|
| 640 |
+
where = ('"child_asin"=? OR ("child_asin" IS NULL AND "parent_asin"=?)' if len(match_columns) == 2
|
| 641 |
+
else f'"{match_columns[0]}"=?')
|
| 642 |
updated = 0
|
| 643 |
for row in rows:
|
| 644 |
asin = row["competitive_body_asin"]
|
| 645 |
values = [_cell(row.get(c), types.get(c, "VARCHAR")) for c in cols]
|
| 646 |
+
result = con.execute(f'UPDATE {table} SET {assignments} WHERE {where}',
|
| 647 |
+
values + [asin] * len(match_columns))
|
|
|
|
| 648 |
try:
|
| 649 |
updated += int(result.fetchone()[0])
|
| 650 |
except Exception: # noqa: BLE001
|
|
|
|
| 3747 |
if table == "pricing":
|
| 3748 |
if first_load:
|
| 3749 |
# Completion can be in another process/pass than the recent ASIN report.
|
| 3750 |
+
# One ASIN per row, as `_pricing_asins` picks it: a parent beside its children
|
| 3751 |
+
# would answer for no row and `validate()` would refuse the pass.
|
| 3752 |
available = {row[1] for row in con.execute(f"PRAGMA table_info('{mirror}')").fetchall()}
|
| 3753 |
+
picked = [c for c in ("child_asin", "parent_asin") if c in available]
|
| 3754 |
+
select = ", ".join(f'"{c}"' for c in picked)
|
| 3755 |
+
mirror_rows = [dict(zip(picked, row)) for row in con.execute(
|
| 3756 |
+
f"SELECT DISTINCT {select} FROM {mirror}").fetchall()] if picked else []
|
| 3757 |
+
pricing_asins = list(dict.fromkeys(pricing_asins + _pricing_asins(mirror_rows)))
|
| 3758 |
state_key = ENTITY_STATE_KEYS[table]
|
| 3759 |
if not pricing_asins:
|
| 3760 |
_record_state(con, state_key, "unproven", 0,
|
|
|
|
| 6146 |
ck("NC-AZ19 competitive summary enriches every matching report row without appending",
|
| 6147 |
response_count == 1 and updated == 2 and enriched == 2,
|
| 6148 |
(response_count, updated, enriched))
|
| 6149 |
+
held = duckdb.connect(":memory:")
|
| 6150 |
+
held.execute("CREATE TABLE amzn_pricing (child_asin VARCHAR, parent_asin VARCHAR, "
|
| 6151 |
+
"competitive_body_asin VARCHAR, competitive_status_status_code BIGINT)")
|
| 6152 |
+
held.execute("INSERT INTO amzn_pricing VALUES ('B01','P01',NULL,NULL), ('B02','P02','B02',200)")
|
| 6153 |
+
response_count, _ = _apply_competitive(held, "amzn_pricing", competitive)
|
| 6154 |
+
left = held.execute("SELECT competitive_body_asin, competitive_status_status_code FROM amzn_pricing "
|
| 6155 |
+
"WHERE child_asin='B02'").fetchone()
|
| 6156 |
+
carried = held.execute("SELECT COUNT(DISTINCT competitive_body_asin) FROM amzn_pricing "
|
| 6157 |
+
"WHERE competitive_body_asin IS NOT NULL").fetchone()[0]
|
| 6158 |
+
held.close()
|
| 6159 |
+
ck("NC-AZ32 an ASIN absent from this pass keeps no earlier competitive price",
|
| 6160 |
+
left == (None, None) and carried == response_count == 1, (left, carried, response_count))
|
| 6161 |
+
sku = duckdb.connect(":memory:")
|
| 6162 |
+
sku.execute("CREATE TABLE amzn_pricing (child_asin VARCHAR, parent_asin VARCHAR)")
|
| 6163 |
+
sku.execute("INSERT INTO amzn_pricing VALUES ('B01','P01'), ('B03','P01'), (NULL,'P04')")
|
| 6164 |
+
family = [{"body": {"asin": a, "price": p}} for a, p in (("B01", 1), ("B03", 3), ("P01", 9), ("P04", 4))]
|
| 6165 |
+
response_count, _ = _apply_competitive(sku, "amzn_pricing", family)
|
| 6166 |
+
priced = sku.execute("SELECT COALESCE(child_asin, parent_asin), competitive_body_asin, competitive_body_price "
|
| 6167 |
+
"FROM amzn_pricing ORDER BY 1").fetchall()
|
| 6168 |
+
sku.close()
|
| 6169 |
+
ck("NC-AZ33 a parent ASIN's summary never overwrites its SKU rows",
|
| 6170 |
+
priced == [("B01", "B01", 1), ("B03", "B03", 3), ("P04", "P04", 4)] and response_count == 4, priced)
|
| 6171 |
|
| 6172 |
mem.execute("""CREATE TABLE _sync_state (
|
| 6173 |
entity VARCHAR PRIMARY KEY, phase VARCHAR, last_id BIGINT,
|
|
|
|
| 6303 |
ck("NC-AZ29 SQP fixtures and red-first controls", sqp_selftest(log) == 0)
|
| 6304 |
ck("NC-AZ30 group a fixtures and red-first controls", group_a_selftest(log) == 0)
|
| 6305 |
ck("NC-AZ31 legacy snapshot fixtures", snapshot_selftest(log) == 0)
|
| 6306 |
+
log(f"\n{'GREEN' if not fails else 'RED'}: {33 - len(fails)}/33")
|
| 6307 |
return 0 if not fails else 1
|
| 6308 |
|
| 6309 |
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
cb8f337e46d2f3be3b566f171494c0f6cd6860be3b800b8d006a62b1e062dfe0
|