Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/connectors_meta.py +1 -1
- api/routes_connectors.py +8 -0
- platform/core/keychain.py +1 -1
- platform/harness/meta_store.py +28 -63
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "b4cbcd3c8f9f",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
b4cbcd3c8f9f
|
api/connectors_meta.py
CHANGED
|
@@ -19,7 +19,7 @@ the question as well as the answer.
|
|
| 19 |
β SECRETS. `META_ADS_ACCESS_TOKEN` lives in gitignored `platform/.env`. It is read here, sent as a
|
| 20 |
POST-shaped query parameter to Graph over TLS, and **never printed, never logged, never written to
|
| 21 |
the asset** β the asset records the URL PATH and the field names, not the query string. Every call
|
| 22 |
-
is a read-only GET.
|
| 23 |
|
| 24 |
python aios-web/api/connectors_meta.py --probe # writes the wave asset
|
| 25 |
python aios-web/api/connectors_meta.py --check # credentials only, no schema walk
|
|
|
|
| 19 |
β SECRETS. `META_ADS_ACCESS_TOKEN` lives in gitignored `platform/.env`. It is read here, sent as a
|
| 20 |
POST-shaped query parameter to Graph over TLS, and **never printed, never logged, never written to
|
| 21 |
the asset** β the asset records the URL PATH and the field names, not the query string. Every call
|
| 22 |
+
is a read-only GET. The env token serves this CLI only: no tenant card or sync reads it.
|
| 23 |
|
| 24 |
python aios-web/api/connectors_meta.py --probe # writes the wave asset
|
| 25 |
python aios-web/api/connectors_meta.py --check # credentials only, no schema walk
|
api/routes_connectors.py
CHANGED
|
@@ -3463,6 +3463,14 @@ def connector_sync_status(connector_key: str, connection_id: str = None,
|
|
| 3463 |
if connector_key not in registered:
|
| 3464 |
raise err(404, "sync_provider_unknown",
|
| 3465 |
f"{connector_key} is not registered for connector sync")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3466 |
from core import keychain
|
| 3467 |
import odoo_relational as rel
|
| 3468 |
rt = (_odoo_status_reads(session.runtime) if connector_key == "odoo"
|
|
|
|
| 3463 |
if connector_key not in registered:
|
| 3464 |
raise err(404, "sync_provider_unknown",
|
| 3465 |
f"{connector_key} is not registered for connector sync")
|
| 3466 |
+
from harness import meta_store
|
| 3467 |
+
if connector_key == "meta_ads" and not meta_store.has_credential(session.runtime):
|
| 3468 |
+
# A stored pass from before the tenant had a credential is not this tenant's failure.
|
| 3469 |
+
unconnected = _sync_payload(connector_key, connection_id, None)
|
| 3470 |
+
unconnected.update(detail="This tenant has no stored Meta Ads credential. Connect Meta Ads before syncing.",
|
| 3471 |
+
lastCompletedAt=None, lastSyncAt=None, lastCompletedKnown=True,
|
| 3472 |
+
canSync=bool(session.admin), schedule="daily", **_daily_sync_staleness(None))
|
| 3473 |
+
return _safe_connector_status(connector_key, unconnected)
|
| 3474 |
from core import keychain
|
| 3475 |
import odoo_relational as rel
|
| 3476 |
rt = (_odoo_status_reads(session.runtime) if connector_key == "odoo"
|
platform/core/keychain.py
CHANGED
|
@@ -567,7 +567,7 @@ def meta_creds(rt, connection_id=None):
|
|
| 567 |
`harness/meta_store.py::token` read `META_ADS_ACCESS_TOKEN` unconditionally, so this resolver
|
| 568 |
existed, was correct, and was reached by nothing: a tenant's stored Meta credential was
|
| 569 |
accepted, previewed and testable while every sync ran on the deployment's own token. The
|
| 570 |
-
loader now asks here
|
| 571 |
Deleting this function because "nothing calls it" would have been the wrong repair.
|
| 572 |
|
| 573 |
β IT IS DELIBERATELY THE SAME SHAPE AS `odoo_creds` AND SHARES ITS IMPLEMENTATION, because
|
|
|
|
| 567 |
`harness/meta_store.py::token` read `META_ADS_ACCESS_TOKEN` unconditionally, so this resolver
|
| 568 |
existed, was correct, and was reached by nothing: a tenant's stored Meta credential was
|
| 569 |
accepted, previewed and testable while every sync ran on the deployment's own token. The
|
| 570 |
+
loader now asks here, and no tenant falls back to the environment.
|
| 571 |
Deleting this function because "nothing calls it" would have been the wrong repair.
|
| 572 |
|
| 573 |
β IT IS DELIBERATELY THE SAME SHAPE AS `odoo_creds` AND SHARES ITS IMPLEMENTATION, because
|
platform/harness/meta_store.py
CHANGED
|
@@ -199,71 +199,37 @@ class MetaError(RuntimeError):
|
|
| 199 |
_META_TOKEN_FIELDS = ("access_token", "token", "api_key")
|
| 200 |
|
| 201 |
|
| 202 |
-
def _env_token():
|
| 203 |
-
"""The Meta token from the process environment or the gitignored `platform/.env`; "" when
|
| 204 |
-
absent. This is the DEPLOYMENT's token, which is why it is only ever a fallback."""
|
| 205 |
-
tok = os.environ.get("META_ADS_ACCESS_TOKEN") or ""
|
| 206 |
-
if tok:
|
| 207 |
-
return tok.strip()
|
| 208 |
-
env = _HERE.parent / ".env"
|
| 209 |
-
if env.exists():
|
| 210 |
-
for line in env.read_text(encoding="utf-8", errors="replace").splitlines():
|
| 211 |
-
if line.strip().startswith("META_ADS_ACCESS_TOKEN"):
|
| 212 |
-
_, _, v = line.partition("=")
|
| 213 |
-
return v.strip().strip('"').strip("'")
|
| 214 |
-
return ""
|
| 215 |
-
|
| 216 |
-
|
| 217 |
def token(rt=None, *, tenant_key=None, connection_id=None):
|
| 218 |
-
"""The tenant's stored Meta credential
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
credential on the keychain was synced with the OWNER's measurement token instead β the stored
|
| 223 |
-
key was accepted, previewed, testable, and never used by the loader it was stored for. A gate
|
| 224 |
-
that merely proves `keychain.meta_creds` is CALLED cannot see that; the assertion has to drive
|
| 225 |
-
both sources at once and name which one won.
|
| 226 |
-
|
| 227 |
-
With no runtime, only an explicitly supplied `royal-imports` tenant key authorizes the
|
| 228 |
-
standalone tenant #0 fallback. Missing or unresolved non-Royal tenants get "". When both a
|
| 229 |
-
runtime and requested tenant key are supplied, they must agree before any credential is read.
|
| 230 |
-
Named connections never fall back to the deployment token.
|
| 231 |
-
|
| 232 |
-
β THE FIELD NAME IS RESOLVED, NOT ASSUMED. A Meta credential is conventionally stored under
|
| 233 |
-
`access_token`, but `token` and `api_key` are both accepted by the connector that stores it,
|
| 234 |
-
so an entry using either is honoured here. An entry of the right TYPE carrying none of the
|
| 235 |
-
three yields no stored token; only Royal may then use the deployment token. `sync` reports a
|
| 236 |
-
missing credential without disclosing any field.
|
| 237 |
-
|
| 238 |
-
β NO CREDENTIAL IS PRINTED, LOGGED OR RAISED FROM HERE. The return value is the only place
|
| 239 |
-
the secret exists, and every failure path returns "" rather than echoing what it read.
|
| 240 |
"""
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
pass
|
| 258 |
-
royal = runtime_key == "royal-imports" if rt is not None else requested == "royal-imports"
|
| 259 |
-
if royal and connection_id is None:
|
| 260 |
-
try:
|
| 261 |
-
return _env_token()
|
| 262 |
-
except Exception: # noqa: BLE001
|
| 263 |
-
pass
|
| 264 |
return ""
|
| 265 |
|
| 266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
def _transport_problem(reason):
|
| 268 |
"""Name transport failures without disclosing request URLs or credential-bearing exception text."""
|
| 269 |
text = str(reason).lower()
|
|
@@ -563,9 +529,8 @@ def sync(tenant_key="royal-imports", tok=None, log=print, insights=True, insight
|
|
| 563 |
exactly as `odoo_relational.refresh` is.
|
| 564 |
"""
|
| 565 |
# β W49-T13 / D-202 β THE TENANT IS PASSED, which is what makes "the tenant's stored
|
| 566 |
-
# credential first" true of this loader rather than of a helper nobody calls with one.
|
| 567 |
-
#
|
| 568 |
-
# Royal caller may use the deployment token; an unresolved non-Royal tenant fails closed.
|
| 569 |
rt = _runtime_for(tenant_key)
|
| 570 |
# β THE WINDOW IS A PARAMETER, NOT AN ENVIRONMENT READ AT CALL TIME β and the difference cost a
|
| 571 |
# live deploy. `INSIGHTS_DAYS` binds at IMPORT (module scope), so `main._pull_meta`'s
|
|
|
|
| 199 |
_META_TOKEN_FIELDS = ("access_token", "token", "api_key")
|
| 200 |
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
def token(rt=None, *, tenant_key=None, connection_id=None):
|
| 203 |
+
"""The tenant's own stored Meta credential, or "" when its keychain holds none.
|
| 204 |
+
|
| 205 |
+
β No tenant reads the deployment's `META_ADS_ACCESS_TOKEN`, Royal Imports included. No
|
| 206 |
+
credential is printed, logged or raised from here: every failure path returns "".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
"""
|
| 208 |
+
if rt is None:
|
| 209 |
+
return ""
|
| 210 |
+
try:
|
| 211 |
+
runtime_key = str(getattr(rt, "key", "") or "").strip().lower()
|
| 212 |
+
if tenant_key is not None and runtime_key != str(tenant_key).strip().lower():
|
| 213 |
+
return ""
|
| 214 |
+
import core.keychain as _keychain
|
| 215 |
+
fields = (_keychain.meta_creds(rt) if connection_id is None else
|
| 216 |
+
_keychain.meta_creds(rt, connection_id=connection_id)) or {}
|
| 217 |
+
for name in _META_TOKEN_FIELDS:
|
| 218 |
+
stored = str(fields.get(name) or "").strip()
|
| 219 |
+
if stored:
|
| 220 |
+
return stored
|
| 221 |
+
except Exception: # noqa: BLE001
|
| 222 |
+
# The exception may quote a credential field; it must never leave this resolver.
|
| 223 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
return ""
|
| 225 |
|
| 226 |
|
| 227 |
+
def has_credential(rt):
|
| 228 |
+
"""True when the tenant's keychain holds a Meta Ads entry; the gate for showing a stored pass."""
|
| 229 |
+
from core import keychain
|
| 230 |
+
return bool(keychain.list_entries(rt, "meta_ads"))
|
| 231 |
+
|
| 232 |
+
|
| 233 |
def _transport_problem(reason):
|
| 234 |
"""Name transport failures without disclosing request URLs or credential-bearing exception text."""
|
| 235 |
text = str(reason).lower()
|
|
|
|
| 529 |
exactly as `odoo_relational.refresh` is.
|
| 530 |
"""
|
| 531 |
# β W49-T13 / D-202 β THE TENANT IS PASSED, which is what makes "the tenant's stored
|
| 532 |
+
# credential first" true of this loader rather than of a helper nobody calls with one.
|
| 533 |
+
# An unresolved runtime has no keychain, so it pulls nothing.
|
|
|
|
| 534 |
rt = _runtime_for(tenant_key)
|
| 535 |
# β THE WINDOW IS A PARAMETER, NOT AN ENVIRONMENT READ AT CALL TIME β and the difference cost a
|
| 536 |
# live deploy. `INSIGHTS_DAYS` binds at IMPORT (module scope), so `main._pull_meta`'s
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
2489684f9351f94e00784ec384d8a83630ff24f0d18c3d2f83ea4254c7906309
|