feat: add agent coordination and automatic work completion
Add portable topics and surveys, decision approval history, execution plans, local Codex and Claude adapters, and general agent routing. Consolidate Plan and EPIC results through deterministic completion receipts, reviewed cancellation scope and recoverable reconciliation. Track the completed WRK-0001 and WRK-0002 records, protocol documentation, source manifests and delivery evidence. Validation: 117 tests including Modulith; GraalVM 25 native compilation, standalone smoke and ZIP/TAR verification on macOS ARM64; identical persisted context across JVM and native executions.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package net.intrepid.aiengineering;
|
||||
|
||||
import net.intrepid.aiengineering.cli.EngineeringCli;
|
||||
import net.intrepid.aiengineering.discussion.DiscussionService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
class DiscussionTextFileTest {
|
||||
@TempDir Path root;
|
||||
@TempDir Path drafts;
|
||||
private String output;
|
||||
private int cli(Path cwd, String... args) {
|
||||
var out = new StringWriter(); var err = new StringWriter();
|
||||
int code = new EngineeringCli(cwd).execute(new PrintWriter(out), new PrintWriter(err), args);
|
||||
output = out + err.toString(); return code;
|
||||
}
|
||||
private void ok(String... args) { int code = cli(root, args); assertThat(code).as(output).isZero(); }
|
||||
private void initialize() { ok("init", "--name", "Test"); ok("work", "create", "One"); }
|
||||
@Test void importsExactUtf8TextRelativeToInvocationDirectoryAndPersistsIndependently() throws Exception {
|
||||
initialize(); ok("discussion", "add", "WRK-0001", "--kind", "QUESTION", "--text", "Which approach?");
|
||||
String prose = "\n## Proposta — árvore 日本語\r\n\r\n- First limit\n- Second limit\n\n```yaml\n---\nkey: value\n```\n";
|
||||
Path file = Files.writeString(drafts.resolve("proposal.md"), prose);
|
||||
assertThat(cli(drafts, "--project", root.toString(), "discussion", "add", "WRK-0001", "--text-file", "proposal.md",
|
||||
"--author", "agent", "--kind", "SUGGESTION", "--responds-to", "DSC-0001")).as(output).isZero();
|
||||
assertThat(output).contains("documentVersion: 2", prose);
|
||||
var entries = new DiscussionService().list(root, "WRK-0001");
|
||||
assertThat(entries).hasSize(2); assertThat(entries.getLast().text()).isEqualTo(prose);
|
||||
assertThat(entries.getLast().author()).isEqualTo("agent"); assertThat(entries.getLast().respondsTo()).isEqualTo("DSC-0001");
|
||||
assertThat(Files.readString(file)).isEqualTo(prose); Files.delete(file);
|
||||
ok("work", "context", "WRK-0001"); assertThat(output).contains(prose);
|
||||
ok("project", "validate");
|
||||
}
|
||||
@Test void requiresExactlyOneTextSourceAndDoesNotAppendOnFailure() throws Exception {
|
||||
initialize(); Path file = Files.writeString(drafts.resolve("proposal.md"), "Proposal");
|
||||
assertThat(cli(root, "discussion", "add", "WRK-0001")).isEqualTo(2);
|
||||
assertThat(cli(root, "discussion", "add", "WRK-0001", "--text", "Inline", "--text-file", file.toString())).isEqualTo(2);
|
||||
assertThat(new DiscussionService().list(root, "WRK-0001")).isEmpty();
|
||||
}
|
||||
@Test void missingInvalidEmptyAndOversizedSourcesProduceUsefulFailures() throws Exception {
|
||||
initialize(); Path malformed = Files.write(drafts.resolve("malformed.md"), new byte[]{(byte) 0xc3, 0x28});
|
||||
Path empty = Files.writeString(drafts.resolve("empty.md"), " \n\t");
|
||||
Path large = Files.write(drafts.resolve("large.md"), new byte[1024 * 1024 + 1]);
|
||||
assertThat(cli(root, "discussion", "add", "WRK-0001", "--text-file", drafts.resolve("missing.md").toString())).isEqualTo(3);
|
||||
assertThat(output).contains("missing.md");
|
||||
for (Path input : List.of(drafts, malformed, empty, large))
|
||||
assertThat(cli(root, "discussion", "add", "WRK-0001", "--text-file", input.toString())).as(output).isEqualTo(2);
|
||||
assertThat(new DiscussionService().list(root, "WRK-0001")).isEmpty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user