feat(lsl): introduce 0.9.3.11 parity inventory and 0.9.3.12 YEngine profiler foundation (#183)
CI complete/success on PR head d4ed770a. Initial functional scope includes source parity inventory, .NET math conformance, inworld smoke and read-only profiling snapshot. Does not claim full LSL parity, live operator acceptance or stable publication; experience/pathfinding deferred.
This commit is contained in:
1 parent
523ab83833
commit
f478d8c1a6
8 files changed
+466
No files matched your search
@@ -82,6 +82,22 @@ jobs:
|
||||
run: |
|
||||
python3 tools/ci/verify_experiences_nexbus_enabled.py
|
||||
|
||||
- name: OGL LSL 0.9.3.11 contract inventory and regression
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p /tmp/ogl-lsl-parity
|
||||
python3 tools/lsl/lsl_matrix.py --verify --output /tmp/ogl-lsl-parity/lsl-matrix.json
|
||||
python3 -m unittest discover -s tools/ci -p 'test_lsl_matrix.py' -v
|
||||
|
||||
- name: Upload LSL contract inventory
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ogl-lsl-09311-contract-matrix
|
||||
path: /tmp/ogl-lsl-parity/lsl-matrix.json
|
||||
if-no-files-found: ignore
|
||||
retention-days: 30
|
||||
|
||||
- name: Verify OSSL policy coverage
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_ossl_policy.py
|
||||
@@ -423,6 +439,10 @@ jobs:
|
||||
shell: bash
|
||||
run: dotnet build --configuration Release OpenSim.sln
|
||||
|
||||
- name: Runtime LSL core conformance (0.9.3.11)
|
||||
shell: bash
|
||||
run: dotnet run --configuration Release --project tools/ci/LslConformanceRegression/LslConformanceRegression.csproj
|
||||
|
||||
- name: Regression-test Firestorm My Outfits system folder against real SQLite inventory
|
||||
shell: bash
|
||||
run: dotnet run --configuration Release --project tools/ci/OglOutfitInventoryRegression/OglOutfitInventoryRegression.csproj
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// OpenGenesisLINK-specific operational diagnostics (MPL-2.0).
|
||||
// Inherited YEngine files and their existing BSD notices remain unchanged.
|
||||
using System;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
/// <summary>
|
||||
/// A read-only, bounded YEngine snapshot, not a promise of equivalent SL
|
||||
/// script execution cost. No scripts, chat, permissions or code are exposed.
|
||||
/// </summary>
|
||||
public sealed class OglLslScriptProfile
|
||||
{
|
||||
public UUID ScriptItemId { get; }
|
||||
public UUID ObjectId { get; }
|
||||
public double ElapsedScriptMilliseconds { get; }
|
||||
public int EventsStarted { get; }
|
||||
public int EventSlicesResumed { get; }
|
||||
public int PendingEvents { get; }
|
||||
public bool IsRunning { get; }
|
||||
public DateTime ObservedAtUtc { get; }
|
||||
|
||||
internal OglLslScriptProfile(
|
||||
UUID scriptItemId, UUID objectId, double elapsedScriptMilliseconds,
|
||||
int eventsStarted, int eventSlicesResumed, int pendingEvents, bool isRunning)
|
||||
{
|
||||
ScriptItemId = scriptItemId;
|
||||
ObjectId = objectId;
|
||||
ElapsedScriptMilliseconds = elapsedScriptMilliseconds;
|
||||
EventsStarted = eventsStarted;
|
||||
EventSlicesResumed = eventSlicesResumed;
|
||||
PendingEvents = pendingEvents;
|
||||
IsRunning = isRunning;
|
||||
ObservedAtUtc = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class XMRInstance
|
||||
{
|
||||
/// <summary>
|
||||
/// Non-blocking snapshot of counters which YEngine already maintains.
|
||||
/// Does not change scheduling or allocation cost for normal scripts.
|
||||
/// Caller must possess server-side diagnostic authorization; this API
|
||||
/// is not automatically exposed to LSL, residents or HTTP.
|
||||
/// </summary>
|
||||
public bool TryGetOglLslScriptProfile(out OglLslScriptProfile profile)
|
||||
{
|
||||
profile = null;
|
||||
// Maintain RunOne lock order: m_RunLock before m_QueueLock.
|
||||
// Never stall the script thread for a management query.
|
||||
if (!Monitor.TryEnter(m_RunLock))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
if (m_Item is null || m_IState == XMRInstState.DISPOSED)
|
||||
return false;
|
||||
lock (m_QueueLock)
|
||||
{
|
||||
profile = new OglLslScriptProfile(
|
||||
m_ItemID, m_PartUUID, m_CPUTime, m_InstEHEvent,
|
||||
m_InstEHSlice, m_EventQueue.Count, m_Running);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(m_RunLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# OGL LSL-Parität – Arbeitsstand 0.9.3.11 / 0.9.3.12
|
||||
|
||||
**Entwicklung, noch keine Stable-Freigabe.** Diese Dateien enthalten
|
||||
neu implementierte Prüfinfrastruktur und den ersten 0.9.3.12
|
||||
Profiler-Baustein. Sie sind **kein** Nachweis vollständiger LSL-Parität.
|
||||
|
||||
## 0.9.3.11 – Core Conformance
|
||||
|
||||
- `python3 tools/lsl/lsl_matrix.py --output /tmp/lsl-matrix.json`
|
||||
erzeugt eine komplette maschinenlesbare Bestandsaufnahme aus
|
||||
`ILSL_Api`, ScriptBase-Wrapper, LSL-Implementierung,
|
||||
Konstantendeklarationen und YEngine-Event-Codes.
|
||||
- `--verify` sperrt offensichtliche fehlende Bindings;
|
||||
Python-Unittests prüfen Schema, bedeutende Funktionen,
|
||||
Konstanten und Deferred-Scope.
|
||||
- `dotnet run -c Release --project
|
||||
tools/ci/LslConformanceRegression/LslConformanceRegression.csproj`
|
||||
vergleicht zentrale API-Signaturen und prüft Math-Randfälle durch
|
||||
tatsächliche `LSL_Api`-Aufrufe.
|
||||
- `tools/lsl/inworld_core_smoke.lsl` ist eine bewusst separate,
|
||||
reproduzierbare **manuelle** LSL-Regionprobe (Chat-PASS ist
|
||||
erst nach realer Durchführung ein Live-Beleg).
|
||||
- Die generierte JSON-Matrix erscheint als GitHub-Actions-Artefakt
|
||||
`ogl-lsl-09311-contract-matrix`.
|
||||
|
||||
**WICHTIG:** `PARTIAL` bedeutet nur, dass ein Quellcodepfad
|
||||
gefunden wurde. Es heißt NICHT, dass Funktion, Forced Delay,
|
||||
Berechtigung, Regionsübergang oder Ereignisse SL-konform sind.
|
||||
`behaviour_verified/timing_verified/permission_verified` bleiben
|
||||
ohne entsprechende Laufzeitprüfungen `false`; `FULL` wird
|
||||
**niemals automatisch** aus Methodennamen abgeleitet.
|
||||
Die noch ungetesteten Funktionen bilden den verbleibenden
|
||||
Backlog, nicht eine vorgetäuschte 100-Prozent-Abdeckung.
|
||||
|
||||
## 0.9.3.12 – Advanced Conformance und Profiler
|
||||
|
||||
- Die normalen LSL-Domänen HTTP/JSON/Medien/Parcel/Inventar/
|
||||
Attachments/Animation/Economy/RemoteData werden schrittweise
|
||||
durch deterministische Tests und isolierte LSL-Regressionsregionen
|
||||
ausgebaut.
|
||||
- `XMRInstance.TryGetOglLslScriptProfile` liefert einen
|
||||
*nicht blockierenden* Snapshot bereits vorhandener YEngine-Zähler:
|
||||
Script-/Objekt-UUID, kumulierte Laufzeit in ms,
|
||||
begonnene Events, fortgesetzte Event-Slices,
|
||||
Event-Warteschlange, Running-State, Beobachtungszeitpunkt.
|
||||
Falls `m_RunLock` belegt ist, liefert die API `false`,
|
||||
statt den Script-Thread zu blockieren.
|
||||
- Es gibt **noch keinen externen HTTP-Endpunkt und keine
|
||||
Bewohner-/Script-Freigabe** dieser Betriebsdaten.
|
||||
Berechtigungsschutz, Export/Retention und Lastprofilierung
|
||||
sind vor einer produktiven Admin-Oberfläche erforderlich.
|
||||
- API-Methoden oder vorhandene Skript-Profiling-Stubs
|
||||
gelten nicht allein dadurch als fertig, dass ein Snapshot existiert.
|
||||
|
||||
## Ausgenommene spätere Viewer-Features
|
||||
|
||||
**OGL Experiences 2.0** und **OGL Pathfinding 2.0**
|
||||
(einschließlich spezifischer neuer LSL-Funktionen und Live-Abnahme)
|
||||
werden **erst nach 0.9.4.0 Generation 1** entwickelt.
|
||||
Vorhandene experimentelle Experience-Funktionen behalten
|
||||
CI-/Sicherheitsregressionen, gelten aber nicht als freigegebene
|
||||
Viewerintegration. My Outfits 2.0 bleibt ebenfalls vertagt.
|
||||
|
||||
## Freigaberegel 0.9.3.12 Stable
|
||||
|
||||
1. Beide Meilensteine mit klar begrenztem, dokumentiertem
|
||||
Funktionsumfang und echten Verifikationsnachweisen abschließen.
|
||||
2. Keine ungeprüfte Funktion als `FULL` deklarieren.
|
||||
3. Green CI auf exakt dem Release-Commit inklusive Runtime-
|
||||
und Datenbanktests.
|
||||
4. Inworld-Fälle mit realen Sim-/Avatar-Logs und
|
||||
negativen Rechten-/Timing-Fällen durchführen.
|
||||
5. Langzeittest, Backup/Restore sowie explizite Betreiberfreigabe
|
||||
dokumentieren, statt einen Stable-Tag aus einem Build abzuleiten.
|
||||
|
||||
Die bisherige `v0.9.3.10` Stable bleibt während der Entwicklung
|
||||
unverändert. `0.9.3.11` ist eine Entwicklungsstufe;
|
||||
das finale Ziel ist erst nach vollständig erbrachten
|
||||
Nachweisen `0.9.3.12 Stable`.
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../../OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OpenSim.Region.ScriptEngine.Shared.Api.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static void Check(bool condition, string message)
|
||||
{
|
||||
if (!condition)
|
||||
throw new InvalidOperationException("LSL conformance: " + message);
|
||||
}
|
||||
|
||||
private static void CheckBinding(string name)
|
||||
{
|
||||
MethodInfo[] contract = typeof(ILSL_Api).GetMethods().Where(m => m.Name == name).ToArray();
|
||||
Check(contract.Length > 0, "No API declaration for " + name);
|
||||
foreach (MethodInfo method in contract)
|
||||
{
|
||||
Type[] parameters = method.GetParameters().Select(p => p.ParameterType).ToArray();
|
||||
MethodInfo implementation = typeof(LSL_Api).GetMethod(name, parameters);
|
||||
MethodInfo wrapper = typeof(ScriptBaseClass).GetMethod(name, parameters);
|
||||
Check(implementation != null, "Missing implementation signature " + name);
|
||||
Check(wrapper != null, "Missing script wrapper signature " + name);
|
||||
Check(implementation.ReturnType == method.ReturnType, "Implementation return type changed " + name);
|
||||
Check(wrapper.ReturnType == method.ReturnType, "Script wrapper return type changed " + name);
|
||||
}
|
||||
}
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
foreach (string name in new[]
|
||||
{
|
||||
"llAbs", "llCeil", "llFloor", "llRound", "llFabs",
|
||||
"llSay", "llRegionSay", "llEstateSay", "llGetTime",
|
||||
"llRequestPermissions", "llOwnerSay", "llGetFreeMemory",
|
||||
})
|
||||
{
|
||||
CheckBinding(name);
|
||||
}
|
||||
|
||||
// Stateless LSL_Api math is executed, not merely source-inspected.
|
||||
LSL_Api api = new LSL_Api();
|
||||
Check(api.llAbs(new LSLInteger(-7)).value == 7, "llAbs(-7) must be 7");
|
||||
Check(api.llAbs(new LSLInteger(int.MinValue)).value == int.MinValue,
|
||||
"llAbs(INT_MIN) must use LSL wrapping semantics");
|
||||
Check(api.llCeil(-1.2).value == -1, "llCeil(-1.2)");
|
||||
Check(api.llFloor(-1.2).value == -2, "llFloor(-1.2)");
|
||||
Check(api.llRound(2.5).value == 3, "llRound(2.5) must round away from zero");
|
||||
Check(api.llRound(-2.5).value == -3, "llRound(-2.5) must round away from zero");
|
||||
Check(Math.Abs(api.llFabs(-2.5).value - 2.5) < 0.000001, "llFabs(-2.5)");
|
||||
Console.WriteLine("OGL LSL: 12 source signatures + 7 actual math semantics: PASS");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Sanity checks for the machine-readable LSL compatibility inventory."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
SRC = Path(__file__).resolve().parents[1] / "lsl/lsl_matrix.py"
|
||||
SPEC = importlib.util.spec_from_file_location("ogl_lsl_matrix", SRC)
|
||||
module = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(module)
|
||||
|
||||
|
||||
class MatrixTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.report = module.build()
|
||||
cls.functions = {f["name"]: f for f in cls.report["functions"]}
|
||||
|
||||
def test_complete_schema_and_source_inventory(self):
|
||||
self.assertEqual(self.report["format"], "ogl-lsl-conformance-matrix-v1")
|
||||
self.assertGreaterEqual(self.report["summary"]["functions"], 250)
|
||||
self.assertGreaterEqual(self.report["summary"]["constants"], 100)
|
||||
self.assertGreaterEqual(self.report["summary"]["events"], 25)
|
||||
self.assertEqual(len(self.functions), self.report["summary"]["functions"])
|
||||
|
||||
def test_cannot_claim_full_from_signature_presence(self):
|
||||
for item in self.report["functions"]:
|
||||
self.assertIn(item["support_level"], module.CATEGORIES)
|
||||
self.assertNotEqual(item["support_level"], "FULL")
|
||||
self.assertFalse(item["behaviour_verified"])
|
||||
self.assertFalse(item["timing_verified"])
|
||||
self.assertFalse(item["permission_verified"])
|
||||
|
||||
def test_deferred_experience_and_pathfinding(self):
|
||||
for name in ("llRequestExperiencePermissions", "llGetExperienceDetails",
|
||||
"llCreateKeyValue", "llReadKeyValue"):
|
||||
self.assertEqual(self.functions[name]["scope"], "POST_0_9_4_0")
|
||||
self.assertEqual(self.functions["llSay"]["scope"], "CORE")
|
||||
events = {e["name"]: e for e in self.report["events"]}
|
||||
self.assertEqual(events["experience_permissions"]["scope"], "POST_0_9_4_0")
|
||||
self.assertEqual(events["path_update"]["scope"], "POST_0_9_4_0")
|
||||
self.assertEqual(events["timer"]["scope"], "CORE")
|
||||
|
||||
def test_key_structural_methods(self):
|
||||
for name in ("llAbs", "llRound", "llFloor", "llCeil", "llFabs", "llSay",
|
||||
"llRegionSay", "llEstateSay"):
|
||||
item = self.functions[name]
|
||||
self.assertTrue(item["api_wrapper_present"], name)
|
||||
self.assertTrue(item["implementation_present"], name)
|
||||
|
||||
def test_real_event_and_constant_metadata(self):
|
||||
events = {x["name"]: x for x in self.report["events"]}
|
||||
self.assertEqual(events["state_entry"]["id"], 30)
|
||||
self.assertEqual(events["timer"]["id"], 2)
|
||||
consts = {x["name"]: x for x in self.report["constants"]}
|
||||
self.assertIn("PERMISSION_DEBIT", consts)
|
||||
self.assertIn("TRUE", consts)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,42 @@
|
||||
// OGL LSL 0.9.3.11 smoke: drop in a prim in an isolated test region.
|
||||
// Output is deliberately deterministic. No money, external HTTP or permissions.
|
||||
integer failures = 0;
|
||||
integer timerSeen = FALSE;
|
||||
|
||||
assertEqual(integer actual, integer expected, string test)
|
||||
{
|
||||
if (actual != expected)
|
||||
{
|
||||
++failures;
|
||||
llOwnerSay("FAIL " + test + " actual=" + (string)actual + " expected=" + (string)expected);
|
||||
}
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
failures = 0;
|
||||
timerSeen = FALSE;
|
||||
assertEqual(llAbs(-7), 7, "llAbs");
|
||||
assertEqual(llFloor(-1.2), -2, "llFloor negative");
|
||||
assertEqual(llCeil(-1.2), -1, "llCeil negative");
|
||||
assertEqual(llRound(2.5), 3, "llRound positive halfway");
|
||||
assertEqual(llRound(-2.5), -3, "llRound negative halfway");
|
||||
assertEqual(llStringLength("abc"), 3, "llStringLength");
|
||||
assertEqual(llGetListLength([1, 2, 3]), 3, "llGetListLength");
|
||||
llSetTimerEvent(0.25);
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
if (timerSeen)
|
||||
return;
|
||||
timerSeen = TRUE;
|
||||
llSetTimerEvent(0.0);
|
||||
if (failures == 0)
|
||||
llOwnerSay("OGL LSL 0.9.3.11 smoke PASS (7 assertions + timer event)");
|
||||
else
|
||||
llOwnerSay("OGL LSL 0.9.3.11 smoke FAIL: " + (string)failures);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Machine-readable, fail-closed *source* inventory of OGL LSL contracts.
|
||||
|
||||
This is not an automated claim of Second Life behavioural compatibility.
|
||||
Source presence and runtime conformance are separate evidence dimensions.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
BASE = Path("OpenSim/Region/ScriptEngine/Shared/Api")
|
||||
IFACE = BASE / "Interface/ILSL_Api.cs"
|
||||
STUB = BASE / "Runtime/LSL_Stub.cs"
|
||||
IMPL = BASE / "Implementation/LSL_Api.cs"
|
||||
CONSTS = BASE / "Runtime/LSL_Constants.cs"
|
||||
EVENTS = Path("OpenSim/Region/ScriptEngine/YEngine/MMRScriptEventCode.cs")
|
||||
CATEGORIES = ("FULL", "PARTIAL", "STUB", "MISSING", "INTENTIONALLY_UNSUPPORTED")
|
||||
DEFERRED = re.compile(r"(Experience|KeyValue|Pathfind|Character)", re.IGNORECASE)
|
||||
DECL = re.compile(r"^\s*([A-Za-z_][\w.<>]*)\s+(ll[A-Za-z0-9_]+)\s*\(([^)]*)\)\s*;", re.M)
|
||||
METHOD = re.compile(r"^\s*public\s+(?:(?:virtual|static|override|new|unsafe)\s+)*([A-Za-z_][\w.<>]*)\s+(ll[A-Za-z0-9_]+)\s*\(([^)]*)\)", re.M)
|
||||
CONST = re.compile(r"^\s*public\s+(?:(?:static\s+readonly|const)\s+)([\w.<>]+)\s+(\w+)\s*=\s*([^;]+);", re.M)
|
||||
EVT = re.compile(r"^\s*([a-z][\w]*)\s*=\s*(\d+),", re.M)
|
||||
|
||||
|
||||
def signature(result_type, args):
|
||||
# Strip parameter *names* to compare API type contracts across
|
||||
# ILSL_Api / ScriptBaseClass / LSL_Api without changing aliases.
|
||||
params = []
|
||||
for raw in args.split(","):
|
||||
raw = raw.strip()
|
||||
if not raw:
|
||||
continue
|
||||
fields = raw.split()
|
||||
if len(fields) < 2:
|
||||
raise ValueError("Ambiguous LSL parameter: " + raw)
|
||||
params.append(" ".join(fields[:-1]))
|
||||
return {"return_type": result_type, "parameter_types": params}
|
||||
|
||||
|
||||
def methods(path, pattern):
|
||||
source = (ROOT / path).read_text(encoding="utf-8-sig")
|
||||
items = {}
|
||||
for match in pattern.finditer(source):
|
||||
result_type, name, args = match.groups()
|
||||
if name in items:
|
||||
# Overloads may exist: source parity requires a separate
|
||||
# signature for each overload, never silently overwrite one.
|
||||
items[name].append(signature(result_type, args))
|
||||
else:
|
||||
items[name] = [signature(result_type, args)]
|
||||
return items
|
||||
|
||||
|
||||
def build():
|
||||
interface = methods(IFACE, DECL)
|
||||
wrappers = methods(STUB, METHOD)
|
||||
implementations = methods(IMPL, METHOD)
|
||||
if len(interface) < 200:
|
||||
raise RuntimeError("Insufficient interface declarations; LSL parser likely broken")
|
||||
functions = []
|
||||
for name, signatures in sorted(interface.items()):
|
||||
wrapper = wrappers.get(name, [])
|
||||
implementation = implementations.get(name, [])
|
||||
available = bool(wrapper and implementation)
|
||||
scope = "POST_0_9_4_0" if DEFERRED.search(name) else "CORE"
|
||||
# PARTIAL merely means that code is present, NOT that behaviour
|
||||
# or timings are verified. Defer XP even if old methods exist.
|
||||
level = "PARTIAL" if available else "MISSING"
|
||||
mismatches = {
|
||||
"interface_vs_wrapper": [s for s in signatures if s not in wrapper],
|
||||
"interface_vs_implementation": [s for s in signatures if s not in implementation],
|
||||
}
|
||||
functions.append({
|
||||
"name": name, "signatures": signatures,
|
||||
"support_level": level, "scope": scope,
|
||||
"api_wrapper_present": bool(wrapper),
|
||||
"implementation_present": bool(implementation),
|
||||
"signature_differences": mismatches,
|
||||
"behaviour_verified": False, "timing_verified": False,
|
||||
"permission_verified": False, "live_evidence": None,
|
||||
})
|
||||
constants = []
|
||||
for type_name, name, value in CONST.findall((ROOT / CONSTS).read_text(encoding="utf-8-sig")):
|
||||
constants.append({"name": name, "type": type_name, "expression": value.strip(), "runtime_verified": False})
|
||||
events = [{"name": name, "id": int(num), "live_verified": False, "scope": "POST_0_9_4_0" if DEFERRED.search(name) or name == "path_update" else "CORE"}
|
||||
for name, num in EVT.findall((ROOT / EVENTS).read_text(encoding="utf-8-sig"))]
|
||||
if len(constants) < 100 or len(events) < 25:
|
||||
raise RuntimeError("Insufficient constants/events: parser or source drift")
|
||||
counts = Counter(f["support_level"] for f in functions)
|
||||
return {
|
||||
"format": "ogl-lsl-conformance-matrix-v1",
|
||||
"source_of_truth": {"interface": str(IFACE), "wrapper": str(STUB), "implementation": str(IMPL), "constants": str(CONSTS), "events": str(EVENTS)},
|
||||
"policy": "PARTIAL means source present; no FULL without live/semantic evidence. Deferred functions are not 0.9.3.11/12 release gates.",
|
||||
"summary": {"functions": len(functions), "constants": len(constants), "events": len(events),
|
||||
"support": {status: counts[status] for status in CATEGORIES},
|
||||
"deferred_functions": sum(f["scope"] != "CORE" for f in functions)},
|
||||
"functions": functions, "constants": sorted(constants, key=lambda x: x["name"]), "events": sorted(events, key=lambda x: x["id"]),
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--output", default="-", help="JSON destination, default stdout")
|
||||
parser.add_argument("--verify", action="store_true", help="Reject missing API/wrapper and suspicious signature drift")
|
||||
args = parser.parse_args()
|
||||
matrix = build()
|
||||
missing = [f["name"] for f in matrix["functions"] if f["support_level"] == "MISSING"]
|
||||
if args.verify and missing:
|
||||
raise SystemExit("Missing LSL bindings: " + ", ".join(missing))
|
||||
payload = json.dumps(matrix, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
||||
if args.output == "-":
|
||||
print(payload, end="")
|
||||
else:
|
||||
Path(args.output).write_text(payload, encoding="utf-8")
|
||||
print(f"LSL interface inventory: {matrix['summary']}", file=__import__("sys").stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user