feat(studio): ship JavaFX 2 Play and delegate integration tooling
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/head There was a failure building this commit

Launch the JavaFX 2 project shell on Java 25 with an interactive viewport,
managed Play lifecycle and project mutation guards. Preserve headless/MCP and
save compatibility, and qualify exact runtime executable bundles.
Separate unit JaCoCo gates from opt-in integration suites and use the internal
Pong fixture for the headless visual pilot.
Move maintenance and native conformance tools into tooling; retain the VS Code
extension and update current navigation links.

Validation: tooling make verify passed, including 1064 Studio unit tests,
JaCoCo thresholds and 22 headless integration tests.
This commit is contained in:
2026-11-19 17:32:03 +00:00
parent 1e17fc4d67
commit 71fb80efc3
163 changed files with 5929 additions and 4950 deletions
@@ -18,6 +18,7 @@ import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.*;
/** Actual app composition and saved-source services; no runtime/build/LSP doubles. */
@org.junit.jupiter.api.Tag("integration")
class HeadlessTaskIntegrationTest {
@TempDir Path root;
ConfigurableApplicationContext app;
@@ -120,12 +121,16 @@ class HeadlessTaskIntegrationTest {
System.out.println("VISUAL_EVIDENCE "+mapper.writeValueAsString(Map.of("kind","native-checkpoint","artifact",artifact,"report",report.report(),"nativeAdvanceRequests",2,"persistenceExtraAdvanceOrCaptureRequests",0)));
}
@Test void zeldaPilotUsesDisposableCopyAndKeepsReferenceLimitationsExplicit() throws Exception {
Path originalProject=Path.of(System.getProperty("studio.test.zeldaProject", "../../zelda-1")).toAbsolutePath().normalize();
assertTrue(Files.isRegularFile(originalProject.resolve("prometeu.json")),"Zelda pilot checkout is required for this qualification");
project.close();Path copy=root.resolve("zelda-pilot");Files.createDirectories(copy);
@Test void pongPilotUsesDisposableCopyAndIndependentRegionReferences() throws Exception {
String fixture=System.getProperty("studio.test.pong");
assertNotNull(fixture,"Run headlessProcessTest to select Studio's test-projects/pong fixture");
Path originalProject=Path.of(fixture).toAbsolutePath().normalize();
assertTrue(Files.isRegularFile(originalProject.resolve("prometeu.json")),"Repository-owned Pong fixture is required");
String originalSource=Files.readString(originalProject.resolve("src/main.pbs"));
project.close();Path copy=root.resolve("Pong Headless");Files.createDirectories(copy);
for(String name:List.of("prometeu.json","src","assets")) {
Path from=originalProject.resolve(name);
if(!Files.exists(from))continue; // Pong has no external assets.
if(Files.isDirectory(from))try(var paths=Files.walk(from)) {
for(var p:paths.toList()){var target=copy.resolve(originalProject.relativize(p));if(Files.isDirectory(p))Files.createDirectories(target);else Files.copy(p,target);}
}else Files.copy(from,copy.resolve(name));
@@ -133,17 +138,20 @@ class HeadlessTaskIntegrationTest {
root=copy.toRealPath();var ref=app.getBean(ProjectCatalog.class).openProject(root);
app.getBean(ProjectLocalStudioSetupStore.class).save(ref,new ProjectLocalStudioSetup(System.getProperty("studio.test.runtimeInstall"),null));
project=app.getBean(ProjectSessionFactory.class).open(ref);project.automation().grant(false).toCompletableFuture().get(5,TimeUnit.SECONDS);task=tasks.acquire(root).task().value();
String build=successfulBuild("zelda-pilot-build");tasks.headless(root,task,TaskTools.HeadlessAction.BOOT,build,Map.of("memcardChoice","memory_fresh"));
String build=successfulBuild("pong-pilot-build");call(TaskTools.HeadlessAction.BOOT,build);
var evidence=app.getBean(EvidenceTools.class);var measurements=new ArrayList<Map<String,Object>>();
var mcp=app.getBean(p.studio.app.mcp.McpToolRegistry.class);
long beforeWireBytes=0,afterWireBytes=0;int beforeCalls=0,afterCalls=0;
var legacyPaths=new ArrayList<String>();
String[] refs={"extracted/inventory_screen/validation/production_start.png","extracted/hud/runtime_initial.png","extracted/bomb_wall/validation/scroll_north_mid.png"};
String[] names={"screen","hud","scroll"};
String[] names={"menu-accent","serve-ball","moved-paddle"};
// Fixed expectations from the fixture's draw/input contract, never from a native capture.
Evidence.Rect[] regions={new Evidence.Rect(113,114,1,80),new Evidence.Rect(237,152,6,6),new Evidence.Rect(42,72,8,36)};
int[][] colors={{77,237,205},{236,244,250},{77,237,205}};
long totalPngBytes=0;
for(int i=0;i<names.length;i++) {
if(i>0)tasks.headless(root,task,TaskTools.HeadlessAction.SET_INPUT,null,Map.of(i==1?"start":"right",true));
String request="zelda-"+names[i];tasks.advance(root,task,request,i==0?1:i==1?76:120);var operation=finished(request);
if(i==1)tasks.headless(root,task,TaskTools.HeadlessAction.SET_INPUT,null,Map.of("start",true));
if(i==2)tasks.headless(root,task,TaskTools.HeadlessAction.SET_INPUT,null,Map.of("start",false,"up",true));
String request="pong-"+names[i];tasks.advance(root,task,request,i==2?20:1);var operation=finished(request);
assertNull(operation.failure());assertNotNull(operation.runtimeResult().capture());
var args=mapper.createObjectNode().put("projectRoot",root.toString()).put("taskId",task);
var before=mcp.call("studio_operation_get",args.deepCopy().put("clientRequestId",request)).wire();
@@ -154,13 +162,18 @@ class HeadlessTaskIntegrationTest {
afterCalls++;afterWireBytes+=mapper.writeValueAsBytes(persisted).length;
assertFalse(persisted.path("isError").asBoolean(),persisted.toString());
var actual=mapper.convertValue(persisted.path("structuredContent").path("value"),Evidence.Publication.class).artifacts().getFirst();
Path reference=root.resolve("reference-"+names[i]+".png");Files.copy(originalProject.resolve(refs[i]),reference);
Path reference=root.resolve("reference-"+names[i]+".png");
byte[] rgba=new byte[480*270*4];
for(int pixel=0;pixel<rgba.length;pixel+=4){
rgba[pixel]=(byte)colors[i][0];rgba[pixel+1]=(byte)colors[i][1];rgba[pixel+2]=(byte)colors[i][2];rgba[pixel+3]=(byte)255;
}
Files.write(reference,new p.studio.app.evidence.PngEvidenceCodec().encode(new Evidence.Pixels(480,270,rgba)));
legacyPaths.add(reference.toString());legacyPaths.add(legacyActual.toString());
var imported=mcp.call("studio_evidence_import",args.deepCopy().put("clientRequestId","import-"+request).put("path",reference.toString())).wire();
afterCalls++;afterWireBytes+=mapper.writeValueAsBytes(imported).length;
assertFalse(imported.path("isError").asBoolean(),imported.toString());
var expected=mapper.convertValue(imported.path("structuredContent").path("value"),Evidence.Publication.class).artifacts().getFirst();
Evidence.Rect roi=i==1?new Evidence.Rect(112,15,256,56):null;
Evidence.Rect roi=regions[i];
var params=new Evidence.Parameters(roi,List.of(),Evidence.Alpha.compare,0,0);
var comparisonArgs=args.deepCopy().put("clientRequestId","compare-"+request).put("expectedId",expected.id()).put("actualId",actual.id());
var parametersNode=(com.fasterxml.jackson.databind.node.ObjectNode)mapper.valueToTree(params);
@@ -168,8 +181,12 @@ class HeadlessTaskIntegrationTest {
var compared=mcp.call("studio_evidence_compare",comparisonArgs).wire();afterCalls++;afterWireBytes+=mapper.writeValueAsBytes(compared).length;
assertFalse(compared.path("isError").asBoolean(),compared.toString());
var report=mapper.convertValue(compared.path("structuredContent").path("value"),Evidence.Publication.class);
assertEquals(Evidence.Verdict.passed,report.report().verdict(),names[i]);
assertEquals((long)roi.width()*roi.height(),report.report().comparedPixels());
assertEquals(0,report.report().differentPixels());
assertArrayEquals(legacyPng,evidence.image(root,task,actual.id()));
totalPngBytes+=legacyPng.length;
measurements.add(Map.of("case",names[i],"referencePath",refs[i],"actual",actual,"report",report.report()));
measurements.add(Map.of("case",names[i],"referencePath",reference.getFileName().toString(),"actual",actual,"report",report.report()));
}
// Execute the former external comparison path against the same checkpoints; count actual calls/bytes/scripts.
Path script=root.resolve("LegacyVisualCompare.java");
@@ -187,10 +204,11 @@ class HeadlessTaskIntegrationTest {
var command=new ArrayList<String>(List.of(Path.of(System.getProperty("java.home"),"bin","java").toString(),script.toString()));command.addAll(legacyPaths);
var legacy=new ProcessBuilder(command).redirectErrorStream(true).start();assertTrue(legacy.waitFor(30,TimeUnit.SECONDS));
String legacyOutput=new String(legacy.getInputStream().readAllBytes(),java.nio.charset.StandardCharsets.UTF_8);assertEquals(0,legacy.exitValue(),legacyOutput);
var output=Map.of("kind","zelda-pilot","limitations","Saved port captures are contextual references, not an independent NES oracle; screen/HUD/scroll reference labels identify their provenance. Current checkpoints are observations and mismatch is retained as a comparison result.",
assertEquals(originalSource,Files.readString(originalProject.resolve("src/main.pbs")),"Build and runtime must use only the disposable copy");
var output=Map.of("kind","pong-pilot","limitations","Solid-color references specify only the declared ROIs independently of native captures. These checks cover menu, serve and input-driven paddle movement, not full-game visual equivalence.",
"results",measurements,"measurement",Map.of("sharedGuestAdvanceRequests",3,"before",Map.of("mcpCalls",beforeCalls,"wireResponseBytes",beforeWireBytes,"imagePngBytes",totalPngBytes,"externalComparisonScripts",1,"externalScriptOutput",legacyOutput),
"after",Map.of("mcpCalls",afterCalls,"wireResponseBytes",afterWireBytes,"imageTransferBytesForMetrics",0,"externalComparisonScripts",0),
"basis","Actual local MCP adapter dispatches and serialized response bytes, excluding shared build/advance/asynchronous polling. Both comparison paths use the same three retained guest checkpoints. Legacy full-image exact metrics differ from the explicit HUD ROI by design."));
"basis","Actual local MCP adapter dispatches and serialized response bytes, excluding shared build/advance/asynchronous polling. Both comparison paths use the same three retained guest checkpoints. Legacy full-image exact metrics differ from ROI-specific checks by design."));
System.out.println("VISUAL_EVIDENCE "+mapper.writeValueAsString(output));
}