fsanyoto commited on
Commit
f2f7ccf
Β·
verified Β·
1 Parent(s): 7227e08

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
Files changed (3) hide show
  1. RELEASES.json +1 -1
  2. VERSION +1 -1
  3. api/main.py +32 -1
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "58237fc",
3
  "releases": [
4
  {
5
  "version": "v24",
 
1
  {
2
+ "current": "bc24829",
3
  "releases": [
4
  {
5
  "version": "v24",
VERSION CHANGED
@@ -1 +1 @@
1
- 58237fc
 
1
+ bc24829
api/main.py CHANGED
@@ -562,14 +562,45 @@ def _sweep_automation_schemas(why):
562
  for slug in tenants:
563
  try:
564
  rt = _runtime.get_runtime(slug)
565
- ensured = []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  for s in schemas:
567
  for key, child in (s.get("children") or {}).items():
 
 
 
568
  got = _eng.ut_ensure(rt, child["label"], child["fields"], "automation",
569
  key=key, lock_fields=True,
570
  record_mode=child["record_mode"])
571
  if got:
572
  ensured.append(got)
 
 
 
 
 
 
 
 
573
  # ⭐ THE RETRACTION (D's `retract_foreign_presets`, D-152), AFTER the children loop.
574
  # β›” THE SWEEP ABOVE MAKES COLUMNS **ARRIVE** AND CANNOT MAKE STALE ONES **LEAVE**, and
575
  # T07's `done-when` asserts both ("no `ut_tt_*` grid carries an Instagram column"). On a
 
562
  for slug in tenants:
563
  try:
564
  rt = _runtime.get_runtime(slug)
565
+ # β›”β›” FIXED 2026-08-13 β€” THIS SWEEP WAS SPAWNING EIGHT DATABASES IN EVERY TENANT.
566
+ # Owner: *"Database for Royal Imports, why we have fucking IG and TIktok databases."*
567
+ # `ut_ensure`'s first line is *"Create the table if it is missing"*, and this loop fed
568
+ # it every child of every platform schema for every tenant β€” so tenant #0, a floral and
569
+ # giftware importer with ZERO automations, woke up on 2026-08-13 at 12:05 UTC owning
570
+ # `ut_ig_posts`, `ut_ig_comments`, `ut_ig_snapshots`, `ut_ig_post_snapshots` and the
571
+ # four TikTok twins, all empty, all in his nav flyout. **The bug is one word wide:**
572
+ # this function's own title says *"MAKE D'S DECLARATIONS REACH TENANTS THAT ALREADY HAVE
573
+ # THE TABLES"* and its body called a CREATE-OR-MERGE function to do a MERGE-ONLY job.
574
+ # [[reuse-and-delete-are-hypotheses]] β€” `ut_ensure` was the right function for the
575
+ # merge and brought a second behaviour nobody wanted with it.
576
+ #
577
+ # ⭐ THE PREDICATE IS "DOES THIS TENANT ALREADY HAVE THE TABLE", read ONCE per tenant
578
+ # rather than per child β€” `rt.get` deep-copies the whole tenant document (28.6 MB on
579
+ # tenant #0), so asking eight times is eight copies to answer one question.
580
+ # ⚠ AND IT MUST NOT WEAKEN THE DELIVERY: a tenant that HAS `ut_tt_comments` still gets
581
+ # the `text` column and the `recordMode` stamp, which is the entire point of T07. The
582
+ # sweep now delivers to tables that exist and mints none, which is what it always
583
+ # claimed to do.
584
+ have = set(rt.get("user_tables") or {})
585
+ ensured, skipped = [], []
586
  for s in schemas:
587
  for key, child in (s.get("children") or {}).items():
588
+ if key not in have:
589
+ skipped.append(key)
590
+ continue
591
  got = _eng.ut_ensure(rt, child["label"], child["fields"], "automation",
592
  key=key, lock_fields=True,
593
  record_mode=child["record_mode"])
594
  if got:
595
  ensured.append(got)
596
+ if skipped:
597
+ # ⭐ SAID OUT LOUD, never silently skipped β€” this repo's "no silent caps" rule. A
598
+ # sweep that quietly does nothing looks identical to a sweep that is not running,
599
+ # which is how the previous behaviour survived review in the first place.
600
+ print(f"[aios-api] schema sweep ({why}) {slug}: {len(skipped)} child table(s) not "
601
+ f"present in this tenant, so nothing was created for them "
602
+ f"({', '.join(sorted(skipped))}) β€” they are spawned by an automation that "
603
+ f"needs them, never by this sweep")
604
  # ⭐ THE RETRACTION (D's `retract_foreign_presets`, D-152), AFTER the children loop.
605
  # β›” THE SWEEP ABOVE MAKES COLUMNS **ARRIVE** AND CANNOT MAKE STALE ONES **LEAVE**, and
606
  # T07's `done-when` asserts both ("no `ut_tt_*` grid carries an Instagram column"). On a