feat(tracker): report a scene module under the engine it runs in

Binaries from a module snapshot carry host_family (from module_of); the
roadmap lists a module type's presence by that engine family.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-10-28 21:00:23 +01:00
co-authored by Claude Opus 5.5
parent 4e65268a1e
commit 7d85a69274
3 changed files with 10 additions and 6 deletions
+6 -6
View File
@@ -5,11 +5,11 @@
Per scope: methods without a registration (with the signature read from the original), Per scope: methods without a registration (with the signature read from the original),
emulator stubs, events and properties the emulator never names. Every item lists the engine emulator stubs, events and properties the emulator never names. Every item lists the engine
families whose DLLs have it - an item present in every family is core API, one present only families whose DLLs have it - an item present in every family is core API, one present only
in BlooMoo is late. With `--usage` (python -m ams.usage) every item also says how many games in BlooMoo is late; a scene module counts as the engine it runs in. With `--usage`
use it and in how many places of their scripts, gaps are ordered by that, and the report (python -m ams.usage) every item also says how many games use it and in how many places of
lists the most used gaps and what the scripts use beyond the original's known API. The report their scripts, gaps are ordered by that, and the report lists the most used gaps and what
restates the tracker's limits: registration is not correctness, and "never named" means no the scripts use beyond the original's known API. The report restates the tracker's limits:
literal was found. registration is not correctness, and "never named" means no literal was found.
""" """
from __future__ import annotations from __future__ import annotations
@@ -127,7 +127,7 @@ def used_text(use) -> str:
def render(tracker: dict, usage: dict | None = None) -> str: def render(tracker: dict, usage: dict | None = None) -> str:
family_of = {b["id"]: b.get("family") for b in tracker["binaries"]} family_of = {b["id"]: b.get("host_family") or b.get("family") for b in tracker["binaries"]} # modules: their engine
types = {t["name"]: t for t in tracker["types"]} types = {t["name"]: t for t in tracker["types"]}
used, outside, counted = usage_index(usage, types) if usage else (None, None, None) used, outside, counted = usage_index(usage, types) if usage else (None, None, None)
scopes = [scope_gaps(t, family_of, used) for t in tracker["types"] if t["name"] not in HIDDEN] scopes = [scope_gaps(t, family_of, used) for t in tracker["types"] if t["name"] not in HIDDEN]
+3
View File
@@ -417,6 +417,9 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
"engine": snap.binary.get("engine"), "identity": "binary" if sha else "snapshot_only", "engine": snap.binary.get("engine"), "identity": "binary" if sha else "snapshot_only",
"library": snap.binary.get("library", snap.binary.get("name", "?").split("__")[-1]), "library": snap.binary.get("library", snap.binary.get("name", "?").split("__")[-1]),
"family": binary_family(snap.binary), "family": binary_family(snap.binary),
# A scene module runs inside the engine it imports.
"host_family": binary_family({"library": snap.binary["module_of"]})
if snap.binary.get("module_of") else None,
"sources": snap.binary.get("sources", []), "games": snap.binary.get("games", []), "sources": snap.binary.get("sources", []), "games": snap.binary.get("games", []),
"coverage": snap.raw.get("coverage", snap.raw.get("extraction", {}).get("scope", "coverage": snap.raw.get("coverage", snap.raw.get("extraction", {}).get("scope",
snap.binary.get("extraction", {}).get("coverage"))), snap.binary.get("extraction", {}).get("coverage"))),
+1
View File
@@ -132,6 +132,7 @@ def test_scene_module_types_map_through_the_runner_their_objects_install(tmp_pat
tick = row(result, "MATRIX", "TICK")["original"][0] tick = row(result, "MATRIX", "TICK")["original"][0]
assert (tick["owner"], tick["mapping"]) == ("CMC_Matrix", "module") assert (tick["owner"], tick["mapping"]) == ("CMC_Matrix", "module")
assert typ(result, "MATRIX")["inherits"] == ["*"] assert typ(result, "MATRIX")["inherits"] == ["*"]
assert next(b for b in result["binaries"] if b["sha256"] == "b" * 64)["host_family"] == "Piklib 8"
def test_builtin_statements_are_read_from_the_parser(tmp_path): def test_builtin_statements_are_read_from_the_parser(tmp_path):