feat(pbs): add mutable lists and stable snapshot cursors
Implement SDK list<T> and Cursor<T> with trusted compiler bindings and generic storage publication across IR and PBX. Pin the runtime provider and include specs, conformance coverage, installed examples, and DSC-0090 lessons.
This commit is contained in:
@@ -47,6 +47,8 @@ class CompilerProjectKnowledgeTest {
|
||||
assertTrue(result.libraries().getFirst().id().startsWith("sdk:pbs:"));
|
||||
assertFalse(result.references().isEmpty());
|
||||
assertTrue(result.references().stream().anyMatch(value -> value.id().equals("pbs:quickstart")));
|
||||
assertTrue(result.references().stream().anyMatch(value -> value.id().equals("pbs:spec:sdk-list-and-cursor.md")));
|
||||
assertTrue(result.references().stream().anyMatch(value -> value.id().equals("pbs:example:game:1:src/collections.pbs")));
|
||||
assertTrue(language.referenceIds().contains("pbs:quickstart"));
|
||||
assertFalse(result.limitations().stream().anyMatch(value -> value.contains("DOCUMENTATION_UNAVAILABLE")));
|
||||
assertFalse(Files.exists(root.resolve(".workspace")));
|
||||
|
||||
@@ -27,6 +27,8 @@ public final class InstalledKnowledgeProbe {
|
||||
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/contracts.pbs")), "Missing installed generic-contract example");
|
||||
check(docs.stream().anyMatch(r -> r.id().equals("pbs:spec:generic-structs-and-free-functions.md")), "Missing installed generic struct/function specification");
|
||||
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/generics.pbs")), "Missing installed generic struct/function example");
|
||||
check(docs.stream().anyMatch(r -> r.id().equals("pbs:spec:sdk-list-and-cursor.md")), "Missing installed List/Cursor specification");
|
||||
check(docs.stream().anyMatch(r -> r.id().equals("pbs:example:game:1:src/collections.pbs")), "Missing installed List/Cursor example");
|
||||
for (var reference : docs) {
|
||||
if (reference.id().startsWith("pbs:example:game:1:")) {
|
||||
Path file = root.resolve(reference.id().substring("pbs:example:game:1:".length()));
|
||||
@@ -58,6 +60,21 @@ 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");
|
||||
Path listRoot=Files.createDirectory(Path.of("list-example")).toRealPath();
|
||||
Files.createDirectories(listRoot.resolve("src"));
|
||||
Files.copy(root.resolve("prometeu.json"),listRoot.resolve("prometeu.json"));
|
||||
Files.writeString(listRoot.resolve("src/mod.barrel"),"pub fn frame() -> void;");
|
||||
Files.writeString(listRoot.resolve("src/main.pbs"),Files.readString(root.resolve("src/collections.pbs"))+"\n"+"""
|
||||
[Frame] fn frame() -> void {
|
||||
if collectionsExample()!=42 {let failure=1/0;}
|
||||
}
|
||||
""");
|
||||
var listResult=BuilderPipelineService.INSTANCE.compile(
|
||||
BuilderPipelineContext.fromConfig(new BuilderPipelineConfig(false,listRoot.toString())),LogAggregator.stdout());
|
||||
check(listResult.diagnostics().stream().noneMatch(issue->issue.isError()),"Installed List/Cursor example must compile");
|
||||
Path fixtures=Path.of(System.getProperty("pbs.registryConformanceDirectory"));
|
||||
Files.createDirectories(fixtures);Files.write(fixtures.resolve("pbs-list-installed.pbx"),listResult.bytecodeBytes());
|
||||
System.out.println("Installed List/Cursor execution fixture generated");
|
||||
verifyExternalSources(provider.getClass().getClassLoader());
|
||||
registration.unsubscribe();
|
||||
System.out.println("Installed knowledge verified: " + docs.size() + " references; example compiled");
|
||||
|
||||
@@ -15,6 +15,7 @@ class InstalledKnowledgeTest {
|
||||
String log = runProbe();
|
||||
assertTrue(log.contains("references; example compiled"), log);
|
||||
assertTrue(log.contains("Packaged external sources verified"), log);
|
||||
assertTrue(log.contains("Installed List/Cursor execution fixture generated"), log);
|
||||
}
|
||||
|
||||
@Test void installedCompilerAndSdkCarryTheSameVerifiedCatalog() throws Exception {
|
||||
@@ -32,6 +33,7 @@ class InstalledKnowledgeTest {
|
||||
String probeClasses = Path.of(InstalledKnowledgeProbe.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
|
||||
Path output = outsideRepository.resolve("probe.log");
|
||||
var command = new java.util.ArrayList<>(java.util.List.of(distribution.resolve("runtime/bin/java").toString(),
|
||||
"-Dpbs.registryConformanceDirectory=" + System.getProperty("pbs.registryConformanceDirectory"),
|
||||
"-cp", jars + java.io.File.pathSeparator + probeClasses, InstalledKnowledgeProbe.class.getName()));
|
||||
command.addAll(java.util.List.of(arguments));
|
||||
var process = new ProcessBuilder(command)
|
||||
|
||||
Reference in New Issue
Block a user