Files
opengenesislinkserver/tools/ci/verify_worldapi_chatgpt_openapi.py
T
OpenGenesis (MPL 2.0) 20a7fd7655 feat(ogl): Control Center v2, 0.9.3.12 API metadata and diagnostics (#209)
* design(ogl): unmistakable new control-center chrome, live status and honest license-module state

* docs(ogl): current runtime ChatGPT instructions, version awareness and product/grid branding

* docs(ogl): current 0.9.3.12 API version history, changelog and roadmap

* fix(hg): throttle repeated unresolved recipient logs without skipping IM delivery

* ci(ogl): verify generated ChatGPT guidance uses actual server version, not stale releases

* fix(ogl): return HTTP 400 for malformed XML-RPC and clarify external input error

* docs(ogl): map JPEG2000, XML-RPC, HG IM, license and dashboard operator diagnostics

* test(ogl): guard 0.9.3.12 UI refresh, release metadata and external-message diagnostics

* ci(ogl): regression-check refreshed dashboard, metadata and HG/XMLRPC changes

* feat(ogl): add live read-only Systemdiagnose tab for API/ChatGPT/licensing and asset triage

* test(ogl): require functional live Systemdiagnose panel and endpoint probes

* fix(ogl): keep global ChatGPT instruction rules static and use stable version path

* ci(ogl): assert 0.9.3.12 as current API release rather than stale version-history position

* ci(ogl): verify OpenGenesisLINK branding in live ChatGPT downloads
2026-10-14 21:15:27 +02:00

81 lines
4.0 KiB
Python

#!/usr/bin/env python3
"""Guard that runtime ChatGPT Markdown and OpenAPI describe real API routes.
Static checks run before .NET build. The CI Robust smoke test separately
fetches the generated /api/v1/openapi.json and asserts runtime semantics.
"""
import re
from pathlib import Path
root = Path(__file__).resolve().parents[2]
api = (root / "NexVerse/Server/Api/NexExperiencesApi.cs").read_text(encoding="utf-8")
spec = (root / "NexVerse/Server/Api/NexVerseWorldApiHandlers.cs").read_text(encoding="utf-8")
md = (root / "NexVerse/Server/Api/NexChatGptInstructionDownloads.cs").read_text(encoding="utf-8")
explorer = (root / "NexVerse/Server/Api/NexApiDocsPage.cs").read_text(encoding="utf-8")
# Every explicitly registered Experience route must be in the spec; not just
# the old generic management CRUD endpoints.
actual = set(re.findall(r'if\s*\(path\s*==\s*"(/api/v1/experiences/[^"]+)"\)', api))
actual.update(("/api/v1/experiences", "/api/v1/experiences/{experienceId}"))
specified = set(re.findall(r'\["(/api/v1/experiences[^"]*)"\]\s*=\s*', spec))
assert actual <= specified, "Experience paths absent from OpenAPI: " + str(sorted(actual - specified))
for path in (
"/api/v1/experiences/script/info",
"/api/v1/experiences/script/search",
"/api/v1/experiences/script/resolve",
"/api/v1/experiences/script/details",
"/api/v1/experiences/script/permission",
"/api/v1/experiences/script/location",
"/api/v1/experiences/script/kv",
"/api/v1/experiences/viewer/permissions",
"/api/v1/experiences/viewer/group",
"/api/v1/experiences/viewer/manage",
"/api/v1/experiences/viewer/script-binding",
):
assert path in specified, path
# Ensure typed JSON contracts have schema definitions, not a fall-through
# Chapter11ObjectResponse which prevents API agents from building correct bodies.
contracts = {
"ExperienceDetailsResponse", "ExperienceSearchResponse",
"ExperienceApiRecord", "ExperienceProfileUpdateRequest",
"ExperiencePublicRecord", "ExperiencePublicSearchResponse",
"ExperiencePublicInfoResponse", "ExperienceScriptResolveResponse",
"ExperienceScriptPermissionResponse", "ExperienceScriptLocationResponse",
"ExperienceKvRequest", "ExperienceKvResponse",
"ExperienceViewerListsResponse", "ExperienceViewerDecisionRequest",
"ExperienceViewerDecisionResponse", "ExperienceViewerPermissionReadResponse",
"ExperienceViewerGroupResponse",
"ExperienceViewerAcquireRequest",
"ExperienceViewerProfileRequest",
"ExperienceViewerManageResponse",
"ExperienceViewerScriptBindingRequest",
"ExperienceViewerScriptBindingResponse",
}
for name in contracts:
assert f'["{name}"] = new' in spec, "Missing OpenAPI schema: " + name
assert name in spec, "Unreferenced schema: " + name
for marker in ("SimulatorBridgeOperations(", "apiKeyAuth",
'operation["x-nexverse-audience"] = new[] { "service" }',
"experiences:viewer:permissions", "AddOperationParameters(paths",
"max. 4000 Zeichen", "ExperienceKvRequest",
"ExperienceViewerPermissionReadResponse",
"ExperienceViewerManageResponse", "experiences:viewer:manage"):
assert marker in spec, "Missing API machine contract/security: " + marker
for marker in ("/script/info", "/script/search", "/script/kv",
"/experiences/viewer/permissions", "experiences:script",
"experiences:viewer:permissions", "Viewer-CAPS",
"OpenAPI", "OpenSim.VersionInfo.Version.Trim()", "OpenGenesisLINK World API",
"AppendCitizenSection", "AppendAdminSection"):
assert marker in md, "ChatGPT Markdown generator missing: " + marker
for marker in ("/api/v1/chatgpt-instructions.md",
"/api/v1/chatgpt-buergerportal.md",
"/api/v1/chatgpt-admin.md",
"/api/v1/openapi.json"):
assert marker in explorer, "Explorer link missing: " + marker
print(f"OpenAPI / ChatGPT docs consistency: {len(actual)} explicit Experience paths covered")