Skip to content

Commit 406c7a2

Browse files
committed
🔧 Write this workflow against the one definition main now has
#880 collapsed the workflow definition to a single unversioned format, deleted the `<Evaluate source>` alias and restored the working directory an admitted fragment resolves against. This workflow is written against all three, and its files do not exist on `main`, so the changes that collapse requires of them could not travel with it. - `Implementation.md` and `Planning.md` write `<Evaluate text=…>`, which is now the only spelling, and carry `throwOnError` on their revision Prompts so a refused turn stops the loop instead of being read as a verdict. - `UserCheckpoint.md` asks for a closed `choice` enum — `Continue` or `Stop` — validated before anything binds, and maps it onto the existing boolean `proceed`. An answer that names neither is not an approval. - The Tier AC composition suite and the certification suite compile against the interfaces that moved: `evaluationProfile` rather than a name that never existed, the Git test-support modules by their own paths, and the `choice` enum in every checkpoint answer. The certification agent reports first-turn acceptance, which acpx requires before it will materialize a session, and the in-process scheduled resume installs the Git Plugin, because `<Repository>` and the vocabulary beside it are its declarations and nothing else declares them. - `AC3`'s frozen effect sequence gains the `workspace_file` that `<Dir>` publishes when it creates its target. The sequence was pinned before #643 made `<Dir>` ensure its directory, and this suite could not run to notice. - `SCH9` is a behavioural regression rather than a blob inventory: it changes and then deletes the original document before scheduling an ordinary resume, so it fails if anything in that path reads the filesystem instead of the run's store. - The specifications and `architecture.md` say what this revision builds, on top of the one definition format main now describes.
1 parent 2fe4dbc commit 406c7a2

11 files changed

Lines changed: 371 additions & 330 deletions

‎packages/cli/tests/workflow-scheduling.test.ts‎

Lines changed: 43 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
withResolvers,
3131
} from "effection";
3232
import type { Operation, Result } from "effection";
33-
import { rm, writeTextFile } from "@effectionx/fs";
33+
import { exists, rm, writeTextFile } from "@effectionx/fs";
3434
import { exec } from "@effectionx/process";
3535
import { mkdtemp, realpath } from "node:fs/promises";
3636
import { join } from "node:path";
@@ -958,151 +958,49 @@ describe("Tier SCH — explicit scheduled resume", () => {
958958
expect(published.every((key) => typeof Reflect.get(surface, key) === "function")).toBe(true);
959959
});
960960

