feat(studio): improve compiler reliability and AI diagnostics
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/pr-master There was a failure building this commit

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:
2026-11-10 12:36:25 +00:00
parent 38f201a9c9
commit ea1cc26fe3
1216 changed files with 168017 additions and 354 deletions
@@ -0,0 +1,63 @@
package p.studio.app.lsp;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import p.studio.api.project.*;
import p.studio.lsp.services.LspServerLifecycleImpl;
import java.nio.file.*;
import static org.junit.jupiter.api.Assertions.*;
class LspDiscoveryTest {
@TempDir Path root;
final ObjectMapper mapper = new ObjectMapper();
ProjectReference project() { return new ProjectReference("app", "1.0", "pbs", 1, ProjectTarget.Game, root); }
@Test void publishesActualProjectEndpointAndRemovesItOnClose() throws Exception {
var lifecycle = new LspServerLifecycleImpl();
var adapter = new LspLifecycleAdapter(lifecycle);
var project = project();
adapter.boot(project);
try {
var data = mapper.readTree(root.resolve(".studio/lsp.json").toFile());
assertEquals(1, data.path("schemaVersion").asInt());
assertEquals(root.toRealPath().toString(), data.path("projectRoot").asText());
assertEquals(ProcessHandle.current().pid(), data.path("processId").asLong());
var endpoint = lifecycle.endpoint(LspLifecycleAdapter.context(project)).orElseThrow();
assertEquals(endpoint.port(), data.path("port").asInt());
assertEquals("127.0.0.1", data.path("host").asText());
assertFalse(data.path("sessionId").asText().isBlank());
} finally { adapter.shutdown(project); }
assertFalse(Files.exists(root.resolve(".studio/lsp.json")));
assertTrue(lifecycle.endpoint(LspLifecycleAdapter.context(project)).isEmpty());
}
@Test void newSessionGetsFreshIdentityAndPortCanBeRediscovered() throws Exception {
var adapter = new LspLifecycleAdapter(new LspServerLifecycleImpl());
var project = project();
adapter.boot(project);
String first;
try { first = mapper.readTree(root.resolve(".studio/lsp.json").toFile()).path("sessionId").asText(); }
finally { adapter.shutdown(project); }
adapter.boot(project);
try { assertNotEquals(first, mapper.readTree(root.resolve(".studio/lsp.json").toFile()).path("sessionId").asText()); }
finally { adapter.shutdown(project); }
}
@Test void shutdownPreservesMetadataOwnedByAnotherSession() throws Exception {
var adapter = new LspLifecycleAdapter(new LspServerLifecycleImpl());
var project = project();
adapter.boot(project);
Files.writeString(root.resolve(".studio/lsp.json"), "{\"sessionId\":\"replacement\"}");
adapter.shutdown(project);
assertTrue(Files.readString(root.resolve(".studio/lsp.json")).contains("replacement"));
}
@Test void failedPublicationRollsBackListeningServer() throws Exception {
Files.writeString(root.resolve(".studio"), "blocked");
var lifecycle = new LspServerLifecycleImpl();
var adapter = new LspLifecycleAdapter(lifecycle);
assertThrows(IllegalStateException.class, () -> adapter.boot(project()));
assertTrue(lifecycle.endpoint(LspLifecycleAdapter.context(project())).isEmpty());
}
}