Repository navigation
feat(jq): own the experimental value boundary and native validation - #3018
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 8096b3d | Commit Preview URL Branch Preview URL |
Nov 26 2026, 12:19 AM |
f308835 to
8096b3d
Compare
There was a problem hiding this comment.
Reviewed the experimental owned jq container boundary (head 8096b3d). The core design is sound: depth + memory admission on every attach path, COW charging through require, charge-transferring iterators, resync reconciliation after growth, sticky trip checks per-output and after the run, and the feature strictly opt-in everywhere. No blocking issues. Two robustness notes below.
Comments outside the diff
crates/bashkit/src/builtins/jq/mod.rs line 671: [P2] The recorded host-budget error is never consulted when evaluation completes normally. The tick closure stores the error in interruption and returns true, but the Ok path here only checks meter.tripped() and input_error. On unwind builds this is unreachable (tick's abort(Abort::Interrupted) unwinds first), but under cfg(not(panic = "unwind")) abort() is a silent no-op for Interrupted/Recursion, so on such targets a budget overrun would be recorded and then silently dropped while evaluation continues uninterruptible. Since the wasm/browser CI rows enable experimental_jq, consider also checking the interruption cell on this path so the new hook fails closed everywhere, not just where unwinding is available. Evidence: jaq_json/meter.rs abort() only trips for Memory | Depth and only unwinds under panic = "unwind"; docs/jq.md already discloses the unwind requirement for untrusted filters.
Review summary (head
|
8096b3d to
a8cac95
Compare
What changed
Add opt-in
experimental_jqownership of array/object storage for both jq and yq, while reusing jaq's parser, evaluator and standard library. Checked construction/mutation owns depth, memory admission, COW and iterator lifetime accounting. The feature is off by default and forwarded by every embedding crate.Optimize checked array growth, COW copying, object updates and polling. Independently fix interruptibility of shared-tree comparison, hashing, containment, byte conversion and formatting in both backends.
Give the experiment first-class native validation: required Linux/macOS/Windows storage × execution-plan matrix with pinned jq 1.8.1, binding/browser tests, model properties, structured lifecycle fuzzing, coverage, ASan, Miri and reproducible paired benchmarks.
Why
Make the jq resource/value boundary a maintained Bashkit component before considering deeper evaluator ownership. An experimental feature lets us measure compatibility, safety and performance without changing release defaults.
Before / After
Shared generated trees could require exponential traversal despite a depth limit; both backends now interrupt those traversals and recover for the next request.
The initial owned implementation paid for repeated growth/scans/lookups. Alternating development measurements lowered owned array updates by 6.1%, object updates by 11.4%, array COW by 8.7%, and object COW by 4.8% against the prior owned implementation. A pinned fat-LTO stable-versus-owned benchmark shows parity on array updates/COW, object updates 1.7% faster, object COW 2.6% faster, and explicit tradeoffs for concat (+12.1%) and sort/unique (+7.2%). Raw results and methodology are committed in
crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.{json,md}.Risk
Checklist
Validation: all four jq/yq native configurations passed (1,766 tests total); script tests passed (282, 4 skipped), Miri passed 7 lifecycle cases, and the owned ASan slice passed 47 integration cases. All 12 jq/yq/lifecycle fuzz smoke configurations passed; longer owned lifecycle campaigns completed 3,620 and 2,752 executions without crashes. All-feature Clippy, Python lint, 30 security properties, 19 failpoint tests, browser Wasm and C API examples. Broad interpreter benchmarking matched Bash output on all 96 cases; parallel scaling measured 2.62×–2.97× speedups across 50-session workloads. Reports and the generated site timeline are committed. The pre-artifact CI head was green (118 passed, 1 skipped); final CI is running on the reviewed return-path and depth-inventory fixes. The canary jobs visibly fall back to stable 2.x only while Deno's canary binary URL returns 404. Both review findings were fixed; the inline thread is resolved. Local full-workspace tests hit four process cleanup assertions in this sandbox, while standard CI passed them. Local WASI needed an unavailable
clang; CI WASI passed.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.