fsanyoto commited on
Commit
0230c80
·
verified ·
1 Parent(s): 82f0f29

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "8bf90c437",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "f63109d72",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 8bf90c437
 
1
+ f63109d72
api/application_registry.py CHANGED
@@ -2016,6 +2016,7 @@ def _migrate_project_management_names(runtime):
2016
  def original(app):
2017
  return (isinstance(app, dict) and app.get("tenant") == runtime.key
2018
  and app.get("templateKind") == "amazon_profit"
 
2019
  and app.get("name") in ("Command Center", "Amazon Command Center"))
2020
 
2021
  documents = {_KEY: _clean_doc(_read_strict(runtime, _KEY)), **_record_documents(runtime)}
@@ -2058,6 +2059,10 @@ def _adopt_project_field_order(runtime):
2058
  if identity.get("flowId") != amazon_profit.VIA or "projects" not in keys:
2059
  return None
2060
  wanted = amazon_profit._project_field_order(keys)
 
 
 
 
2061
  return wanted if wanted != keys else None
2062
 
2063
  todo = [spec for spec in specs if ordered(spec, user_tables.get_definition(spec["key"], st=runtime))]
@@ -2082,6 +2087,15 @@ def _adopt_project_field_order(runtime):
2082
  return len(changed)
2083
 
2084
 
 
 
 
 
 
 
 
 
 
2085
  def ensure_command_center_application(runtime, tenant):
2086
  """Reconcile Project management defaults and seed one shared App when its table exists.
2087
 
@@ -2093,8 +2107,8 @@ def ensure_command_center_application(runtime, tenant):
2093
  from core import user_tables
2094
  from modules.amazon_profit import TABLE_KEY
2095
 
2096
- renamed = _migrate_project_management_names(runtime)
2097
- reordered = _adopt_project_field_order(runtime)
2098
  base = _clean_doc(_read_strict(runtime, _KEY))
2099
  if COMMAND_CENTER_MARKER in (base.get("migrations") or {}):
2100
  if renamed or reordered:
 
2016
  def original(app):
2017
  return (isinstance(app, dict) and app.get("tenant") == runtime.key
2018
  and app.get("templateKind") == "amazon_profit"
2019
+ and app.get("createdBy") == "loopable" and app.get("revision") == 1
2020
  and app.get("name") in ("Command Center", "Amazon Command Center"))
2021
 
2022
  documents = {_KEY: _clean_doc(_read_strict(runtime, _KEY)), **_record_documents(runtime)}
 
2059
  if identity.get("flowId") != amazon_profit.VIA or "projects" not in keys:
2060
  return None
2061
  wanted = amazon_profit._project_field_order(keys)
2062
+ defaults = [field["key"] for field in spec["fields"] if field["key"] != "projects"]
2063
+ # A saved definition with another order belongs to its author.
2064
+ if [key for key in keys if key != "projects"] != defaults:
2065
+ return None
2066
  return wanted if wanted != keys else None
2067
 
2068
  todo = [spec for spec in specs if ordered(spec, user_tables.get_definition(spec["key"], st=runtime))]
 
2087
  return len(changed)
2088
 
2089
 
2090
+ def reconcile_project_management_defaults(runtime, tenant):
2091
+ """Correct only original App names and managed field defaults, without seeding or reading rows."""
2092
+ if (getattr(runtime, "key", None) != tenant
2093
+ or getattr(getattr(runtime, "tenant", None), "key", tenant) != tenant):
2094
+ raise PermissionError("The App migration belongs to another tenant.")
2095
+ return {"renamed": _migrate_project_management_names(runtime),
2096
+ "reordered": _adopt_project_field_order(runtime)}
2097
+
2098
+
2099
  def ensure_command_center_application(runtime, tenant):
2100
  """Reconcile Project management defaults and seed one shared App when its table exists.
2101
 
 
2107
  from core import user_tables
2108
  from modules.amazon_profit import TABLE_KEY
2109
 
2110
+ corrected = reconcile_project_management_defaults(runtime, tenant)
2111
+ renamed, reordered = corrected["renamed"], corrected["reordered"]
2112
  base = _clean_doc(_read_strict(runtime, _KEY))
