Skip to content

Commit 9f63f29

Browse files
committed
📝 Prove the generated Dir executed, and say what each observable supports (#643)
Comment and evidence corrections. No production behavior changes. WGAC17's shared setup now reads the retained ordered `workspace_file` effects and requires an `ensure-directory` for `/generated` ahead of the nested write to `/generated/inside.md`. That is what says the generated `<Dir>` actually ran under the current admission — the fragment's text says what was asked for, and only the committed order says what happened. Pointing it at a target the run never ensures fails both cases, since the setup guards each. The comments now claim only what their observables support. This test proves the generated Dir effect occurred and that resuming publishes no further effect or root. WF26 proves a completed `<Dir>` replay makes no second low-level `mkdir` call. Root invariance proves neither: an ensure finding the directory already there would publish no root either. The former-identity case no longer claims anything about a second creation — it establishes refusal before generated execution or publication, which is its whole subject. The control's name said "does not create again", which is WF26's claim rather than this one's; it now names what it proves. Two stale comments removed: ORC6's header still said the nested `<File>` landing observes ordering, which the probe beneath it contradicts, and HF26 carried its pre-revision two-case explanation above the corrected four-case one.
1 parent 62f0a89 commit 9f63f29

3 files changed

Lines changed: 39 additions & 31 deletions

File tree

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

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,13 +1515,9 @@ the retained note
15151515
// not silently receive the wider authority.
15161516
//
15171517
// Two halves, and neither is evidence alone. The control shows the current
1518-
// admission really does resume and really does not create again — without it,
1519-
// the refusal below could be a run that was broken for some other reason. The
1520-
// refusal shows the former identity is what stops it.
1521-
//
1522-
// The counter is the low-level `mkdir`, not the retained effect count: a
1523-
// replay that restored its record while quietly creating the directory a
1524-
// second time would leave the effect count unchanged and still be wrong.
1518+
// admission really does execute its generated `<Dir>` and really does resume
1519+
// — without it, the refusal below could be a run that was broken for some
1520+
// other reason. The refusal shows the former identity is what stops it.
15251521
function* wgac17(
15261522
store: string,
15271523
): Operation<{ runId: string; path: string; rendered: string[]; calls: AgentCalls }> {
@@ -1546,10 +1542,26 @@ the retained note
15461542

15471543
const suspended = retained(path);
15481544
expect(suspended.status).toBe("suspended");
1549-
// The admission carries the versioned identity, and the generated Dir made
1550-
// its directory exactly once.
1545+
// The admission carries the versioned identity.
15511546
expect(readRecords(path).some((record) => record.includes("dir-v2#Dir"))).toBe(true);
15521547

1548+
// And the generated `<Dir>` really executed before the run suspended: the
1549+
// retained file effects hold an ensure for `/generated` ahead of the nested
1550+
// write beneath it. Read from the committed order rather than from the
1551+
// fragment's text, because the text says what was asked for and the order
1552+
// says what happened.
1553+
const files = orderedEffects(path)
1554+
.filter((effect) => effect.type === FILE_EFFECT)
1555+
.map((effect) => effect.name);
1556+
const ensured = files.findIndex(
1557+
(name) => name.startsWith("ensure-directory:") && name.endsWith(":/generated"),
1558+
);
1559+
const wrote = files.findIndex(
1560+
(name) => name.startsWith("write:") && name.endsWith(":/generated/inside.md"),
1561+
);
1562+
expect(ensured).toBeGreaterThanOrEqual(0);
1563+
expect(wrote).toBeGreaterThan(ensured);
1564+
15531565
yield* manage(
15541566
{
15551567
action: "answer",
@@ -1563,7 +1575,7 @@ the retained note
15631575
return { runId, path, rendered, calls };
15641576
}
15651577

1566-
it("WGAC17: the current admission resumes and does not create again", function* () {
1578+
it("WGAC17: the current admission executes Dir, resumes, and publishes nothing further", function* () {
15671579
const store = yield* useRunStore();
15681580
const { runId, path, rendered, calls } = yield* wgac17(store);
15691581
const atSuspension = counts(path);
@@ -1580,17 +1592,21 @@ the retained note
15801592
expect(resumed.exitCode).toBe(0);
15811593
expect(retained(path).status).toBe("completed");
15821594
expect(rendered).toHaveLength(1);
1583-
// And publishes nothing further: no additional effect, and no new Workspace
1584-
// root. That is the claim these two observables support and the whole of
1585-
// it — root invariance means no *published mutation*, not that no
1586-
// low-level call was made. An ensure that found the directory already there
1587-
// would publish no root either, so this cannot stand in for a call count.
1595+
// And the resume publishes nothing further: no additional effect, and no
1596+
// new Workspace root.
1597+
//
1598+
// That is exactly what these two observables support, and no more. Root
1599+
// invariance does not prove that no low-level ensure ran — an ensure
1600+
// finding the directory already there would publish no root either. The
1601+
// low-level call count is WF26's, which decorates `mkdir` and counts it
1602+
// directly; it is not reachable from this harness, because the CLI host
1603+
// fixes the private workspace options to `{}` (`run-host.ts`) and threading
1604+
// a decorator through would mean changing a production signature for a
1605+
// test.
15881606
//
1589-
// The call count belongs to WF26, which decorates `mkdir` and counts it
1590-
// directly. It is not reachable here: the CLI host fixes the private
1591-
// workspace options to `{}` (`run-host.ts`), and threading a decorator
1592-
// through would mean changing a production signature for a test. What this
1593-
// case adds is that the current generated admission actually resumes.
1607+
// What this case establishes is the pair WF26 cannot: that the generated
1608+
// `<Dir>` effect occurred under the current admission, and that resuming
1609+
// that admission publishes no further effect or root.
15941610
expect(workspaceRootState(path)).toEqual(rootsAtSuspension);
15951611
expect(counts(path)).toEqual(atSuspension);
15961612
});
@@ -1618,9 +1634,8 @@ the retained note
16181634
pinnedBody(rendered),
16191635
);
16201636

1621-
// Refused, and before anything generated ran: no further effect of any
1622-
// kind was committed, no Workspace root was published, and no directory was
1623-
// created a second time.
1637+
// Refused, and before anything generated ran: no further effect of any kind
1638+
// was committed and no Workspace root was published.
16241639
expect(resumed.exitCode).not.toBe(0);
16251640
expect(counts(path)).toEqual(beforeResume);
16261641
expect(workspaceRootState(path)).toEqual(rootsBeforeResume);

‎packages/runtime/tests/host-files.test.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,11 +1226,6 @@ describe("host Files — making a directory exist", () => {
12261226
expect(yield* entries(target)).toEqual(["kept.txt", "sub"]);
12271227
});
12281228

1229-
// HF26: a file where a directory was asked for is a mistake to report, never
1230-
// a thing to remove. Both positions are covered — the target itself, and an
1231-
// intermediate on the way to it — because they refuse through different code:
1232-
// the target is classified here, the intermediate is the platform's ENOTDIR
1233-
// carried into the shared vocabulary.
12341229
// HF26: a non-directory is a mistake to report, never a thing to remove. The
12351230
// matrix is four cases, not two: the entry may be a regular file or a
12361231
// supported special one, and it may stand at the target or on the way to it.

‎packages/workflow/tests/run-composition-ambient.test.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,7 @@ function selectionProbe(seen: (RepositorySelection | undefined)[]): ComponentReg
551551
}
552552

553553
describe("ORC6 — Dir makes the directory it names", () => {
554-
// ORC6: the ordering claim and the two path rules, in one document. The
555-
// `<File>` inside can only land if the directory was already there, so
556-
// ordering is observed from the outcome rather than asserted about the code.
554+
// ORC6: the ordering claim and the two path rules, in one document.
557555
it("ORC6: creates missing parents, keeps an absolute path, and finishes before content", function* () {
558556
const root = yield* useManagedRoot();
559557
const checkout = (yield* useOriginlessCheckout()).root;

0 commit comments

Comments
 (0)