feat(studio): show executed source diagnostics in UI2
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

Capture bounded compiler inputs by revision and PBX identity, consume Play v2 faults and retain static diagnostic excerpts across failed preparation. Integrate the UI2 panel, qualification evidence and regression tests without adding an editor.
This commit is contained in:
2026-11-26 08:55:33 +00:00
parent 481c479427
commit 601997d163
47 changed files with 2811 additions and 58 deletions
@@ -0,0 +1,42 @@
package p.studio.app.compiler;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import p.studio.api.execution.ExecutionSources;
import p.studio.api.project.*;
import java.nio.file.*;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.*;
class ExecutionSourceBuildTest {
@TempDir Path root;
@Test void capturesProjectDependencyAndSdkWithDistinctLogicalOriginsAndRejectsOversizedInput() throws Exception {
Files.createDirectories(root.resolve("src"));
Path dependency=Files.createDirectories(root.resolve(".workspace/repos/lib/src/probe")).getParent().getParent();
Files.writeString(root.resolve(".workspace/repos/registry.json"),"{}");
Files.writeString(root.resolve("prometeu.json"),"""
{"name":"app","version":"1","language":"pbs","stdlib":"1","target":"Game","dependencies":[{"path":".workspace/repos/lib"}]}
""");
Files.writeString(dependency.resolve("prometeu.json"),"""
{"name":"lib","version":"1","language":"pbs","stdlib":"1","target":"Game","dependencies":[]}
""");
Files.writeString(dependency.resolve("src/probe/main.pbs"),"fn value() -> int { return 42; }");
Files.writeString(dependency.resolve("src/probe/mod.barrel"),"pub fn value() -> int;");
Files.writeString(root.resolve("src/mod.barrel"),"pub fn frame() -> void;");
String text="import { value } from @lib:probe;\nimport { math } from @sdk:math;\n[Frame] fn frame() -> void { let number = math.abs(value()); }\n";
Path main=root.resolve("src/main.pbs");Files.writeString(main,text);
var project=new ProjectReference("app","1","pbs",1,ProjectTarget.Game,root);
var adapter=new CompilerBuildGatewayAdapter();var build=adapter.compile(project,ignored->{});
var capture=build.executionSources();
assertEquals(ExecutionSources.digest(Files.readAllBytes(build.bytecodeArtifact())),capture.programSha256());
assertTrue(capture.sources().values().stream().anyMatch(s->s.kind().equals("dependency")&&s.logicalPath().startsWith("@lib:")));
assertTrue(capture.sources().values().stream().anyMatch(s->s.kind().equals("sdk")));
Files.delete(main);
assertTrue(capture.sources().values().stream().anyMatch(s->s.text().equals(text)));
assertFalse(build.context().toString().contains("let number"));
Files.writeString(main,"[Frame] fn frame() -> void {}\n//"+"x".repeat(ExecutionSources.MAX_FILE_BYTES));
var failure=assertThrows(IllegalStateException.class,()->adapter.compile(project,ignored->{}));
assertTrue(failure.getMessage().contains("source byte limit"),failure.toString());
assertTrue(capture.sources().values().stream().anyMatch(s->s.sha256().equals(ExecutionSources.digest(text.getBytes(StandardCharsets.UTF_8)))));
}
}