961-
it("SCH9: the stacked base is the reviewed composed consumer", function* () {
962-
const toplevel = (yield* git(".", ["rev-parse", "--show-toplevel"])).trim();
963-
964-
// The exact PR #181 head this slice branched from, and the exact main base
965-
// beneath it. Recorded rather than derived: what the Planner reviewed is a
966-
// commit, not whatever this checkout happens to be on.
967-
expect(STACKED_BASE).toBe("525efaa736110f0ffcd5534985897d1db0692124");
968-
expect(STACKED_MAIN_BASE).toBe("170a021db9d551f96f1e9bfdd9ea61f74e30e44e");
969-
970-
// The consumer's file set, exactly. An addition or a deletion under the
971-
// reviewed workflow changes this list even when every surviving file is
972-
// untouched.
973-
const tracked = (yield* git(toplevel, ["ls-files", "--", ...REVIEWED_CONSUMER_ROOTS]))
974-
.split("\n")
975-
.map((line) => line.trim())
976-
.filter((line) => line.length > 0)
977-
.sort();
978-
expect(tracked).toEqual([...REVIEWED_CONSUMER].map(([path]) => path).sort());
979-
980-
// And its content, exactly. `git hash-object` reads the working tree, so
981-
// this holds whatever the checkout's history depth is — which matters,
982-
// because CI clones one commit deep and has no reviewed base to diff
983-
// against.
984-
const paths = [...REVIEWED_CONSUMER].map(([path]) => path);
985-
const hashed = (yield* git(toplevel, ["hash-object", "--", ...paths]))
986-
.split("\n")
987-
.map((line) => line.trim())
988-
.filter((line) => line.length > 0);
989-
expect(hashed).toHaveLength(paths.length);
990-
expect(Object.fromEntries(paths.map((path, index) => [path, hashed[index]]))).toEqual(
991-
Object.fromEntries(REVIEWED_CONSUMER),
992-
);
993-
});
994-
});
961+
/**
962+
* The run executes what it retained, not what is on disk now.
963+
*
964+
* Historical provenance: this slice was reviewed on PR #181 head
965+
* `525efaa736110f0ffcd5534985897d1db0692124` over `main` base
966+
* `170a021db9d551f96f1e9bfdd9ea61f74e30e44e`. Those commits are recorded here
967+
* as provenance and asserted nowhere — a file inventory pinned to them made
968+
* every later edit of the reviewed consumer a failure, while saying nothing
969+
* about what a scheduled resume actually does.
970+
*/
971+
it("SCH9: a scheduled resume completes from retained source after the original moved", function* () {
972+
yield* useReports();
973+
const root = yield* useRunStore();
974+
const fixture = yield* useDefinitionFixture();
975+
const rendered: string[] = [];
976+
yield* suspendedRun(root, fixture, rendered);
977+
yield* deliver(root, suspensionId(root));
995978

996-
/** The exact PR #181 head this slice is stacked on. */
997-
const STACKED_BASE = "525efaa736110f0ffcd5534985897d1db0692124";
979+
// The document the run started from is changed past recognition, and then
980+
// removed outright. A run that read either would render something else or
981+
// fail to resolve at all.
982+
const document = join(fixture.repository, "workflow.md");
983+
yield* writeTextFile(document, "# Not this document\n\nnothing the run retained.\n");
984+
yield* rm(document, { force: true });
985+
expect(yield* exists(document)).toBe(false);
998986

999-
/** The exact `main` base and merge base beneath it. */
1000-
const STACKED_MAIN_BASE = "170a021db9d551f96f1e9bfdd9ea61f74e30e44e";
987+
// Ordinary resume, by run id and nothing else.
988+
const resumed = yield* scheduleResume(ordinaryResume(OPTIONS, host(root), body(rendered)), {
989+
runId: RUN_ID,
990+
});
1001991

1002-
/** Where the reviewed consumer lives. */
1003-
const REVIEWED_CONSUMER_ROOTS = [
1004-
"workflows/adversarial-implementation",
1005-
"scripts/tests/adversarial-composition-workflow.test.ts",
1006-
];
992+
expect(resumed.exitCode).toBe(0);
993+
expect(runState(root)["status"]).toBe("completed");
1007994

1008-
/**
1009-
* The reviewed consumer, as this slice depends on it.
1010-
*
1011-
* Blob object ids rather than a diff: this slice must not change the workflow
1012-
* documents or the composition suite it depends on, and content identity says
1013-
* so from any checkout — including CI's, which is one commit deep and cannot
1014-
* name the base at all.
1015-
*
1016-
* The provenance below is unchanged: this slice was reviewed on PR #181 head
1017-
* `525efaa7` over `170a021d`, and it still is. What has moved since are blobs,
1018-
* and only through work reviewed in its own right — #299's R3 corrected the
1019-
* observation instruction the Implementation stage renders and extended AC2 to
1020-
* send it, and #292's final synchronization then made the workflow documents
1021-
* describe the delivered revision and added `SYNC1` beside AC0–AC7, each under
1022-
* independent Planner review. Pinning what those files hold now is what keeps
1023-
* this case a statement about *this* slice changing them rather than a
1024-
* statement about nobody changing them.
1025-
*/
1026-
const REVIEWED_CONSUMER: readonly (readonly [string, string])[] = [
1027-
[
1028-
"scripts/tests/adversarial-composition-workflow.test.ts",
1029-
"adf7e58e609c116e2f93fb97e3592bc70756f24b",
1030-
],
1031-
["workflows/adversarial-implementation/Discovery.md", "eea1c650fe5a9d417595b9b457b73dc51485f05a"],
1032-
[
1033-
"workflows/adversarial-implementation/Implementation.md",
1034-
"65333321a163f125d6021f807ac14108e049deac",
1035-
],
1036-
[
1037-
"workflows/adversarial-implementation/InstructionFiles.md",
1038-
"7ce93d7c1b7f79c560c9a861f27e7597697724d9",
1039-
],
1040-
["workflows/adversarial-implementation/Planning.md", "943cb9701e3f4a464f13606547ca319e770aecf3"],
1041-
[
1042-
"workflows/adversarial-implementation/UserCheckpoint.md",
1043-
"576e352ac232426c157a33be964402d600a545bc",
1044-
],
1045-
["workflows/adversarial-implementation/artifacts.md", "98899d95b70286851c08b5ccb10e26fd7b20e17e"],
1046-
[
1047-
"workflows/adversarial-implementation/primitives.md",
1048-
"9e66ca0df27608a3c2a6f2887db5b7cb4ed1e34a",
1049-
],
1050-
["workflows/adversarial-implementation/runtime.md", "128fb2c1337b5d78890ebc05dcfe79f7416d7f3c"],
1051-
["workflows/adversarial-implementation/start.md", "b898f95188e5e1940e0e483a9ce74e69c49a53f2"],
1052-
[
1053-
"workflows/adversarial-implementation/tests/agents/checkpoint-material-choice.md",
1054-
"c126bdfe64c227c381317bf12338e235c52e78b5",
1055-
],
1056-
[
1057-
"workflows/adversarial-implementation/tests/agents/checkpoint-no-choice.md",
1058-
"37233970d764ca28a82f2031361214a91f6279ee",
1059-
],
1060-
[
1061-
"workflows/adversarial-implementation/tests/agents/checkpoint-twice-no-choice.md",
1062-
"71b960d1d9cc68e83da4a6c88a8d799a9142cde5",
1063-
],
1064-
[
1065-
"workflows/adversarial-implementation/tests/agents/discovery.md",
1066-
"08e86c746045361ed2752ac456491d863b998348",
1067-
],
1068-
[
1069-
"workflows/adversarial-implementation/tests/agents/malformed-checkpoint.md",
1070-
"d6c73891be4f4aa845d68e20e1ec9477ac6e1556",
1071-
],
1072-
[
1073-
"workflows/adversarial-implementation/tests/agents/malformed-implementor.md",
1074-
"5e98acad2a2ad4747eda034f2221b7b4befaa2f8",
1075-
],
1076-
[
1077-
"workflows/adversarial-implementation/tests/agents/malformed-planner.md",
1078-
"c62e30f33a2e05cf69d49f11f9a8de6f85eebb10",
1079-
],
1080-
[
1081-
"workflows/adversarial-implementation/tests/agents/plan-converges-implementor.md",
1082-
"ee727a7854facfc7aee530f0c7c39ebee18fc865",
1083-
],
1084-
[
1085-
"workflows/adversarial-implementation/tests/agents/plan-converges-planner.md",
1086-
"482312813324b7d36516e87624e172e501482f8e",
1087-
],
1088-
[
1089-
"workflows/adversarial-implementation/tests/agents/revision-implementor.md",
1090-
"5e466bafef109db4444be51594b23e15da2820ec",
1091-
],
1092-
[
1093-
"workflows/adversarial-implementation/tests/agents/revision-planner.md",
1094-
"fc5b99b299de2708f378ae265c55aea66d4016ab",
1095-
],
1096-
[
1097-
"workflows/adversarial-implementation/tests/fixtures/AGENTS.md",
1098-
"5c1e220a6907494f4ec5e91aee1b321334784d3b",
1099-
],
1100-
[
1101-
"workflows/adversarial-implementation/tests/fixtures/nested/AGENTS.md",
1102-
"ab3a7ac1b96e04e81bc463f572c7b77b19a4f711",
1103-
],
1104-
[
1105-
"workflows/adversarial-implementation/tests/planning-logic.test.md",
1106-
"0f0bb56250e25be242ebaa8d93d76b44cad54e75",
1107-
],
1108-
];
995+
// It completed from the bytes the run retains: the same authored output the
996+
// document produces, rendered after its source stopped existing.
997+
expect(rendered).toHaveLength(1);
998+
expect(rendered[0]).toContain("decision: true");
999+
expect(events(root, "workspace_file")).toHaveLength(2);
1000+
1001+
// And the answer was consumed exactly once.
1002+
expect(events(root, SUSPENSION_ANSWER)).toHaveLength(1);
1003+
expect(answerRows(root)).toHaveLength(1);
1004+
expect(answerRows(root)[0]?.["state"]).toBe("consumed");
1005+
});
1006+
});

0 commit comments

Comments
 (0)