feat(pbs): add explicit guest lifecycle hooks

This commit is contained in:
2026-10-28 09:12:48 +00:00
parent eb7d6a2398
commit 9504f4694a
41 changed files with 1209 additions and 24 deletions
@@ -37,6 +37,8 @@ public final class InstalledKnowledgeProbe {
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/maps.pbs")), "Missing installed Map/Keyval example");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:spec:sdk-stack-and-queue.md")), "Missing installed Stack/Queue specification");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/stack-queue.pbs")), "Missing installed Stack/Queue example");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/lifecycle.pbs")), "Missing installed lifecycle example");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:LIFECYCLE.md")), "Missing installed lifecycle documentation");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/hashing.pbs")), "Missing installed hashing example");
check(docs.stream().anyMatch(r -> r.id().equals("pbs:sdk:game:1:sdk/hash/main.pbs")), "Missing installed hash SDK");
for (var reference : docs) {
@@ -70,6 +72,11 @@ public final class InstalledKnowledgeProbe {
BuilderPipelineContext.fromConfig(new BuilderPipelineConfig(false, root.toString())), LogAggregator.stdout());
check(result.diagnostics().stream().noneMatch(issue -> issue.isError()), "Example must compile without errors");
check(result.bytecodeBytes().length > 0, "Example must produce bytecode");
for (var role : java.util.List.of(p.studio.compiler.models.registry.IRRegistry.Role.BEFORE_PAUSE,
p.studio.compiler.models.registry.IRRegistry.Role.BEFORE_RESUME)) {
check(result.bytecodeModule().functions().stream().filter(f -> f.metadata().role() == role).count() == 1,
"Installed example must preserve exactly one " + role);
}
Path listRoot=Files.createDirectory(Path.of("list-example")).toRealPath();
Files.createDirectories(listRoot.resolve("src"));
Files.copy(root.resolve("prometeu.json"),listRoot.resolve("prometeu.json"));