Skip to content

Commit e6d7cff

Browse files
committed
📝 Let the root be what settles this workflow's failures
The target still described the pre-#453 engine: `print` installed by the root, so a failure the document did not decide was printed into its own text and the run carried on. A text root now installs the fail-capable `output` mode for its whole body, and `<Output>` selects which regions render rather than deciding whether a failure counts. The consequence the reader most needs is the instruction files. A failed `<File>` read is still a component-owned printed error, but the stage cannot hand back a body holding one: `InstructionFiles as="instructions"` binds nothing, and the refusal is raised in the root's own body, where it is now the run's outcome. Discovery never starts and nothing after it does, so an unreadable AGENTS.md ends this workflow rather than being visible and survivable as the documents claimed. #327 stays as it was and stays distinct — an outer `<PrintErrors>` still does not print a failure a callee's `<Output>` region decided, which is a limitation of the printing boundary rather than of root settlement, and nothing here depends on it. #446's ownership rule is untouched: a caller's projected failure is still the caller's.
1 parent 053ed80 commit e6d7cff

3 files changed

Lines changed: 73 additions & 33 deletions

File tree

‎specs/adversarial-implementation-workflow.md‎

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,14 @@ boundary as data or it does not cross at all.
344344
### A stage fails rather than returning a half-record
345345

