Repository navigation
Add a Rust SDK and the four example projects - #23
Merged
Merged
Conversation
jacquard_host::sdk prepares and caches checked programs with Core's public commands, maps native Rust values through Encode and Decode (record! and variants! for application types, Dynamic for untyped code), binds closures to exact operation identities, checks arguments against the checked signature before a worker starts, and keeps each invocation's raw evidence. map_batches runs explicit batches. The quickstart, planner, triage, and fulfillment projects run as `cargo run --example jacquard-examples`, with the same fault and explicit-recovery paths as the Go command. Offline tests use synthetic identities and a fake Core; live tests port the Go SDK suite.
Core commands' output is read through the carrier's stoppable pipes with one shared grace period, so a descendant that left the process group and holds the output no longer leaks reader threads or descriptors; a Linux test counts both. PATH lookup skips relative entries, empty runtime options mean unset, and record! refuses builtin constructors. The example rejects non-boolean JSON, prints no count for a failed delivery, and writes snapshots through exclusive owner-only files. The README no longer says an unencodable result means nothing was done.
The command and both readers are now held by drop guards created before any reader starts, and readers start through thread::Builder, so a failed start stops the other reader and kills and reaps the command; a test injects the failure at both positions. decode reports a missing value instead of panicking, the example prints readable delivery errors and treats a missing owner as null, and the README documents the six-parameter cap and how to run the example tests.
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.
Adds an SDK layer to the Rust crate (
jacquard_host::sdk), comparable to the Python, TypeScript, and Go SDKs, and runs the four example projects through it. The crate still uses only the standard library.SDK
Runtime::preparechecks, hashes, and installs.jac(or.jqd) sources with Core's publiccheck,hash, andruncommands into a verified cache. The cache key covers source bytes, Core executable bytes, every prelude file, and the protocol. A changed cache entry is refused. The--versioncheck and prelude discovery run once per key across clones and threads. Each Core command runs in its own process group with a timeout and bounded output.EncodeandDecodetraits. They cover integers,f64, text,Hash,bool,Vec(List),Option,(), tuples, andprotocol::Value.record!andvariants!declare application structs and enums as constructors.Dynamichandles untyped values by public name.Operationsbinds closures to exact operation identities. A closure may take a leading&HandlerContext, and its parameters decode into their Rust types.Result<T, HandlerError>; any other error raised with?, or a panic, becomes completion unknown.Function::call,invoke, andmap_batches(explicit batches, every batch validated first, nothing retried), each with aCancelvariant.Invocationprovidesdecode,value,render, and owner-onlysave.sdk::Error. A result-mapping failure keeps the successful raw result.Projects:
cargo run --example jacquard-examples -- <project>runs quickstart, planner, triage, and fulfillment. It reads the rules fromexamples/and supports the same--inspect,--fault, and--deliver-pendingrecovery paths as the Go command.Low-level change:
HandlerErrorgainsFrom<E: std::error::Error>, mapping any such error toUnknown.Docs:
rust/README.mdis rewritten around the SDK and keeps the low-level host section.Verification (local, Linux 7.0, Rust 1.99.1)
jacquard-core-0.3.0, withJACQUARD_REQUIRE_LIVE=1and no skips:aarch64-apple-darwinandx86_64-pc-windows-gnu, but those targets are only type-checked.scripts/core_pin.py check, the offline Python suite, andscripts/check_distribution.pypass.