Skip to content

Commit d437949

Browse files
committed
🔀 Let one invocation create the pull request and then update it
#301's architecture amendment settles the composition the revision loop was missing. An expression prop that evaluates to `undefined` is omitted before prop validation and before the durable JSON boundary, so a document can seed a binding with an empty object and say the same thing on every iteration. The loop does that now. `let pullRequest = {}` is declared once, before the loop; the single `<PullRequest number={pullRequest.number} …>` inside it reads `undefined` on the first pass, so `number` is omitted and the unnumbered create-or-adopt contract applies; the result replaces the seed through ordinary `as` binding, and every later pass carries the retained positive number into the numbered update contract for that exact pull request. What made this necessary is unchanged: a revision commits again, so an unnumbered second request would find a pull request holding a different head and refuse it as a conflict. Two of the three pieces already work, and the probe checks both rather than assuming them — a member read on the seed yields `undefined` in an expression prop without failing, and an `as=` binding shadows the eval-declared name for later props. The third does not: the engine refuses an undefined prop today rather than omitting it. So the documents carry the omission as #301's, unbuilt, and the probe fails if that ever silently becomes true without the prose catching up. The amendment is general, and the reference state says so: required props still fail as missing, `null` stays an explicit value, and an unbound name still fails. None of it is a `PullRequest` special case, and no engine code changes here — Planning owes that proof before implementation is handed off.
1 parent 99e69a2 commit d437949

3 files changed

Lines changed: 48 additions & 28 deletions

File tree