2113
  if COMMAND_CENTER_MARKER in (base.get("migrations") or {}):
2114
  if renamed or reordered:
api/main.py CHANGED
@@ -4129,6 +4129,27 @@ def _await_mirror_restore():
4129
  thread.start()
4130
 
4131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4132
  @app.on_event("startup")
4133
  def _start_process_role():
4134
  """Web role: tick the sync runtime, forward Sync now, install the worker's snapshots."""
 
4129
  thread.start()
4130
 
4131
 
4132
+ @app.on_event("startup")
4133
+ def _reconcile_project_management_defaults():
4134
+ """Reconcile bounded authored metadata at startup before web requests can read legacy defaults."""
4135
+ if (data_binding.gate_process() or process_role.role() not in ("web", "all")
4136
+ or os.environ.get("AIOS_BOOT_APP_MIGRATIONS") == "0"
4137
+ or not (os.environ.get("SPACE_ID") or os.environ.get("AIOS_BOOT_APP_MIGRATIONS") == "1")
4138
+ or _freeze_holds("Project management defaults")):
4139
+ return
4140
+ import application_registry
4141
+ import tenant_scan
4142
+ from harness import runtime
4143
+ # This startup barrier changes metadata only. Heavy migrations keep their worker owner.
4144
+ for slug, rt in tenant_scan.live_tenants(runtime):
4145
+ try:
4146
+ result = application_registry.reconcile_project_management_defaults(rt, slug)
4147
+ print(f"[aios-api] Project management defaults {slug}: "
4148
+ f"names={result['renamed']} fields={result['reordered']}")
4149
+ except Exception as exc:
4150
+ print(f"[aios-api] Project management defaults {slug}: {type(exc).__name__}")
4151
+
4152
+
4153
  @app.on_event("startup")
4154
  def _start_process_role():
4155
  """Web role: tick the sync runtime, forward Sync now, install the worker's snapshots."""
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 50bd73b74da5249f2f4b105f106c826b22a9dc4b5a655a372d2ef47da0975f94
 
1
+ cb2e4af998f7b8748f3aec4a18126b6ef20bfde350527b5dc025270f0ae4ae2e
web/src/sheet/templates/templatesApi.ts CHANGED
@@ -109,7 +109,7 @@ export interface PickerTemplate {
109
  // C1 App metadata stays intact while C3 tags drive the App chips.
110
  process?: string;
111
  purpose?: string;
112
- connector?: string;
113
  connectors: string[];
114
  // C2: an App row's mark key in apps/templateMarks.tsx.
115
  mark?: string;
@@ -136,7 +136,9 @@ export const pickerTemplate = (input: unknown, module: TemplateModule = "app"):
136
  (value.tags === undefined || (Array.isArray(value.tags) && value.tags.every(text))) &&
137
  Array.isArray(value.connectors) && value.connectors.every(text) &&
138
  new Set(value.connectors).size === value.connectors.length &&
139
- (value.connector === undefined || value.connectors[0] === value.connector) &&
 
 
140
  Array.isArray(value.requires) && value.requires.every((row: unknown) => object(row) &&
141
  typeof row.connector === "string" && text(row.database) && text(row.label) &&
142
  ["ready", "off", "disconnected"].includes(String(row.state))) &&
 
109
  // C1 App metadata stays intact while C3 tags drive the App chips.
110
  process?: string;
111
  purpose?: string;
112
+ connector?: string | null;
113
  connectors: string[];
114
  // C2: an App row's mark key in apps/templateMarks.tsx.
115
  mark?: string;
 
136
  (value.tags === undefined || (Array.isArray(value.tags) && value.tags.every(text))) &&
137
  Array.isArray(value.connectors) && value.connectors.every(text) &&
138
  new Set(value.connectors).size === value.connectors.length &&
139
+ (value.connector === undefined || value.connectors[0] === value.connector ||
140
+ (value.connector === null && value.connectors.length === 0 &&
141
+ Array.isArray(value.requires) && value.requires.length === 0)) &&
142
  Array.isArray(value.requires) && value.requires.every((row: unknown) => object(row) &&
143
  typeof row.connector === "string" && text(row.database) && text(row.label) &&
144
  ["ready", "off", "disconnected"].includes(String(row.state))) &&