Repository navigation
Conversation
This was referenced Oct 1, 2026
dnagoda
force-pushed
the
dc.batch-jsonl
branch
from
October 1, 2026 21:52
1eaf732 to
df700b9
Compare
dnagoda
added this pull request to stack #622
October 2, 2026 16:05
dnagoda
force-pushed
the
dc.batch-jsonl
branch
from
October 2, 2026 16:13
df700b9 to
c31a07a
Compare
dnagoda
force-pushed
the
dc.batch-jsonl
branch
2 times, most recently
from
October 2, 2026 16:50
a826658 to
056ca6a
Compare
dnagoda
marked this pull request as ready for review
October 2, 2026 16:52
dnagoda
force-pushed
the
dc.batch-jsonl
branch
from
October 2, 2026 21:35
056ca6a to
b6b37e2
Compare
`--batch` runs one Function against many inputs in one process. It reads JSON Lines from `--input` or stdin and writes one JSON record per input line to stdout. The Function module, its provider, and the optional schema and query are loaded once, so each input pays only for the run. - Each record has the 1-based input `line`, so records match inputs even when blank lines are skipped. - Records are written with serde, so errors with quotes or newlines stay valid JSON Lines. - By default the batch stops at the first failed input. `--batch-continue-on-error` runs all inputs. The exit code is non-zero if any input failed. - `--batch-full-output` writes the full run result for each input. - A summary goes to stderr. `BluejaySchemaAnalyzer::with_analyzer` parses the schema and query once and computes the scale factor for each input.
Batch mode moved the input read below schema loading and Function compilation for every run, so a run with both a bad input and a bad Function reported the Function error instead of the input error. Read the whole input first again when the run is not a batch. Only batch mode defers the read, because it streams the input line by line.
Full batch records serialized FunctionRunResult, whose BytesContainer
flattens its JSON value into the parent. That serializer rejects arrays,
strings, and booleans, changes null to {}, and writes numbers as
{"$serde_json::private::Number":"123"}. Output that is not valid JSON
became {} instead of null.
Write the full record fields directly, with input and output taken from
their JSON values, the same as minimal records. Single runs keep the
existing serializer.
--batch accepted --json and ignored it, so a caller who asked for the full result silently got minimal records. Fail with a usage error that points to --batch-full-output instead.
with_analyzer parses the schema and query; it does not check the query against the schema. Say so, and note that analyze can also fail when it cannot select an operation in the query.
dnagoda
force-pushed
the
dc.batch-jsonl
branch
from
October 6, 2026 21:34
b6b37e2 to
d46b3be
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.
Why
To test a Function against many inputs today (a regression suite, recorded inputs, or fuzzing), you start
function-runneronce per input. Each process loads and compiles the Function and its provider again before it runs one input. Startup costs much more than the run itself.1,000 inputs, release build, Apple M4 Pro, Wasmtime compilation cache warm:
main, v9.2.2)--batch, one processexit_code.wasm(Rust, WASI)js_function_javy_plugin_v3.wasm(Javy plugin)That is about 110x faster for the Rust fixture and about 250x faster for the Javy fixture.
What
--batchreads JSON Lines from--inputor stdin and runs the Function once for each non-blank line. The Function module is compiled once, and #619's provider cache compiles the provider once. Each input gets a new store and instance, so state does not carry over between inputs.For each input, the runner writes one JSON record on one line to stdout:
{"line":1,"success":true,"instructions":5069,"memory_usage":1088,"logs":"","output":{"exit":0}} {"line":2,"success":false,"instructions":5069,"memory_usage":1088,"logs":"module exited with code: 1","output":{"exit":1}} {"line":3,"success":false,"error":"Invalid input JSON: EOF while parsing a value at line 2 column 0"}lineis the 1-based input line number. Blank lines are skipped, and you can still match each record to its input.outputisnullandoutput_errorgives the reason. This matches single-run mode, where that run still counts as successful.--batch-full-outputwrites the same fields as--json, plusline.Failure handling:
--batch-continue-on-errorruns all inputs.0only if every input succeeds. A failed input means the Function failed (success: false) or the input could not run.Batch complete: 4 inputs processed, 2 successful, 2 failed.CLI rules:
--batch-continue-on-errorand--batch-full-outputrequire--batch.--batchcannot be used with the profiling flags.--schema-pathand--query-pathwork with--batch. The newBluejaySchemaAnalyzer::with_analyzerparses and validates the schema and query once, then computes the scale factor for each input. With a 4,451-line Payment Customization Function API schema, 1,000 inputs tonoop.wasmtake 0.06 s. Parsing again for each input takes 0.23 s.The README documents the input format, the record format, exit codes, and
with_analyzer.Single-run mode does not change.
Testing
cargo test --locked: 35 unit tests and 36 integration tests pass; one existing test remains ignored.with_analyzerwith many inputs.cargo clippy --locked -- -D warningsandcargo fmt --all -- --checkpass.