feat(backend): heartbeat v2 sends the module catalogue; license e2e on v2

Platform v2 step 1.7, site side (APPS_PLATFORM D-20, D-21; contract C-1 v2).
- cloud_sync heartbeat body is {version, local_ip, module_catalog}; the
  catalogue (key, kind, name, depends, limits) comes from the manifests and
  drives the sysadmin module editor
- license_e2e.py runs against the v2 cloud: free-tier checks use an ordering
  endpoint (the catalogue stays available), new section 8 edits the site's
  modules in the cloud and checks kds becomes module.not_licensed and
  reports.history_days = 30 after the next heartbeat (25/25 pass)
- e2e seed templates made by v1 code (no alembic_version) are detected and
  reseeded automatically (license_e2e.py and lib/proc.mjs)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 19:28:20 +02:00
co-authored by Claude Opus 5.5
parent 9f1e12156e
commit e128cc37ec
3 changed files with 53 additions and 5 deletions
+11 -1
View File
@@ -147,6 +147,16 @@ def _get_local_ip() -> str | None:
db.close()
def module_catalog() -> list[dict]:
"""What this site's code can run (heartbeat C-1, D-20): the cloud's module editor is
built from it, so the sysadmin can only license modules the site knows."""
from core.modules.registry import registry
return [{"key": m.key, "kind": m.kind, "name": m.name, "depends": list(m.depends),
"limits": [{"key": lim.key, "description": lim.description, "free": lim.free,
"licensed_default": lim.licensed_default} for lim in m.limits]}
for m in registry().values()]
async def _sync_once():
if not settings.SITE_ID or not settings.CLOUD_URL:
logger.debug("No SITE_ID/CLOUD_URL configured — skipping cloud sync")
@@ -161,7 +171,7 @@ async def _sync_once():
"X-Site-ID": settings.SITE_ID,
"X-Site-Key": settings.SITE_KEY,
},
json={"version": settings.VERSION, "uptime_seconds": 0, "local_ip": local_ip},
json={"version": settings.VERSION, "local_ip": local_ip, "module_catalog": module_catalog()},
)
resp.raise_for_status()
data = resp.json()