feat(studio): deliver asset authoring and automation workflows
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/pr-master There was a failure building this commit

Add shared human/task asset batches with reviewed atomic publication, explicit
reference rebinds, ownership inspection and qualified glyph/scene budgets.
Expose the same authoring and capacity results through Assets and MCP.

Deliver isolated guest test targets, retained visual evidence and immutable
runtime lifecycle/control observations. Preserve provider qualification and
installed authoring examples alongside the completed discussion lessons.

Close AGD-106 coordination and the delivered discussion workflows through
housekeeping, updating lesson references and preserving qualification limits.
Sound remains outside the asset delivery wave.

Validation: 579 module tests and 31 additional desktop, process and installed
checks passed; native glyph/scene 16/17 boundaries qualified. Discussion
validation passed after housekeeping.
This commit is contained in:
2026-11-11 01:21:25 +00:00
parent b351f2e582
commit 1471b427f1
325 changed files with 61179 additions and 323 deletions
@@ -13,7 +13,8 @@ public record PrometeuManifestDTO(
String target,
List<DependencyDeclaration> dependencies,
@JsonProperty("app_id") com.fasterxml.jackson.databind.JsonNode appId,
@JsonProperty("memcard_slots") com.fasterxml.jackson.databind.JsonNode memcardSlots) {
@JsonProperty("memcard_slots") com.fasterxml.jackson.databind.JsonNode memcardSlots,
com.fasterxml.jackson.databind.JsonNode testTargets) {
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
@JsonSubTypes({
@@ -4,5 +4,11 @@ import java.nio.file.Path;
public record DependencyConfig(
boolean explain,
Path cacheDir) {
Path cacheDir,
String buildTargetId) {
public DependencyConfig(boolean explain, Path cacheDir) { this(explain, cacheDir, "production"); }
public DependencyConfig {
buildTargetId = buildTargetId == null ? "production" : buildTargetId;
if (!buildTargetId.matches("[A-Za-z0-9][A-Za-z0-9_.-]{0,127}")) throw new IllegalArgumentException("Invalid build target ID");
}
}
@@ -12,9 +12,22 @@ public record PrometeuManifest(
AppMode target,
ReadOnlyList<DependencyReference> dependencies,
Long appId,
Integer memcardSlots) {
Integer memcardSlots,
TestTargets testTargets,
String manifestSha256) {
public PrometeuManifest(String name, String version, String language, int stdlib, AppMode target,
ReadOnlyList<DependencyReference> dependencies, Long appId, Integer memcardSlots, TestTargets testTargets) {
this(name, version, language, stdlib, target, dependencies, appId, memcardSlots, testTargets, null);
}
public PrometeuManifest {
testTargets = testTargets == null ? TestTargets.empty() : testTargets;
}
public PrometeuManifest(String name, String version, String language, int stdlib, AppMode target,
ReadOnlyList<DependencyReference> dependencies, Long appId, Integer memcardSlots) {
this(name, version, language, stdlib, target, dependencies, appId, memcardSlots, TestTargets.empty());
}
public PrometeuManifest(String name, String version, String language, int stdlib, AppMode target,
ReadOnlyList<DependencyReference> dependencies) {
this(name, version, language, stdlib, target, dependencies, null, null);
this(name, version, language, stdlib, target, dependencies, null, null, TestTargets.empty());
}
}
@@ -13,4 +13,6 @@ public record ResolvedWorkspace(
public ProjectDescriptor mainProject() {
return graph.projectDescriptor(mainProjectId);
}
public String buildTargetId() { return mainProject().getBuildTargetId(); }
public TestTargets.Target testTarget() { return mainProject().getTestTarget(); }
}
@@ -36,7 +36,15 @@ public final class PrometeuManifestUtils {
final Path manifestPathCanon,
final BuildingIssueSink issues) {
final var issuesLocal = BuildingIssueSink.empty();
final PrometeuManifestDTO dto = read(manifestPathCanon);
final PrometeuManifestDTO dto;
final String manifestSha256;
try {
var bytes = java.nio.file.Files.readAllBytes(manifestPathCanon);
dto = MAPPER.readValue(bytes, PrometeuManifestDTO.class);
manifestSha256 = java.util.HexFormat.of().formatHex(java.security.MessageDigest.getInstance("SHA-256").digest(bytes));
} catch (IOException | java.security.NoSuchAlgorithmException failure) {
throw new IllegalStateException("failed to read manifest " + manifestPathCanon, failure);
}
if (StringUtils.isBlank(dto.name())) {
issuesLocal.report(builder -> builder
.error(true)
@@ -65,12 +73,36 @@ public final class PrometeuManifestUtils {
final var dependencies = DependencyResolver.resolveDependencies(mainProjectRootPathCanon, dto.dependencies(), issuesLocal);
final var appId = optionalInteger(dto.appId(), "app_id", 0, 0xffff_ffffL, issuesLocal);
final var slots = optionalInteger(dto.memcardSlots(), "memcard_slots", 1, 64, issuesLocal);
var testTargets = p.studio.compiler.models.TestTargets.empty();
if (dto.testTargets() != null) {
try {
validateTargetTypes(dto.testTargets());
testTargets = MAPPER.treeToValue(dto.testTargets(), p.studio.compiler.models.TestTargets.class);
} catch (IOException | IllegalArgumentException failure) {
issuesLocal.report(b -> b.error(true).code("TEST_TARGETS_INVALID")
.message("[DEPS]: invalid testTargets in " + manifestPathCanon + ": " + failure.getMessage()));
}
}
if (ReadOnlyCollection.isNotEmpty(issuesLocal)) {
issues.merge(issuesLocal);
return Optional.empty();
}
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), target,
ReadOnlyList.wrap(dependencies), appId, slots == null ? null : slots.intValue()));
ReadOnlyList.wrap(dependencies), appId, slots == null ? null : slots.intValue(), testTargets, manifestSha256));
}
private static void validateTargetTypes(com.fasterxml.jackson.databind.JsonNode value) {
if (!value.isObject() || !value.path("schemaVersion").isIntegralNumber() || !value.path("schemaVersion").canConvertToInt()
|| !value.path("targets").isArray()) throw new IllegalArgumentException("testTargets requires integer schemaVersion and targets array");
for (var target : value.path("targets")) {
if (!target.isObject() || !target.path("id").isTextual() || !target.path("entrypoint").isTextual()
|| !target.path("logTag").isIntegralNumber() || !target.path("logTag").canConvertToInt())
throw new IllegalArgumentException("Target requires id, entrypoint and integer logTag");
for (var field : java.util.List.of("sourceRoots", "supportRoots", "exclusions", "cases")) {
if (!target.path(field).isArray()) throw new IllegalArgumentException("Target requires " + field + " array");
for (var item : target.path(field)) if (!item.isTextual()) throw new IllegalArgumentException("Target " + field + " requires strings");
}
}
}
private static Long optionalInteger(com.fasterxml.jackson.databind.JsonNode value, String name,
@@ -40,7 +40,8 @@ public final class DependencyService {
final var issues = dependencyPhase.run(ctx);
issues.forEach(issue -> issue.print(logs.using(log)));
if (issues.hasErrors()) {
throw new BuildException("[DEPS]: issues found during dependency phase: " + dependencyPhase.getClass().getSimpleName());
throw new BuildException("[DEPS]: issues found during dependency phase: " + dependencyPhase.getClass().getSimpleName(),
null, issues.asCollection().stream().toList(), dependencyPhase.getClass().getSimpleName(), java.util.Map.of());
}
}
@@ -11,6 +11,7 @@ import p.studio.utilities.structures.ReadOnlyList;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -67,10 +68,19 @@ public final class WireProjectsPhase implements DependencyPhase {
final BuildingIssueSink issues) {
final BuildingIssueSink sourceRootIssues = BuildingIssueSink.empty();
final List<Path> sourceRoots = new ArrayList<>();
for (final var sourceRoot : ctx.frontendSpec.getSourceRoots()) {
boolean main = projectInfo.rootDirectory.equals(ctx.mainProjectRootPathCanon);
String targetId = main ? ctx.config.buildTargetId() : "production";
var selected = "production".equals(targetId) ? null : projectInfo.manifest.testTargets().find(targetId).orElse(null);
if (!"production".equals(targetId) && selected == null)
issues.report(b -> b.error(true).code("TEST_TARGET_NOT_FOUND").message("[DEPS]: no test target '" + targetId + "' in " + projectInfo.rootDirectory.resolve("prometeu.json")));
var declaredRoots = selected == null ? ctx.frontendSpec.getSourceRoots().asCollection().stream().toList()
: java.util.stream.Stream.concat(selected.sourceRoots().stream(), selected.supportRoots().stream()).distinct().toList();
for (final var sourceRoot : declaredRoots) {
final var sourceRootPath = projectInfo.rootDirectory.resolve(sourceRoot);
try {
final var sourceRootPathCanon = sourceRootPath.toRealPath();
if (selected != null && (!sourceRootPathCanon.startsWith(projectInfo.rootDirectory) || !Files.isDirectory(sourceRootPathCanon)))
throw new IOException("Test source root escapes the project or is not a directory");
sourceRoots.add(sourceRootPathCanon);
} catch (IOException e) {
sourceRootIssues.report(builder -> builder
@@ -79,11 +89,49 @@ public final class WireProjectsPhase implements DependencyPhase {
.exception(e));
}
}
if (sourceRootIssues.size() == ctx.frontendSpec.getSourceRoots().size()) {
if (selected != null || sourceRootIssues.size() == declaredRoots.size()) {
// no source roots were found at all
issues.merge(sourceRootIssues);
}
Path entrypoint = null;
var excludedSources = new ArrayList<Path>();
var excludedRoots = new ArrayList<Path>();
if (selected != null) {
try {
entrypoint = admittedFile(projectInfo.rootDirectory, selected.entrypoint(), sourceRoots);
for (var exclusion : selected.exclusions()) excludedSources.add(admittedFile(projectInfo.rootDirectory, exclusion, sourceRoots));
if (excludedSources.contains(entrypoint)) throw new IOException("Selected entrypoint is excluded");
} catch (IOException failure) {
issues.report(b -> b.error(true).code("TEST_TARGET_SOURCE_INVALID")
.message("[DEPS]: invalid sources for test target '" + targetId + "': " + failure.getMessage()));
}
}
// Explicit declarations of another target do not leak into production or a selected sibling.
// A root shared with the ordinary source roots remains ordinary production code.
for (var target : projectInfo.manifest.testTargets().targets()) {
if (target.id().equals(targetId)) continue;
for (var root : java.util.stream.Stream.concat(target.sourceRoots().stream(), target.supportRoots().stream()).distinct().toList()) {
if (ctx.frontendSpec.getSourceRoots().asCollection().contains(root)) continue;
try {
var candidate = projectInfo.rootDirectory.resolve(root).toRealPath();
if (candidate.startsWith(projectInfo.rootDirectory) && sourceRoots.stream().noneMatch(p -> p.startsWith(candidate)))
excludedRoots.add(candidate);
} catch (IOException ignored) { /* Unselected source existence is checked only when selected. */ }
}
try {
var candidate = projectInfo.rootDirectory.resolve(target.entrypoint()).toRealPath();
if (candidate.startsWith(projectInfo.rootDirectory)) excludedSources.add(candidate);
} catch (IOException ignored) { /* Unselected entrypoints are not required for production. */ }
}
// Selected support under a common production root must still be test-only during production builds.
if (selected == null) for (var target : projectInfo.manifest.testTargets().targets()) for (var root : target.supportRoots()) {
try {
var candidate = projectInfo.rootDirectory.resolve(root).toRealPath();
if (candidate.startsWith(projectInfo.rootDirectory)) excludedRoots.add(candidate);
} catch (IOException ignored) { }
}
return ProjectDescriptor
.builder()
.rootPath(projectInfo.rootDirectory)
@@ -91,6 +139,19 @@ public final class WireProjectsPhase implements DependencyPhase {
.version(projectInfo.manifest.version())
.target(projectInfo.manifest.target())
.sourceRoots(ReadOnlyList.wrap(sourceRoots))
.buildTargetId(targetId)
.testTarget(selected)
.entrypoint(entrypoint)
.manifestSha256(projectInfo.manifest.manifestSha256())
.excludedSources(ReadOnlyList.wrap(excludedSources.stream().distinct().toList()))
.excludedSourceRoots(ReadOnlyList.wrap(excludedRoots.stream().distinct().toList()))
.build();
}
private static Path admittedFile(Path root, String relative, List<Path> sourceRoots) throws IOException {
Path file = root.resolve(relative).toRealPath();
if (!file.startsWith(root) || !Files.isRegularFile(file) || sourceRoots.stream().noneMatch(file::startsWith))
throw new IOException("Target file is outside its selected source roots: " + relative);
return file;
}
}
@@ -15,6 +15,24 @@ class PrometeuManifestUtilsTest {
@TempDir
Path tempDir;
@Test void testTargetsAreVersionedStrictAndPreserveMachineAndApplicationIdentity() throws Exception {
String target="""
{"id":"life","entrypoint":"tests/life/main.pbs","sourceRoots":["src","tests/life"],"supportRoots":["tests/support"],"exclusions":["src/main.pbs"],"cases":["health"],"logTag":41000}
""";
String prefix="{\"name\":\"fixture\",\"version\":\"1\",\"language\":\"pbs\",\"stdlib\":\"1\",\"target\":\"Game\",\"app_id\":123,\"dependencies\":[],\"testTargets\":{\"schemaVersion\":1,\"targets\":[";
var path=writeManifest(prefix+target+"]}}");var issues=BuildingIssueSink.empty();
var manifest=PrometeuManifestUtils.buildManifest(tempDir,path,issues).orElseThrow();
assertEquals(123L,manifest.appId());assertEquals(p.studio.AppMode.Game,manifest.target());
assertEquals("tests/life/main.pbs",manifest.testTargets().find("life").orElseThrow().entrypoint());
for(var invalid:java.util.List.of(target.replace("41000","1.5"),target.replace("41000","\"41000\""),target.replace("\"life\"","\"production\""),target.replace("tests/life/main.pbs","../main.pbs"))) {
path=writeManifest(prefix+invalid+"]}}");issues=BuildingIssueSink.empty();
assertTrue(PrometeuManifestUtils.buildManifest(tempDir,path,issues).isEmpty());
assertTrue(issues.asCollection().stream().anyMatch(i->"TEST_TARGETS_INVALID".equals(i.getCode())));
}
path=writeManifest(prefix+target+","+target+"]}}");issues=BuildingIssueSink.empty();
assertTrue(PrometeuManifestUtils.buildManifest(tempDir,path,issues).isEmpty());
}
@Test
void buildManifestParsesStdlib() throws IOException {
final var manifestPath = writeManifest("""