Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- platform/core/data_binding.py +64 -1
- platform/core/store_pg.py +24 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "711bc72",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
711bc72
|
platform/core/data_binding.py
CHANGED
|
@@ -167,6 +167,69 @@ def local_override():
|
|
| 167 |
return (not is_space()) and _env(_LOCAL_OPT_IN_VAR) == '1'
|
| 168 |
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
def default_store():
|
| 171 |
"""What `OS_DATA_REPO` resolves to when it is unset.
|
| 172 |
|
|
@@ -221,7 +284,7 @@ def write_refusal(repo):
|
|
| 221 |
|
| 222 |
def check_write(repo, operation='write'):
|
| 223 |
"""Raise `StoreWriteRefused` unless this deployment may write `repo`. The one enforcement door."""
|
| 224 |
-
reason = write_refusal(repo)
|
| 225 |
if reason:
|
| 226 |
raise StoreWriteRefused(f'{operation} to {repo!r} refused: {reason}')
|
| 227 |
|
|
|
|
| 167 |
return (not is_space()) and _env(_LOCAL_OPT_IN_VAR) == '1'
|
| 168 |
|
| 169 |
|
| 170 |
+
#: W-219. Inherited by every child a gate process starts, so a subprocess a gate spawns is a gate too.
|
| 171 |
+
_GATE_PROCESS_VAR = 'AIOS_GATE_PROCESS'
|
| 172 |
+
|
| 173 |
+
#: The directories the product gate battery lives in (`aios-web/api`, `aios-web/web`, `aios-web`,
|
| 174 |
+
#: `platform`). `ops/verify_*.py` are OPERATOR tools, some of which read or probe a live store on
|
| 175 |
+
#: purpose, so they are not gates here.
|
| 176 |
+
_GATE_DIRS = frozenset({'api', 'web', 'aios-web', 'platform'})
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def _argv_gate():
|
| 180 |
+
"""The `verify_*.py` gate script this process was started as, or `''`."""
|
| 181 |
+
import sys
|
| 182 |
+
argv0 = str((getattr(sys, 'argv', None) or [''])[0] or '')
|
| 183 |
+
name = os.path.basename(argv0).lower()
|
| 184 |
+
if not (name.startswith('verify_') and name.endswith('.py')):
|
| 185 |
+
return ''
|
| 186 |
+
parent = os.path.basename(os.path.dirname(os.path.abspath(argv0))).lower()
|
| 187 |
+
return name if parent in _GATE_DIRS else ''
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
def gate_process():
|
| 191 |
+
"""The gate this process is, or `''`. W-219: a gate writes FIXTURE stores only, never a real one.
|
| 192 |
+
|
| 193 |
+
ββ WHY THIS LIVES AT THE STORE DOOR AND NOT IN EACH GATE. A lane container carries the exact
|
| 194 |
+
isolated staging posture `store_pg.write_refusal` is written to ALLOW (`STORE_BACKEND=pg`, the
|
| 195 |
+
staging `DATABASE_URL`, `AIOS_DEPLOYMENT_ID=fsanyoto/loopable`, `AIOS_SANDBOX_TENANTS=
|
| 196 |
+
royal-imports`), and `_fake_store.installed` swaps module functions a bound `PgStore` never
|
| 197 |
+
calls. So `verify_meta.py` run in SDLC 61 wrote staging's `t_royal_imports` through the real
|
| 198 |
+
app, and a pin at the top of each gate (W-219, W-240) only covers the gates somebody pinned:
|
| 199 |
+
`verify_amazon` and `verify_odoo_relational` carry none. Asking the PROCESS covers every gate,
|
| 200 |
+
including one written tomorrow.
|
| 201 |
+
|
| 202 |
+
Two ways to be one: started as `verify_*.py` from a battery directory (every battery row and
|
| 203 |
+
every lane runs `python <dir>/verify_<x>.py`), or `AIOS_GATE_PROCESS=1` inherited from one.
|
| 204 |
+
β There is no way OUT through the environment, because a lane container exports whatever it
|
| 205 |
+
was handed: the only off switch is an in-process patch of this function, which is what a gate
|
| 206 |
+
testing the PRODUCT rules does.
|
| 207 |
+
"""
|
| 208 |
+
name = _argv_gate()
|
| 209 |
+
if name:
|
| 210 |
+
return name
|
| 211 |
+
return 'a process started by a gate' if _env(_GATE_PROCESS_VAR) == '1' else ''
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
if _argv_gate():
|
| 215 |
+
os.environ[_GATE_PROCESS_VAR] = '1' # W-219: a child this gate spawns is a gate too
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def gate_write_refusal(repo):
|
| 219 |
+
"""`None` unless this is a gate process writing a PRODUCTION store, else why not. W-219.
|
| 220 |
+
|
| 221 |
+
Consulted by `check_write` BEFORE `write_refusal`, so neither `AIOS_ALLOW_PRODUCTION_DATA=1`
|
| 222 |
+
on a laptop nor a production identity opens a production store to a gate.
|
| 223 |
+
"""
|
| 224 |
+
who = gate_process()
|
| 225 |
+
rid = str(repo or '').strip()
|
| 226 |
+
if not who or rid not in PRODUCTION_STORES:
|
| 227 |
+
return None
|
| 228 |
+
return (f'this process is a verification gate ({who}), and a gate never writes {rid}, which '
|
| 229 |
+
f'holds real customer data. A gate writes fixture stores only: empty HF_TOKEN and '
|
| 230 |
+
f'point OS_DATA_REPO at a fixture store (W-219).')
|
| 231 |
+
|
| 232 |
+
|
| 233 |
def default_store():
|
| 234 |
"""What `OS_DATA_REPO` resolves to when it is unset.
|
| 235 |
|
|
|
|
| 284 |
|
| 285 |
def check_write(repo, operation='write'):
|
| 286 |
"""Raise `StoreWriteRefused` unless this deployment may write `repo`. The one enforcement door."""
|
| 287 |
+
reason = gate_write_refusal(repo) or write_refusal(repo)
|
| 288 |
if reason:
|
| 289 |
raise StoreWriteRefused(f'{operation} to {repo!r} refused: {reason}')
|
| 290 |
|
platform/core/store_pg.py
CHANGED
|
@@ -221,6 +221,29 @@ def write_refusal(tenant_slug=None):
|
|
| 221 |
f'intended.')
|
| 222 |
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
def check_write(tenant_slug=None, operation='write'):
|
| 225 |
"""Raise `StoreWriteRefused` unless this deployment may write this tenant. The pg door.
|
| 226 |
|
|
@@ -231,7 +254,7 @@ def check_write(tenant_slug=None, operation='write'):
|
|
| 231 |
a session-scoped fallback and tell the user their change was saved. A new type would have had
|
| 232 |
to re-earn both properties, and would have failed the second one silently.
|
| 233 |
"""
|
| 234 |
-
reason = write_refusal(tenant_slug)
|
| 235 |
if reason:
|
| 236 |
raise data_binding.StoreWriteRefused(
|
| 237 |
f'{operation} to tenant {_effective_slug(tenant_slug)!r} refused: {reason}')
|
|
|
|
| 221 |
f'intended.')
|
| 222 |
|
| 223 |
|
| 224 |
+
def gate_write_refusal(tenant_slug=None):
|
| 225 |
+
"""`None` unless a GATE process is writing a production tenant, else why not. W-219.
|
| 226 |
+
|
| 227 |
+
ββ CONSULTED BEFORE `write_refusal`, AND IT IS THE HALF THAT CLOSES W-219. A lane container is
|
| 228 |
+
the exact isolated staging posture `write_refusal` rule 2 ALLOWS for tenant #0, so a gate run
|
| 229 |
+
there wrote staging's `t_royal_imports` (SDLC 61: `odoo_connector_config` `syncEvery=manual`,
|
| 230 |
+
`ut_odoo_invoices` disabled, four fixture keychain credentials). A gate writes fixture tenants
|
| 231 |
+
(`qa-b`, `qa-pg`) or nothing, on every deployment, whatever the environment grants: see
|
| 232 |
+
`data_binding.gate_process` for who counts as a gate and why the environment cannot opt out.
|
| 233 |
+
`write_refusal` itself is unchanged, so the product rule stays testable on its own.
|
| 234 |
+
"""
|
| 235 |
+
who = data_binding.gate_process()
|
| 236 |
+
if not who:
|
| 237 |
+
return None
|
| 238 |
+
slug = _effective_slug(tenant_slug)
|
| 239 |
+
if slug not in PRODUCTION_TENANTS:
|
| 240 |
+
return None
|
| 241 |
+
return (f'this process is a verification gate ({who}), and a gate never writes tenant '
|
| 242 |
+
f'{slug!r} ({_schema_for(slug)}), which holds real customer data, not even on isolated '
|
| 243 |
+
f'staging. A gate writes fixture tenants only: run it with STORE_BACKEND=hf and no '
|
| 244 |
+
f'DATABASE_URL (W-219).')
|
| 245 |
+
|
| 246 |
+
|
| 247 |
def check_write(tenant_slug=None, operation='write'):
|
| 248 |
"""Raise `StoreWriteRefused` unless this deployment may write this tenant. The pg door.
|
| 249 |
|
|
|
|
| 254 |
a session-scoped fallback and tell the user their change was saved. A new type would have had
|
| 255 |
to re-earn both properties, and would have failed the second one silently.
|
| 256 |
"""
|
| 257 |
+
reason = gate_write_refusal(tenant_slug) or write_refusal(tenant_slug)
|
| 258 |
if reason:
|
| 259 |
raise data_binding.StoreWriteRefused(
|
| 260 |
f'{operation} to tenant {_effective_slug(tenant_slug)!r} refused: {reason}')
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
cf463c2ef525865ffb553cd9eb39a14245e1a9138f88cd16b47b3f6c89e472ea
|