Describe the supported task connection flow

Document submission and provider connection directly. Exercise strict Runner field validation with a generic unknown field.

Verified all 18 focused task runtime and worker contract tests.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Nicky LeachandPaperclip committed 2026-10-08 08:17:58 -07:00
1 parent b3799c335f
commit 6ce925f3c9
2 files changed
+3 -5

No files matched your search

+2 -4
View File
@@ -40,10 +40,8 @@ opaque strings; each provider owns its addressing constraints.
- `stop`: requests cancellation of the task. An accepted request is not a process
termination receipt. Reconcile status before treating execution as stopped.
This contract supports provider ingress only. Submit the task, wait until it is
running, then request `connection` and connect to its WSS endpoint with the
returned headers. `submit` does not accept a callback URL; Runner-initiated
outbound connections are outside this contract.
Submit the task, wait until it is running, then request `connection` and connect
to its WSS endpoint with the returned headers.
Submission, completion and stop return `accepted`. Acceptance does not imply
readiness or success. Status and connection return distinct typed results. Every
@@ -111,7 +111,7 @@ describe("typed environment task admission", () => {
});
it("validates operation and result shape without making acceptance mean readiness", () => {
expect(environmentTaskOperationSchema.safeParse({ ...submit, surprise: true }).success).toBe(false);
expect(environmentTaskOperationSchema.safeParse({ ...submit, runner: { ...submit.runner, connectUrl: "wss://coordinator.example.test/connect" } }).success).toBe(false);
expect(environmentTaskOperationSchema.safeParse({ ...submit, runner: { ...submit.runner, unknownField: true } }).success).toBe(false);
expect(() => parseEnvironmentTaskResult({ kind: "status" }, "attempt-1", { kind: "accepted", taskId: "attempt-1" })).toThrow();
expect(parseEnvironmentTaskResult(submit, "attempt-1", { kind: "accepted", taskId: "attempt-1" }).kind).toBe("accepted");
});