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
@@ -0,0 +1,52 @@
package p.packer.services;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.io.TempDir;
import p.packer.messages.*;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.*;
import static org.junit.jupiter.api.Assertions.*;
class PackerFilePublicationTest {
@TempDir Path root;
PackerProjectWriteCoordinator lane=new PackerProjectWriteCoordinator();
@AfterEach void close(){lane.close();}
PackerProjectContext project(){return new PackerProjectContext("publication",root);}
byte[] bytes(String value){return value.getBytes(java.nio.charset.StandardCharsets.UTF_8);}
@Test void committedCrashStateRecoversBeforeFirstReaderAndUncommittedStageDoesNotPublish()throws Exception {
Files.writeString(root.resolve("a"),"old");Files.writeString(root.resolve("b"),"old");
String id=UUID.randomUUID().toString();Path dir=Files.createDirectories(root.resolve(".studio/asset-transactions/"+id));
Files.write(dir.resolve("object-0"),bytes("new"));Files.write(dir.resolve("object-1"),bytes("new"));
var manifest=new PackerFilePublication.Journal(List.of(new PackerFilePublication.File("a",PackerFilePublication.hash(bytes("old")),PackerFilePublication.hash(bytes("new")),"object-0"),new PackerFilePublication.File("b",PackerFilePublication.hash(bytes("old")),PackerFilePublication.hash(bytes("new")),"object-1")));
new com.fasterxml.jackson.databind.ObjectMapper().writeValue(dir.resolve("manifest.json").toFile(),manifest);
assertEquals(List.of("old","old"),lane.execute(project(),()->List.of(Files.readString(root.resolve("a")),Files.readString(root.resolve("b")))));
Files.write(dir.resolve("commit"),new byte[]{1});Files.writeString(root.resolve("a"),"new"); // Simulated death halfway through a committed publication.
lane.close();lane=new PackerProjectWriteCoordinator();
assertEquals(List.of("new","new"),lane.execute(project(),()->List.of(Files.readString(root.resolve("a")),Files.readString(root.resolve("b")))));
assertTrue(Files.exists(dir.resolve("done")));assertTrue(Files.exists(dir.resolve("recovered")));
}
@Test void staleInputRejectsWholePublicationBeforeCommitAndValidPublicationFlushesAllFiles()throws Exception {
Files.writeString(root.resolve("a"),"old");Files.writeString(root.resolve("b"),"external");
var edits=List.of(new PublishWorkspaceFilesRequest.Edit("a",PackerFilePublication.hash(bytes("old")),bytes("new")),new PublishWorkspaceFilesRequest.Edit("b",PackerFilePublication.hash(bytes("old")),bytes("new")));
String failed=UUID.randomUUID().toString();
assertThrows(IllegalStateException.class,()->lane.execute(project(),()->{PackerFilePublication.publish(new PublishWorkspaceFilesRequest(project(),failed,edits));return null;}));
assertEquals("old",Files.readString(root.resolve("a")));assertEquals("external",Files.readString(root.resolve("b")));assertFalse(Files.exists(root.resolve(".studio/asset-transactions/"+failed+"/commit")));
Files.writeString(root.resolve("b"),"old");String applied=UUID.randomUUID().toString();
lane.execute(project(),()->{PackerFilePublication.publish(new PublishWorkspaceFilesRequest(project(),applied,edits));return null;});
assertEquals("new",Files.readString(root.resolve("a")));assertEquals("new",Files.readString(root.resolve("b")));assertTrue(Files.exists(root.resolve(".studio/asset-transactions/"+applied+"/done")));
}
@Test void sharedReadersCannotSeeAPublisherHalfwayThroughItsProjectLane()throws Exception {
Files.writeString(root.resolve("a"),"old");Files.writeString(root.resolve("b"),"old");
var halfway=new CountDownLatch(1);var finish=new CountDownLatch(1);
var publishing=lane.submit(project(),()->{Files.writeString(root.resolve("a"),"new");halfway.countDown();assertTrue(finish.await(5,TimeUnit.SECONDS));Files.writeString(root.resolve("b"),"new");return null;});
assertTrue(halfway.await(5,TimeUnit.SECONDS));var reading=lane.submit(project(),()->List.of(Files.readString(root.resolve("a")),Files.readString(root.resolve("b"))));
assertFalse(reading.isDone());finish.countDown();publishing.get(5,TimeUnit.SECONDS);assertEquals(List.of("new","new"),reading.get(5,TimeUnit.SECONDS));
}
@Test void reentrantLaneDoesNotDeadlockAndPublicationRejectsSymlinkEscape()throws Exception {
assertEquals("inside",lane.execute(project(),()->lane.execute(project(),()->"inside")));
Files.createSymbolicLink(root.resolve("escape"),root.getParent());
var edit=new PublishWorkspaceFilesRequest.Edit("escape/forbidden",null,bytes("unsafe"));
assertThrows(IllegalArgumentException.class,()->lane.execute(project(),()->{PackerFilePublication.publish(new PublishWorkspaceFilesRequest(project(),UUID.randomUUID().toString(),List.of(edit)));return null;}));
}
}