‎specs/adversarial-implementation-workflow.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,14 @@ The exercise must resolve enough of these to implement one vertical slice:
994994
require (#369)? The evaluator itself is settled and built for observation
995995
(#497): complete preflight inside the admission, pinned identities, exact
996996
request ceilings, one retained decision, and replay held to it.
997-
3. How does a revision iteration reach the *same* pull request? The effect is
998-
settled (#295, #500, #504): an unnumbered invocation asks for one to exist
999-
and a numbered one asks for that exact open pull request to say this. What is
1000-
unsettled is the composition — a loop whose first iteration has no number to
1001-
carry and whose later iterations do (#301).
997+
3. What state makes external effects safe to repeat or resume after
998+
interruption (#297)? A revision iteration reaching the *same* pull request is
999+
settled: the effect is an upsert over one explicit identity (#295, #500,
1000+
#504), and #301's architecture amendment settles the composition — an
1001+
expression prop evaluating to `undefined` is omitted before validation and
1002+
before the durable JSON boundary, so a loop seeded with an empty object
1003+
creates on its first iteration and updates on every later one through a
1004+
single invocation. Omission is not built yet.
10021005
4. Which fetches does a review actually write? `<PullRequest>`'s result is
10031006
deliberately minimal, and `<Fetch>` (#456) is how a network-denied reviewer is
10041007
handed the rest — but no stage composes those reads yet, and the public

‎workflows/adversarial-implementation/Implementation.md‎

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ That is the whole shape of the stage: **agents inspect; XMD mutates.**
129129
```
130130
</Capture>
131131

132+
```ts eval
133+
let pullRequest = {};
134+
```
135+
132136
<Agent name={props.implementor}>
133137
<Session name="implementor">
134138
<Loop name="implementation" max={5}>
@@ -205,7 +209,12 @@ That is the whole shape of the stage: **agents inspect; XMD mutates.**
205209
<Git.Add paths="." />
206210
<Git.Commit message={proposal.commitMessage} as="commit" />
207211
<Git.Push />
208-
<PullRequest title={proposal.title} draft={true} as="pullRequest">
212+
<PullRequest
213+
number={pullRequest.number}
214+
title={proposal.title}
215+
draft={true}
216+
as="pullRequest"
217+
>
209218
{proposal.report}
210219
</PullRequest>
211220

@@ -474,27 +483,33 @@ commit and replaying a completed push performs no remote mutation; resuming
474483
after uncertain completion reconciles against retained state rather than
475484
repeating the effect (#294, #297).
476485

477-
**The upsert is settled, and this markup does not yet reach it.** #500 and #504
478-
settle what `<PullRequest>` does: without `number` it asks for *a* pull request
479-
from this head to this base, creating one or adopting the compatible one an
480-
interrupted earlier attempt created; with `number` it asks for *that* pull
481-
request, and brings its title, body, draft state and base to what the invocation
482-
says. Which of the two it is, is the document's own word rather than a search.
483-
484-
The markup above passes no `number`, and a revision iteration commits again — so
485-
the head SHA it asks about is not the head SHA the existing pull request holds.
486-
An unnumbered request that finds an open pull request for the branch pair saying
487-
anything else is a **conflict**, deliberately: it asked for one to exist, not for
488-
whatever is there to become this, and rewriting it would act on a pull request
489-
the document never named.
490-
491-
Reaching update mode means carrying the bound `pullRequest.number` from the
492-
first iteration into `number=` on the next. `<Loop>` opens no binding scope, so
493-
a later iteration can read what an earlier one bound — but the first iteration
494-
has nothing to read, and no settled composition writes "numbered after the first
495-
time" without inventing a guard over an unbound name. That integration is
496-
**#301's supervised composition**, and this document leaves the markup unchanged
497-
rather than choose a spelling for it.
486+
**One invocation creates and updates.** #500 and #504 settle what
487+
`<PullRequest>` does: without `number` it asks for *a* pull request from this
488+
head to this base, creating one or adopting the compatible one an interrupted
489+
earlier attempt created; with `number` it asks for *that* pull request, and
490+
brings its title, body, draft state and base to what the invocation says. Which
491+
of the two it is, is the document's own word rather than a search.
492+
493+
A revision iteration commits again, so the head it asks about is not the head
494+
the existing pull request holds — which is why an unnumbered second request
495+
would be a **conflict** rather than an update: it asked for one to exist, not
496+
for whatever is there to become this. The loop therefore says which one it
497+
means. `let pullRequest = {}` seeds the binding once, before the loop; on the
498+
first iteration `pullRequest.number` is `undefined`, so `number` is omitted and
499+
the unnumbered create-or-adopt contract applies; the successful result replaces
500+
the seed through ordinary `as` binding, and every later iteration passes the
501+
retained positive number and selects the numbered update contract for that exact
502+
pull request. `<Loop>` opens no binding scope, which is what lets one iteration
503+
read what the previous one bound.
504+
505+
The engine contract underneath it is **#301's, and not built yet**: an
506+
expression prop evaluating to `undefined` is omitted before prop validation and
507+
before the durable JSON boundary, so the component never receives `undefined`
508+
and no journal or replay stores it. A required prop that evaluates to
509+
`undefined` still fails validation as missing, `null` stays an explicit value
510+
passed only where a schema accepts it, and an unbound name still fails. Today
511+
the engine refuses such a prop instead of omitting it, so this is the one part
512+
of the loop that does not run yet.
498513

499514
## The reviewer sees what it judges
500515

@@ -615,7 +630,8 @@ revision turn, or acceptance.
615630
| `<Expand>` | #369 | unbuilt; public name open. The evaluator under it is shipped (#497), for observation only |
616631
| `<Issue>` | #296 | unbuilt |
617632
| `<Git.Push>` | delivered by #495 | shipped — registered by the workflow host |
618-
| `<PullRequest>` | #295, delivered by #500 and #504 | shipped — registered by the workflow host; carrying its number into a revision is #301's |
633+
| `<PullRequest>` | #295, delivered by #500 and #504 | shipped — registered by the workflow host |
634+
| omitting an expression prop that evaluates to `undefined` | #301 | unbuilt — the loop's `number={pullRequest.number}` depends on it |
619635
| `<Git.Add>`, staged-only `<Git.Commit>` | #294 | shipped |
620636
| shared Git-host reconciliation behind push, pull request and issue | #297 | shipped — the surface, and now the push and pull-request components over it |
621637
| the forge read that returns reviews, comments and checks | `<Fetch>` (#456) | shipped — this stage does not write it yet |

‎workflows/adversarial-implementation/primitives.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ trusted-host API, and no document calls it.
450450
| prove the shipped planning-document logic | #290 | this change — the proof lands here; #290 closes on delivery |
451451
| a root's declared component bundle, resolved from its pinned commit | #301 slice, delivered by #493 | shipped |
452452
| compose the supervised workflow — scheduling the loop, continuing it unattended | #301 | open |
453+
| omit an expression prop that evaluates to `undefined`, before validation and before the durable JSON boundary | #301 | open — architecture settled; `Implementation`'s one-invocation pull-request loop depends on it |
453454
| typed durable answer delivery to a suspended run | #300 | shipped — delivery is non-executing; automatic scheduling is not shipped |
454455
| default-on secret rejection before journal persistence | #199 | open — guard and scanner built |
455456
| certify interruption, replay, authority, reconciliation, and cross-runtime behavior | #299 | open |

0 commit comments

Comments
 (0)