fsanyoto commited on
Commit
cdee232
·
verified ·
1 Parent(s): 4238b9c

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
Files changed (4) hide show
  1. RELEASES.json +1 -1
  2. VERSION +1 -1
  3. api/routes_admin.py +8 -1
  4. platform/core/store_pg.py +5 -7
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "9113f9d",
3
  "releases": [
4
  {
5
  "version": "v55",
 
1
  {
2
+ "current": "2970b72",
3
  "releases": [
4
  {
5
  "version": "v55",
VERSION CHANGED
@@ -1 +1 @@
1
- 9113f9d
 
1
+ 2970b72
api/routes_admin.py CHANGED
@@ -2061,7 +2061,14 @@ def _store_binding(session):
2061
  import core.store as store # noqa: PLC0415
2062
  bound = getattr(session.runtime, "store_handle", None)
2063
  repo = getattr(bound, "repo", None) or store.REPO
2064
- return data_binding.describe(repo)
 
 
 
 
 
 
 
2065
  except Exception as e: # noqa: BLE001
2066
  return {"deployment": "unknown", "production": False, "repo": "",
2067
  "writable": False, "refusal": f"could not resolve the store binding: {e}",
 
2061
  import core.store as store # noqa: PLC0415
2062
  bound = getattr(session.runtime, "store_handle", None)
2063
  repo = getattr(bound, "repo", None) or store.REPO
2064
+ result = data_binding.describe(repo)
2065
+ if result.get("backend") == "pg":
2066
+ import core.store_pg as store_pg # noqa: PLC0415
2067
+ slug = getattr(bound, "tenant_slug", None) or session.tenant
2068
+ refusal = store_pg.write_refusal(slug)
2069
+ result.update(writable=refusal is None, refusal=refusal,
2070
+ allowlist=sorted(store_pg.sandbox_tenants()))
2071
+ return result
2072
  except Exception as e: # noqa: BLE001
2073
  return {"deployment": "unknown", "production": False, "repo": "",
2074
  "writable": False, "refusal": f"could not resolve the store binding: {e}",
platform/core/store_pg.py CHANGED
@@ -167,14 +167,12 @@ def write_refusal(tenant_slug=None):
167
  thing being classified changes, from a dataset repo to a tenant slug:
168
 
169
  1. the PRODUCTION deployment -> may write any tenant
170
- 2. any other deployment writing a PRODUCTION tenant -> REFUSED (a laptop may opt in)
171
  3. any other deployment writing a tenant it was HANDED -> allowed
172
  4. anything else -> REFUSED
173
 
174
- ⭐ RULE 2 BEATS RULE 3, deliberately, which is why the order above is the order below: an
175
- allowlist must not be able to re-open tenant #0. ⚠ And the Space/laptop asymmetry is carried
176
- over unchanged — a Space that is not production gets NO override, because that is the case the
177
- owner said "EVER" about.
178
  """
179
  slug = _effective_slug(tenant_slug)
180
  if data_binding.is_production_deployment():
@@ -189,8 +187,8 @@ def write_refusal(tenant_slug=None):
189
  if data_binding.is_space():
190
  return (f'{who} is not the production deployment, so it may not write tenant {where}, '
191
  f'which holds real customer data. Point this deployment at its own database, '
192
- f'or name the sandbox tenants it may write in {_SANDBOX_TENANTS_VAR}. There is '
193
- f'no override for a Space: a build that is not live never writes live data.')
194
  return (f'{who} may not write tenant {where}, which holds real customer data. Set '
195
  f'AIOS_TENANT to a sandbox tenant, or set '
196
  f'{data_binding._LOCAL_OPT_IN_VAR}=1 to opt in deliberately.')
 
167
  thing being classified changes, from a dataset repo to a tenant slug:
168
 
169
  1. the PRODUCTION deployment -> may write any tenant
170
+ 2. any other deployment writing a PRODUCTION tenant -> REFUSED, except exact isolated staging
171
  3. any other deployment writing a tenant it was HANDED -> allowed
172
  4. anything else -> REFUSED
173
 
174
+ Rule 2 permits one narrow exception: the exact staging Space, an explicitly handed tenant,
175
+ and a DATABASE_URL host matching the isolated host stamped by the deploy must all agree.
 
 
176
  """
177
  slug = _effective_slug(tenant_slug)
178
  if data_binding.is_production_deployment():
 
187
  if data_binding.is_space():
188
  return (f'{who} is not the production deployment, so it may not write tenant {where}, '
189
  f'which holds real customer data. Point this deployment at its own database, '
190
+ f'or bind exact isolated staging and name its writable tenants in '
191
+ f'{_SANDBOX_TENANTS_VAR}. A non-live build never writes the live database.')
192
  return (f'{who} may not write tenant {where}, which holds real customer data. Set '
193
  f'AIOS_TENANT to a sandbox tenant, or set '
194
  f'{data_binding._LOCAL_OPT_IN_VAR}=1 to opt in deliberately.')