diff options
| author | t <t@tjp.lol> | 2026-08-17 23:35:36 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-08-18 00:40:46 -0600 |
| commit | 372ef8ff40991644ec2654c61328f31779f4ad21 (patch) | |
| tree | 9bc69a578995e14f154202badcdbe0021a39c467 /spec/test_workflow.lua | |
| parent | 7f8fdd8e868fb5fad71eacdf0c4fd0a97fe9c6ee (diff) | |
Validation-pass fixes; DESIGN.md describes the shipped seam
jobs: a child whose wake pipe cannot be armed is refused up front instead of
started into a state nothing can wake (the luv-less drain loop survives only
for hosts without a loop); a closing child keeps its concurrency slot and
its id's exclusivity until the pump actually exits, so teardown can no
longer over-admit new children or let two turns share one session file.
Resume-metadata reads honor the plain-error contract on a malformed store.
workflow: the built-in schema subset validator is the only validator — the
jsonschema probe made behavior depend on an undeclared rock (see rockspec:
that dependency is deliberately rejected); dead exports and the unreachable
half of the structured-output guard are gone, keeping the empty-arguments
provider case.
DESIGN.md's seam sections now describe the shipped division: binding-level
async jobs and tool control, host-level resolve_model/ExtHost/turn events/
component handles, rock-level policy; protocol bodies run to completion on
the loop thread and cannot yield, cancellation is scoped to the stream that
opened it, and a child's compaction leaves protocol sessions alone.
Diffstat (limited to 'spec/test_workflow.lua')
| -rw-r--r-- | spec/test_workflow.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/test_workflow.lua b/spec/test_workflow.lua index c5ba06c..5d58c01 100644 --- a/spec/test_workflow.lua +++ b/spec/test_workflow.lua @@ -231,6 +231,53 @@ return { end) end }, + -- One validator, always the built-in one: a schema must not be judged by + -- whether an undeclared rock happens to be installed on this machine. + { "validation never consults the jsonschema rock", function() + if not json_available() then + return "skip", "dkjson is not installed" + end + local restore = package.loaded.jsonschema + package.loaded.jsonschema = { + generate_validator = function() + return function() + return false, "the rock must not be consulted" + end + end, + } + local ok, err = pcall(with_host, function(handle, profiles) + handle.queue_for("alpha", { structured_json = '{"items":["x"]}' }) + local result = workflow.execute(workflow.workflow(function(ctx) + return ctx:agent({ + agent = "alpha", + prompt = "split it", + output = { schema = ITEMS_SCHEMA }, + }):await() + end), "input", { profiles = profiles }) + assert(result.status == "completed", tostring(result.error)) + assert(result.output.items[1] == "x", "the built-in validator accepted it") + end) + package.loaded.jsonschema = restore + if not ok then + error(err, 0) + end + end }, + + { "a structured worker whose output tool carried no arguments fails as missing", function() + with_host(function(handle, profiles) + handle.queue_for("alpha", { structured_json = "" }) + local result = workflow.execute(workflow.workflow(function(ctx) + return ctx:agent({ + agent = "alpha", + prompt = "split it", + output = { schema = ITEMS_SCHEMA }, + }):await() + end), "input", { profiles = profiles }) + assert(result.status == "failed", tostring(result.status)) + has(result.error, "structured output missing") + end) + end }, + { "a structured worker that answers in prose fails", function() with_host(function(handle, profiles) handle.queue_for("alpha", { output = "prose, not a tool call" }) |