346346
The two component kinds fail differently, and neither can hand a caller a
347-
half-record.
347+
half-record. Whatever they hand back, the workflow root is where an uncaught
348+
failure is settled, and a text root settles it: the fail-capable `output` mode is
349+
installed for the root's whole body, by every text root and by every `<Output>`
350+
region alike, so an undecided failure no printing boundary handled ends the
351+
document execution whether or not the root declares `<Output>` (#453, shipped).
352+
`<Output>` selects which regions render and buffers a root that declares one; it
353+
decides nothing about whether a failure counts. Printing and continuing is asked
354+
for with `<PrintErrors>`, and this workflow writes none.
348355

349356
A **text component** is split by its `<Output>` boundary: the region inside runs
350357
under the `output` error mode, everything outside is documentation and runs
@@ -355,16 +362,21 @@ differently as a result.
355362
result. A failed prompt is raised there — `throwOnError` is what raises it — and
356363
`throw` ends the document execution.
357364

358-
`InstructionFiles` is the other way round: its `<Each>` and `<File>` reads *are*
359-
its `<Output>` region. `<File>` prints its own failures rather than propagating
360-
them, so an unreadable instruction file becomes a printed error and the region's
361-
`output` mode never decides anything. Execution continues, and what stops the
362-
caller from proceeding on nothing is the binding rule: `as` refuses a body
363-
holding a printed error, so `instructions` stays unbound and the error surfaces
364-
at the invocation rather than inside the text a prompt would quote.
365-
366-
That difference is worth knowing before relying on either: a missing instruction
367-
file is visible and non-fatal, while a failed discovery prompt is fatal.
365+
`InstructionFiles` takes a longer route to the same end. Its `<Each>` and
366+
`<File>` reads *are* its `<Output>` region, and `<File>` prints its own read
367+
failures rather than propagating them, so an unreadable instruction file starts
368+
as a component-owned printed error that the region's `output` mode never has to
369+
decide. What the stage then hands back is a body holding that printed error — and
370+
the binding rule refuses it. `InstructionFiles as="instructions"` binds nothing,
371+
and the refusal is raised at the invocation, in the workflow root's own body.
372+
373+
A text root is fail-capable, so that is where it ends. The refusal is the run's
374+
outcome: `Discovery` never starts, no later stage starts, `xmd run` exits
375+
nonzero, and a replay reports the same determined failure (#453, shipped). What
376+
the root had already rendered still reaches the output stream. So the two stages
377+
differ in where the failure is decided, not in whether it is fatal — an
378+
unreadable instruction file ends this workflow exactly as a failed discovery
379+
prompt does.
368380

369381
A **value component** declares `returns`, so it renders nothing and cannot
370382
contain `<Output>` at all — that would be a structural error. Its entire body
@@ -397,9 +409,12 @@ survive a failed region asks for that at the scope it means, with
397409
`<PrintErrors>`.
398410

399411
Printing an `output` decision is settled contract that the engine has not built
400-
yet: an outer `<PrintErrors>` around a region that failed under `output` ends the
401-
document execution instead of printing it (#327). That limitation is distinct
402-
from the ownership rule above and remains open. No stage depends on it today.
412+
yet: an outer `<PrintErrors>` does not print a failure a callee's `<Output>`
413+
region already decided, and ends the document execution instead (#327). That
414+
limitation belongs to the printing boundary alone. It is distinct from the
415+
ownership rule above, and distinct from root settlement, which decides an
416+
*uncaught* failure and is built. It remains open, and no stage depends on it
417+
today.
403418

404419
`throwOnError` on a `<Prompt>` is required for the same reason: without it a
405420
failed prompt records its failure and returns its text, raising nothing for the

‎workflows/adversarial-implementation/primitives.md‎

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,23 @@ structure and read where an error is raised:
9595

9696
| Mode | An undecided error… | Installed by |
9797
| --- | --- | --- |
98-
| `print` | is printed into the document; execution continues | the root; `<PrintErrors>`; `printErrors(fn)` |
99-
| `output` | fails the document execution; `<PrintErrors>` can print instead | every `<Output>` region |
98+
| `print` | is printed into the document; execution continues | `<PrintErrors>`; `printErrors(fn)` |
99+
| `output` | fails the document execution; `<PrintErrors>` can print instead | every text root; every `<Output>` region |
100100
| `throw` | fails the document execution, and no printing boundary replaces it | documentation; value roots |
101101

102+
**Printing is asked for, and a root asks for nothing.** A text root is
103+
fail-capable: it installs `output` for its whole body, so an uncaught, undecided
104+
failure is the document execution's own outcome whether or not the root declares
105+
`<Output>` (#453, shipped). `<Output>` selects which regions render and buffers a root that
106+
declares one; it decides nothing about whether a failure counts, and a root that
107+
declares none settles a failure on exactly the same terms. Continuing past one is
108+
requested explicitly, with `<PrintErrors>`. `printErrors(fn)` still speaks only
109+
for the component that declared it.
110+
102111
A failing region keeps what it had already rendered: that text reaches the
103-
output stream, and nothing after the failure does.
112+
output stream, and nothing after the failure does. The failure is retained and a
113+
replay reports the same determined failure without re-executing anything, and
114+
`xmd run` exits nonzero.
104115

105116
Content a caller projects is read from the same table, at the row for the region
106117
the *element* is written in. A component's `printErrors(fn)` declaration speaks
@@ -109,8 +120,8 @@ a projected failure the component does not recover from passes outward wherever
109120
the caller's region does not print, and what the projection rendered first goes
110121
to the caller's region — once, never twice, because a component that recovers or
111122
returns owns that text and hands over none of it (#446). Asking a component for a
112-
directory, a parsed value, or a written file therefore never reopens a path an
113-
`<Output>` region closed.
123+
directory, a parsed value, or a written file therefore never reopens a path the
124+
caller's region closed — an `<Output>` region or the root itself.
114125

115126
A **text component**'s body is split by its `<Output>` boundary: the region
116127
inside runs under `output`, everything outside is documentation and runs under
@@ -124,12 +135,14 @@ document handle a failure instead of ending on it; both are defined and unbuilt.
124135

125136
**Missing: printing an `output` decision.** The `output` row above is the
126137
settled contract, and the engine does not meet it yet — an outer
127-
`<PrintErrors>` around a region that failed under `output` ends the document
128-
execution instead of printing it ([issue
138+
`<PrintErrors>` does not print a failure a callee's `<Output>` region already
139+
decided, and ends the document execution instead ([issue
129140
#327](https://github.com/taras/executable.md/issues/327)). That is a limitation
130-
of the printing boundary, distinct from which region owns a projected failure,
131-
and it remains open. Nothing in this workflow writes `<PrintErrors>`, so no stage
132-
depends on it today; a stage that wanted to survive a failed region would.
141+
of the printing boundary alone. It is distinct from which region owns a
142+
projected failure, and distinct from root settlement, which decides an *uncaught*
143+
failure and is built. It remains open. Nothing in this workflow writes
144+
`<PrintErrors>`, so no stage depends on it today; a stage that wanted to survive
145+
a failed region would.
133146

134147
## What the workflow already writes
135148

‎workflows/adversarial-implementation/start.md‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,15 @@ dotted `{props.name}` traverses the validated props namespace.
313313

314314
## Error modes in a stage
315315

316-
How a component fails depends on which kind it is.
316+
This document is a text root, and a text root is fail-capable. The `output` error
317+
mode is installed for its whole body — by every text root and by every
318+
`<Output>` region alike — so an uncaught, undecided failure anywhere above is
319+
this run's outcome, whether or not the `<Output>` at the end of the flow exists
320+
(#453, shipped). That `<Output>` selects which regions render and buffers the
321+
emission; it decides nothing about whether a failure counts. Printing and
322+
carrying on is asked for with `<PrintErrors>`, and this workflow writes none.
323+
324+
Within that, how a component fails depends on which kind it is.
317325

318326
A **text component** — `InstructionFiles` and `Discovery` — is split by its
319327
`<Output>` boundary:
@@ -325,14 +333,18 @@ A **text component** — `InstructionFiles` and `Discovery` — is split by its
325333
error there fails the document execution too, though a `<PrintErrors>` region
326334
may print it instead. Either way the region keeps what it had already rendered
327335
— that partial text reaches the output stream, and nothing after the failure
328-
does. Printing an `output` decision is the contract; the engine does not do it
329-
yet (#327).
330-
331-
"Undecided" is the operative word. `InstructionFiles` puts its `<File>` reads in
332-
its `<Output>` region, and `<File>` prints its own failures, so an unreadable
333-
instruction file is already decided as a printed error and the region's mode
334-
never sees it. Execution continues; what stops the caller is that `as` refuses a
335-
body holding a printed error, so `instructions` stays unbound.
336+
does. Printing a decision a callee's `<Output>` region already made is the
337+
contract; the engine does not do it yet (#327), and nothing here needs it.
338+
339+
"Undecided" is the operative word, and `InstructionFiles` is where it shows.
340+
Its `<File>` reads sit in its `<Output>` region, and `<File>` prints its own read
341+
failures, so an unreadable instruction file is already decided as a
342+
component-owned printed error and that region's mode never sees it. The stage
343+
still cannot hand its caller a usable result: `as` refuses a body holding a
344+
printed error, so `InstructionFiles ... as="instructions"` binds nothing and the
345+
refusal is raised here, in this root's own body. Being fail-capable, this root
346+
settles it — `Discovery` never starts, nothing after it starts, and the run ends
347+
nonzero with whatever was already rendered preserved.
336348

337349
A **value component** — `UserCheckpoint`, `Planning`, `Implementation` — has no
338350
such split. Declaring `returns` means it renders nothing, so `<Output>` inside

0 commit comments

Comments
 (0)