feat(studio): improve compiler reliability and AI diagnostics
Preserve structured diagnostics, source attribution, phase outcomes and revision context through compiler, Studio, LSP, MCP and JavaFX. Add project service discovery and resilient VS Code reconnection. Correct all eight reproduced PBS production failures in expression context, sibling executable bindings and nominal owner identity. Consolidate specs, lessons, immutable baseline evidence and the maintained source-to-guest qualification runner. Validation: required Gradle gate recorded 724 tests, with 711 passed and 13 skipped. Full corpus passed 168 compilation observations and 108 guest runs (104 successes and four deliberate faults); supplemental controls passed 42 compilations and 16 guest runs. TypeScript compilation, two Node discovery tests and discussion validation passed.
This commit is contained in:
@@ -375,6 +375,61 @@ class McpTaskToolsTest {
|
||||
error("INVALID_TASK", httpCall(client, server, reconnected, "studio_build_start", args().put("clientRequestId", "late")));
|
||||
} finally { lsp.shutdown(project); }
|
||||
}
|
||||
@Test void cancelledBuildCannotPublishSuccessOrUsableArtifactIdentityAfterLateReturn() throws Exception {
|
||||
acquire(); holdBuild = true;
|
||||
var receipt = value(call("studio_build_start", args().put("clientRequestId", "cancel-build")));
|
||||
assertTrue(buildEntered.await(2, TimeUnit.SECONDS));
|
||||
value(call("studio_operation_cancel", args().put("operationId", receipt.path("operationId").asText())));
|
||||
assertFalse(poll("cancel-build").path("workerTerminated").asBoolean()); buildGate.countDown();
|
||||
var result = completed("cancel-build");
|
||||
assertEquals("CANCELLED", result.path("state").asText()); assertEquals("CANCELLED", result.path("result").path("status").asText());
|
||||
assertEquals("cancelled", result.path("result").path("summary").path("validationStatus").asText()); assertTrue(result.path("result").path("buildId").isNull());
|
||||
assertEquals(ControlState.AGENT_WORKING, session.snapshot().state());
|
||||
}
|
||||
|
||||
@Test void controlledInvalidCommonIrRetAndJoinSurviveTheRealBuildGatewayAndAuthenticatedMcp() throws Exception {
|
||||
Files.writeString(root.resolve("prometeu.json"), "{\"name\":\"controlled\",\"version\":\"1\",\"language\":\"controlled-ir\",\"stdlib\":\"1\",\"target\":\"Game\",\"dependencies\":[]}");
|
||||
Files.createDirectories(root.resolve("src")); Files.writeString(root.resolve("src/probe.synth"), "x");
|
||||
var reports = mapper.createArrayNode();
|
||||
try (var packer = p.packer.Packer.bootstrap(mapper, ignored -> {})) {
|
||||
compose(new p.studio.core.shipper.StudioShipperService(new p.studio.app.compiler.CompilerBuildGatewayAdapter(), packer.workspaceService(), mapper, new ExecutorOperationExecutor(workers), access));
|
||||
try (var server = new LocalMcpServer(mapper, tools); var client = java.net.http.HttpClient.newHttpClient()) {
|
||||
server.start(); var credential = server.credentials().prepare(root); credential.activate(); httpAuthorization = "Bearer " + credential.secret();
|
||||
String connection = connect(client, server); session.grant(false).toCompletableFuture().join();
|
||||
task = value(httpCall(client, server, connection, "studio_control_acquire", rootOnly())).path("taskId").asText();
|
||||
for (var variant : List.of("ret", "join", "ret-no-origin")) {
|
||||
boolean ret = !variant.equals("join"), noOrigin = variant.endsWith("no-origin");
|
||||
var frontend = new p.studio.app.compiler.fixture.ControlledIrFrontend(ret, noOrigin);
|
||||
p.studio.compiler.FrontendRegistryService.register(frontend);
|
||||
try {
|
||||
String request = variant + "-fixture";
|
||||
value(httpCall(client, server, connection, "studio_build_start", args().put("clientRequestId", request)));
|
||||
var result = httpCompleted(client, server, connection, request); var build = result.path("result");
|
||||
assertEquals("FAILED", build.path("status").asText(), build.toString());
|
||||
assertEquals("failed", build.path("summary").path("validationStatus").asText());
|
||||
var issue = build.path("issues").get(0);
|
||||
assertEquals(ret ? "compiler.verify.ret-stack-height" : "compiler.verify.join-stack-height", issue.path("checkId").asText(), issue.toString());
|
||||
assertEquals("available", issue.path("explanation").path("availability").asText());
|
||||
assertEquals("irvm-function", issue.path("origin").path("verification").path("pcSpace").asText());
|
||||
assertEquals("byte", issue.path("origin").path("verification").path("pcUnit").asText());
|
||||
assertEquals("lowering-output", issue.path("origin").path("verification").path("validationPoint").asText());
|
||||
if (noOrigin) {
|
||||
assertTrue(issue.path("origin").path("uri").isNull()); assertTrue(issue.path("origin").path("range").isNull());
|
||||
assertEquals("no-source-span", issue.path("origin").path("attribution").path("absenceReason").asText());
|
||||
assertFalse(issue.path("related").isEmpty());
|
||||
} else assertEquals(root.resolve("src/probe.synth").toUri().toString(), issue.path("origin").path("uri").asText());
|
||||
assertTrue(issue.path("facts").has(ret ? "expectedHeight" : "existingHeight"));
|
||||
assertTrue(issue.path("facts").has(ret ? "actualHeight" : "incomingHeight"));
|
||||
reports.add(result);
|
||||
} finally { p.studio.compiler.FrontendRegistryService.unregister(frontend.specification().getLanguageId()); }
|
||||
}
|
||||
value(httpCall(client, server, connection, "studio_control_release", args()));
|
||||
}
|
||||
}
|
||||
var report = Path.of("build/diagnostic-qualification/controlled-backend.json"); Files.createDirectories(report.getParent());
|
||||
mapper.writerWithDefaultPrettyPrinter().writeValue(report.toFile(), reports);
|
||||
}
|
||||
|
||||
String connect(java.net.http.HttpClient client, LocalMcpServer server) throws Exception {
|
||||
var initialize = mapper.createObjectNode().put("jsonrpc", "2.0").put("id", 1).put("method", "initialize");
|
||||
var params = initialize.putObject("params").put("protocolVersion", "2025-06-18");
|
||||
|
||||
Reference in New Issue
Block a user