feature: run2 builtin with structured response record#499
Merged
Conversation
eb9603c to
2d92713
Compare
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
6 tasks
f69d077 to
714a31d
Compare
Adds Builtin::Run2 to the enum, from_name/name mappings, the ALL stable-tag slice, the vm tree-bridge eligible table, and the tree_bridge_returns_result set. On-wire tag is appended last so all existing tags are stable.
Adds run_spawn_structured (non-wasm + wasm stubs) that captures
stdout/stderr with the same 10 MiB cap and concurrent drain as
run_spawn, then returns Ok(Record{stdout:t; stderr:t; exit:n}) where
exit is f64 (-1.0 for signal-killed). Interpreter dispatch added
alongside existing run handler; argv validation is identical.
Adds ("run2", &["t", "L t"], "R RunResult t") to BUILTIN_SIGS and a
"run2" match arm in the builtin type-inference function. Emits
ILO-T013 with contextual hints when cmd or args types mismatch,
mirroring the existing run case. Return type is R RunResult t.
Covers echo (stdout populated), false (exit 1 as number), true (exit 0), numeric exit pattern match, and nonexistent command returning Err. Exercises all shapes the examples_engines harness runs across tree and VM.
Updates the I/O builtins table in SPEC.md, expands the Process spawn section to document both run and run2 with examples, updates the ilo-builtins-io.md skill with a Process spawn subsection, and adds the CHANGELOG entry. ai.txt regenerated from SPEC.md via build.rs.
714a31d to
3cd12f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run2 cmd:t args:L t > R RunResult t- a structured process spawn that returns a typedRecord{stdout:t; stderr:t; exit:n}instead of the looseM t tmap thatrunreturnsexitis a number (n), not text, so=0 r.exit,<0 r.exitwork without string conversionrun; Err only on spawn failurerununchanged for compatibilityRepro before/after
Before: accessing exit code required
mget m "code"thennum codethen comparing as number. Loose Map meant no dot-access ergonomics.After:
What's in the diff
add Run2 builtin variant, tree-bridge, and on-wire tag- enum,from_name,name,ALLslice (appended, tag stable), tree-bridge eligible +tree_bridge_returns_resultimplement run2 interpreter: run_spawn_structured returns typed Record-run_spawn_structurednon-wasm + wasm stub, interpreter dispatch, argv validationadd run2 verifier: signature table entry and type-check case-BUILTIN_SIGS, type inference match arm,ILO-T013hintsadd examples/run-structured.ilo with run:/out: annotations- echo stdout, false exit, true exit, numeric pattern match, nonexistent Errdocs: sync run2 to SPEC.md, ai.txt, skill, and CHANGELOG- SPEC Process spawn section updated, skill subsection added, ai.txt regeneratedTest plan
RunResultrecord shape, stdout text, false exit (1.0), true exit (0.0), stderr capture, exit as Number not Text, nonexistent command returns Errexamples/run-structured.iloruns clean in examples_engines harnesscargo fmt --checkpassesFollow-ups
-1.0; could expose the signal number in a futurerun3with 4-field recordrun2 cmd args stdin:t) deferred to a follow-up per spec comment inrun