Repository navigation
rutis v0.12.0
rutis 0.12.0
The main change in 0.12.0 is that services are exposed across languages by themselves: what Node, Bun, Python and Go plugins provide with ctx.provide, and what published Cordis plugins provide, is used by name from other languages, other nodes and Rust with no declaration, and provides becomes optional; Cordis plugins in one Node runtime use each other's services by Cordis's own rules. Next, a Rust application embedding rutis names existing Rust types in its build.rs and leaf plugins call their methods directly, with no HostDispatch written by hand; a Rust service can also tell which row calls it. Third, operating rutis-host: rereading rutis.json while it runs, restarting a crashed local runtime as restart says, and run printing when a runtime ends and comes back. There is also a hook for revoking an identity while running (Rust library). On quality, step three of the plan is done: long soaks, a real network, fuzzing and concurrency models, cross-version combinations and two TLA+ models, with the fixes they found. Plugins of the 0.11 era see one change in behaviour (undeclared services now reach rutis, and on a name clash the row providing it later fails), see "Compatibility" below.
Packages
These packages are all at version 0.12.0:
| Registry | Packages |
|---|---|
| crates.io | rutis (the kernel), rutis-bridge, rutis-loader, rutis-host; the dylib toolchain rutis-sdk, rutis-dylib, rutis-dylib-meta, rutis-dylib-launcher |
| npm | @arcships/rutis, @arcships/rutis-runtime, @arcships/rutis-bun, @arcships/rutis-host, and the host packages for five platforms |
| PyPI | rutis, rutis-host |
| Go | github.com/arcships/rutis/go/rutis (tag go/rutis/v0.12.0) |
| GitHub | rutis-host binaries for Linux / macOS (x64 / arm64) and Windows (x64), with SHA-256 checksum files |
rutis-cli is still released separately.
New
- The services leaf plugins provide reach rutis by themselves;
providesbecomes optional (#442, Plugin API): in all four SDKs (Node, Bun, Python, Go), whatctx.provide(name, impl)provides reaches rutis without a declaration, and plugins of other languages use it by name. Its methods are the public methods of the implementation: JavaScript, its own and its prototype chain's functions (notconstructor); Python, callable attributes not starting with_; Go, exported methods; all called asasync, fields not counting. Aprovidesdeclaration still applies: it marks methodssyncand letsrutis-host checkknow before running who provides what; existing plugins need no change. An undeclared service appears once its plugin runs, and rows depending on it wait for it as usual;checkwarns of such a dependency, not failing (it does with--strict). On a name clash the plugin providing it later fails (also when it provides it after loading), naming both:service <name> is already provided by <existing>: row <row> cannot provide it too. A service provided from another thread or goroutine beforeapplyreturns has the host handle it before the load completes, and a clash fails the load. The four templates ofrutis-host newno longer declareprovides, keeping a comment on when to write it. The undeclared services of rows in a dial-in instance (instancesofruntimes.remote) are visible only inside that instance (Connect Nodes). The testing tools (@arcships/rutis/testing, the same one under Bun;rutis.testing; Go'srutistest) no longer require a declaration either:service(name)calls by the inferred methods, and the newmethods(name)(Go:Service.Methods()) returns the methods rutis sees. - Published Cordis plugins use each other's services natively, and theirs reach rutis by themselves (#428, Cordis): Cordis packages mounted from
rutis.json(published ones withoutrutis.providesas well) use each other's services by Cordis's rules within one Node runtime, getting the objects themselves; before, a row depending on another stayedwaiting for its services. The services they provide reach rutis without a declaration, used by name by other runtimes, nodes and Rust; the methods are the functions of the service object (its own and its prototype chain's, notconstructor), called asasync; a package declaringrutis.providesfollows its declaration. Name clashes follow the same rule as for leaf plugins.rutis-host checkwarnswarning: <row>: nothing declares <service>; it may be provided at runtime by <rows>, …for a service only such rows may provide, instead ofcannot run: nothing provides …, adding; between Cordis rows of one runtime it resolves in Cordiswhen the row and one of those rows are Cordis rows. Rust library:rutis-bridgegainsrow_projection_of,ServiceEvents::announced,Projection::on_announced/service_keyed_occupied/take_refused/on_refused,HostDispatch::provider,RowService::provided_byandRowSchema::announces/cordis;rutis-loadergainsDeclared::announcesandSupply::Announced. - Rows use existing Rust services, with no binding written (#440, Embed rutis in a Rust application, exported services reference): an application's
build.rsnames the types to export,rutis_bridge::build::Exports::new().service("calendar", "calendar_services::Calendar").service_in("notes", "calendar_services::Notes", "session").generate(), a dependency crate's included (its source is found withcargo metadataand read with syn, following re-exports, aliases and#[cfg]; stable Rust). The build generates a dispatcher for each type's public&selfmethods and TypeScript declarations from the Rust definitions (serde structs and enums as serde writes them,Services,RustError, a<Name>Thrownper error type; they passtsc --strict);rutis_bridge::include_exports!()declares the module andServiceCatalog::export_all(exports::all())registers it: a TypeScript, Python or Go row writes the name ininjectand calls the methods, allasync. Arguments and results are any serde type (integers beyond ±(2^53−1) as bigints); a function parameter (impl Fn(..) -> BoxFuture<'static, Result<..>>,Arc<dyn Fn ..>) takes the caller's function by reference, the native side going on once its Promise settled and its throw being the native failure; a&Ctxparameter is the calling row's context, so what the method registers there goes with that row;.service_inexports inside each instance of an instanced group.Err(e)is thrown in the caller's language withname(the type),code(the variant),message(Display) anddata(the serde value), not as an unclassified call error. A method that cannot be bound is left out with a build warning saying why. Example:examples/rust-services. Rust library:rutis-bridgegains the moduleexports(Export,ExportPlugin,include_exports!) and, with the new featureexports(whichcordisenables),build::Exports;rutis-loadergainsServiceCatalog::export,export_allandshare_registered_only. - Errors carry
codeanddata(#440, Plugin API): an error thrown in any language can carry a code and data, in the error graph besidenameandmessage: a JavaScript error's stringcodeanddataproperties, a Python exception's strcodeanddataattributes, a Go error'sCode() stringandData() any, Rust'sexports::failure. The receiver reads them ascodeanddata(Go:Code,Data; Rust:Error::code(),Error::data()), and they pass on when it throws the error again; data that cannot cross is left out, and the rest of the error still crosses. Python'sRemoteErrorgains the attributescodeanddata(Nonewhen absent), Go'sRemoteErrorthe fieldsCodeandData; Rust'ssession::Errorgainscode()anddata(). - A Rust service sees the row that calls it (#441, Embed rutis in a Rust application): Rust library only. During
HostDispatch::invoke,rutis_bridge::session::caller_row()returns the calling row as aCallerRow: itsid()(the loader's),key()(in its runtime),scope()(the label it isolates the service under, an instance's inside instances),instance()andctx(). Two rows of one runtime are two callers; an effect registered onctx()goes when that row unloads or restarts, while the runtime keeps running. A call from Rust, from a peer node or from a runtime outside any row returnsNone. This works with Node, Bun, Python and Go rows, including 0.11 runtimes: the wire is unchanged; each row has the services it leases in a scope of its own.rutis-bridgegainsProcess::lease_host_forandHostLease::label. - Changing the configuration while it runs (#274, rutis-host):
rutis-host runreadsrutis.jsonagain on SIGUSR1 on Unix (systemd:ExecReload=/bin/kill -USR1 $MAINPID); with--watch-config(off by default) it does when the file's content changed and stayed the same for 500 milliseconds, the way for Windows and Kubernetes ConfigMaps. All or nothing: the new rows are checked first, and a row failing after the replacement brings the old rows back; a broken configuration leaves the old one running and printsrutis-host: reload rejected: <reason>; nothing changed, an applied onerutis-host: reloaded <file> (<n> rows changed). Rows added, removed and changed apply at once, those of aninstancedgroup in every instance there is; a local runtime removed stops once its rows unloaded.format,id,listen,runtimes.go,runtimes.remote(listenandinstancesincluded) and a local runtime added or with changed settings cannot change this way: refused, saying to restart the host. SIGHUP is still a termination signal. Credentials are now read from the environment when a link dials or a far end dials in, so a peer row a reload adds connects too. - Restarting a crashed runtime (#274, rutis-host):
runtimes.node,runtimes.pyandruntimes.bungain the optional fieldrestart, saying what happens when the runtime's process ends on its own:"no"(the default, as before: its rows wait),"on-failure"(it is started again after a wait and its rows come back; the wait is 1 second, doubling each time up to 30 seconds, back to 1 second after 60 seconds of running, and one more end after 5 restarts within 5 minutes gives up, printingruntime <name>: gave up after 5 restarts within 5 minutes; the numbers are fixed, not configurable),"exit"(the other rows unload and the host exits with the new exit status 3, for its process manager to restart it).devfollows the same rules and defaults, withrestartinrutis.dev.json. Go runtimes have no such setting yet. - Runtime state lines (#274, rutis-host):
rutis-host runanddevprintruntime <name>: down (<reason>)when a local runtime's (node,py,bun, Go'sgo-<binary>) process ends on its own or the runtime cannot start, the reason saying how the process ended, such asruntime py: down (exited with signal: 9 (SIGKILL)); andruntime <name>: runningwhen it runs again. Before, only its rows going back towaiting for its servicesshowed it. Runtimes the host stops (the host stopping, a Go runtime stopping when idle) print nothing. Rust library:rutis-loadergainsGoRuntimesHandle::states(each Go runtime's state, without reading the binaries). - Revoking an identity at runtime (#273, design): Rust library only, the hook a future management service calls. In
rutis-bridge,Revocable::new(inner, revocations)wraps anIdentity(static links) or anAdmission(access points), andRevocations::revoke(&id)/revoke_all()revokes while everything keeps running: only the connections accepted as that id close (calls in flight on them fail once, as when the network drops), a handshake routed before the revocation is not handed over, and later connections are refused exactly as a wrong token is (403, or close code 4003 for an access point's id), so the dialer waits 30 s asAuthRejected. Other peers, other connections on the same listener and local runtimes are untouched. For an access point with a shared token, revoking an id closes that connection;revoke_all()withdraws the token.IdentityandAdmissiongainrevocations(), defaulting toNone. rutis-host has no command for it: its tokens come from the environment and cannot be revoked at runtime (Connect Nodes).
Fixes
- A refused call did not take its call id (#407): when a far end's call was refused while decoding its arguments (failing only that call, the session going on), its call id was not recorded, so the far end sending the same id again had it run as a new call. A refused call now takes its id as a completed one does, and the same id sent again closes the session with
invalid or repeated invocation identity. - The native generator took a plugin's own type of the same name for a value type (#408): the
rutis_plugingenerator recognisedInstant,BigInt,Bytes,ValueMapandValueSetby their short names, so a plugin's owntype Instant = Stringwas declared asDate. It now resolves types through the source file'suses and full paths and recognises only those rutis-bridge exports; a plugin's own type of that name, orstd::time::Instant, is refused withtype binding not implementedinstead of being declared wrong. Every form that compiles (a short name afteruse, globs, module prefixes, full paths) is still recognised. - NaN and ±Inf in maps and sets became
null(#409): the generator's checks looked only atf64fields andVecs, so NaN / ±Inf in aValueMap<String, f64>silently becamenullthrough serde. Map keys and values and set elements are now checked at any nesting, refused with the samenon-finite numberas a struct field. - A listening link is registered once applied (#411): a listening link in
rutis-bridgeused to register on its listener only in the task it starts after being applied. With an access point already on that listener, a static peer dialing in before then was refused as an unknown credential (403), and the dialer waited 30 s asAuthRejectedbefore retrying; now the registration is there onceLinkPluginis applied, and a refused registration (the name taken) is stillStopped. An access point orders connections as they were delivered: of two connections of one id delivered almost together, the later one could before be counted as the earlier. - Families registered together were announced as offered twice (#435):
Peer::registerinrutis-bridgeput a family's handler in place and then, under another lock, recorded the number of the offer (since). Another feature registering on another thread in between announced the family already present but without its number, as 0, and only then with its real one. To the far end the family was offered anew: itspeer:rows restarted, and one being applied could findPeerRowsjust withdrawn and stay failed. Only when an end registers two or more families at once (a link that both hosts and imports, say). The number is now put in place together with the handler, so an announcement always carries each family's own. - A plugin whose dependency was withdrawn just before its apply stayed failed (#438): when a plugin's dependencies were ready and its
applyscheduled, and a dependency was withdrawn before it ran, anapplythat read it withrequire/require_asand returned that read's error as is (require(..)?) left the plugin Failed; provided again by the same provider, the dependency had no new generation, so the plugin was not retried either. Apeer:row readingPeerRowscould meet this at the moment its host really closed or reopened, and so could Node, Python, Bun and Go rows reading their runtime's service. The kernel now treats that error as it treatsInjectUnsatisfied: when this generation's read of the dependency really failed, the plugin waits again and loads when the dependency is back. - An embedding application's memory grew as instances were created and closed (#430, found by S7):
Projection::attachinrutis-bridgestarted, for each language row, a task waiting for the runtime's session to end, which lived until then, one per load of a row;Process's table of export slots kept withdrawal records after a row unloaded, one per instance for instance-scoped ids. A multi-tenant application creating and closing tenants over and over grew by about 1.4 KiB a round. The task now ends when the projection closes or is dropped, and the records go with the row. - A Python runtime that never exited after its host was
kill -9ed (#431, found by S8): when the host was killed and a plugin's cleanup never returned, the Python runtime, at its deadline (RUTIS_SHUTDOWN_TIMEOUT), was to write a line on stderr and exit with 1; its stderr was a pipe to the host, so with the host gone the line could not be written (BrokenPipeError) and the process stayed. It now exits all the same. Unix only: on Windows the runtimes end with the host's Job Object. - A Python
listen:runtime with its controller connected did not stop on Ctrl-C and skipped its cleanups on SIGTERM (#433, found by S5): on Ctrl-C,python -m rutis listen:…waited, as its event loop closed, for the threads blocked in accept and on the connection, and did not exit; SIGTERM killed the process outright, without running the rows' cleanups. It now does asdial:does: unloads every row, closes the connection and the listener, and exits with 0. - A Python
listen:runtime printed a traceback when a session ended because the network dropped (#434, Connect Nodes): when the controller's heartbeat timed out or the connection was reset, the node's stderr got the websockets library's log and a full traceback. It now prints one line,rutis: session ended (<reason>); waiting for a controller, for examplerutis: session ended (heartbeat timeout); waiting for a controller, andrutis: session ended (replaced by a new connection)when a new connection takes over. A dropped network, a heartbeat timeout or a close by the far end no longer prints websockets' log; other unexpected errors are still printed with their traceback (starting withrutis: websockets:). In thedial:state lines, a heartbeat timeout's reason is nowheartbeat timeoutinstead ofclosed (1011): keepalive ping timeout. - A far end revoked during its handshake still got a session (#432, found by the TLA+ models): two places. A link whose far end was revoked during the handshake provided the Peer and reported Ready before cutting it off, so plugins depending on the Peer could already have started loading rows; on an access point, an id revoked while a new connection of that id, already admitted, waited to take over was still accepted and then cut off. A link now checks for revocation before providing the Peer (the listening side refusing with close code 4003), and an access point before accepting.
- A reload removing a runtime waited for the wrong process (#450, rutis-host): once a removed local runtime stops, the reload waits for its own process (also one its supervisor restarted meanwhile), not for any process that ran before: a runtime already down no longer stalls it 15 s with a false warning, and another runtime ending meanwhile no longer makes it say stopped early. Rust library:
rutis-bridgegainstransport::local::Processes,LocalTransport::sharing/processesandLocalRuntime::processes. - A stale name-clash refusal failed a later restart (#450): a row refused a name it provided after loading fails only the restart that refusal causes; later restarts (the clash long gone) run.
- Services a Python thread provided slipped past a reload (#450, Plugin API): an undeclared service
ctx.provided from another thread beforeapplyreturns now also has the host answer before the load does; on a clash the load fails, so the reload is refused and the old rows run on. Go did so already; Node and Bun are single-threaded. - The TypeScript SDK's declarations failed
tsc --strictwithoutskipLibCheck(#440):Pluginin@arcships/rutisextended two types that declareinjectandprovidesdifferently (TS2320). It now takes them from one of them; the types are the same.
Tests and quality
Step three of the quality plan is done:
- Concurrency models and fuzzing (#179 → #425): three shuttle models check, on the kernel's own code, the three places that went wrong before (a lost wakeup in
TransitionTask, the race betweenpost_joinand the driver exiting, concurrent disposes cleaning up exactly once); three cargo-fuzz targets: session frame decoding, local line framing, WebSocket upgrade requests, with their corpora in the repository. Large runs nightly. - Cross-version combinations (#209 → #426): the previous release's runtimes and nodes against the current host (
tests/e2e/tests/cross_version.rs), in the full runs (nightly, release gate); no combination failed after loading or hung. - S5 on a real network (#341 → #433): two containers, non-loopback addresses with TLS, netem adding delay, loss and outages; nightly, report only.
- S6 published Cordis plugins (#190 → #429):
rutis.jsonmounting published dsh plugins, plus a nightly baseline following the latest Cordis plugins; the gap it found, #428, is solved in this release (see "New"). - S7 Rust embedding with multiple tenants (#191 → #430): a multi-tenant application assembled as in Embed rutis in a Rust application, creating, editing and closing tenants and coming back after a restart; after repeated creation and closing, internal tables, processes, descriptors and memory return to their baseline.
- S8 long runs (#192 → #431): one
rutis-host runruns an hour nightly on three platforms, calling, editing and rereading its configuration, killing runtimes and dropping links at random from a seed, with no resource growth; ending by Ctrl-C, SIGTERM orkill -9leaves no orphan processes. - TLA+ remote leases (#210 → #432): two models in
specs/remote-lease/(a remote runtime's lease takeover and reconnection; access points and revocation), with a new CI jobspecs. - Language runtimes organised as a registry (#230 → #420): one file per language in
rutis-host, test helpers moved tocommon, ready for the new runtimes of 0.13; no user-visible change. - Test fixes from the release review (#451): assertions that could pass vacuously and timing-dependent waits removed; the cross-version tests cover this release's three new behaviours against older versions: undeclared services (an older runtime under the current host, the current runtime under 0.10 and 0.11 hosts), leasing per row (two rows in an older Node or Python runtime each told apart), and an error with
codeanddatasent to an older node.
Compatibility
- Plugin API and protocol: the plugin API version is still 2, and the protocol versions are unchanged (protocol 2 for local sessions, 3 for sessions with endpoint identities). Every addition is negotiated and applies only when both sides are 0.12:
announcein themountarguments androws.announcein its reply'sfeatures, a fourth argument{ row, methods }onservicefor an undeclared service,announcesin therows.schemareply and in the Go manifest's plugin entries, andcordisfor a Cordis plugin. Leasing per row (a Rust service seeing its calling row) uses only scope labels, the wire is unchanged, and 0.11 runtimes work with it. An error'scodeanddataare in the error graph; 0.11 runtimes and hosts still get only the name and message. - A change in behaviour for 0.11-era plugins: an undeclared
ctx.provideused to panic in Go (Provides does not declare it), stay visible only in its process on the other runtimes, and fail the testing tools'service(name)("not declared in provides"); now it reaches rutis. So when a plugin provides, for its own process, a name another provider (any language, any node) also provides, the row providing it later now fails: rename it, or list the name in that row'sisolateto keep it in the row's own scope. checkwarnings and--strict(rutis-host): every plugin of the four 0.12 SDKs saysannounces: true(one declaringprovidestoo; the declared names still count as provided), and so do Python and Bun module-style plugins withoutprovides, and a Cordis row withoutrutis.provides. A dependency no row declares, while there are such rows, wascannot run: nothing provides …with exit status 1; it is now a warning on stderr,rutis-host: warning: <row>: nothing declares <service>; it may be provided at runtime by <rows>, …, with exit status 0. So in a project with such rows, a misspelt name ininjectis only a warning: in CI use the newcheck --strict, which makes these warnings errors, exiting with 1. With no row that may provide it, it is still an error. A plugin of the 0.11 SDK has noannouncesmark, sochecktakes its declaration as all it provides.- Upgrade the runtime packages together with rutis-host: a 0.11 runtime under a 0.12 host follows its declarations, its undeclared services visible only in its process; a 0.12 runtime under a 0.11 host does not hand undeclared services over either, and a plugin providing one is told, once per name on stderr by the runtime (Node, Bun, Python, Go):
rutis: service <name> is not declared in provides, and this host (older than 0.12) does not take undeclared services; declare it or upgrade rutis-host. - Inferred methods differ by language: without a declaration, the methods rutis sees follow each language's rules (JavaScript includes the prototype chain's functions, so a class extending
EventEmitteralso exposeson,emitand the rest; Python, public callable attributes; Go, exported methods), so the same service written in two languages can differ; list the methods inprovidesto fix them. A Python class-formprovides(provides={"weather": Weather}) still makes onlyasync defmethodsasyncand the restsync, while inferred methods of an undeclared service are allasync; this is unchanged, for compatibility with 0.11 code. - Errors carry
codeanddata: a JavaScript error's stringcodeproperty and itsdataproperty did not cross before and now go with the error to the far end; the receiver's error has these two properties (on Python'sRemoteErrorthey areNonewhen absent). rutis.json: the format is still 1.runtimes.node,runtimes.pyandruntimes.bungain the optional fieldrestart; earlier files need no change and mean the same; a file using it cannot be read by the 0.11 rutis-host (an unknown field). A misspelt field in these three runtimes now listsrestartamong the fields allowed.- Exit status: 3 is new (a runtime whose
restartis"exit"ended, and the host stopped). 0, 1 and 2 mean what they did. - Credentials:
rutis-hostnow readsRUTIS_TOKEN_<NODE>/RUTIS_TOKENwhen a link dials or a far end dials in; the values are the same as before (the environment does not change within the process), only the peer rows no longer have to be there at start. - Rust API (
cargo semver-checksagainst v0.11.0):rutis-loader:ServiceCatalog::new()/default()now share by name every name not registered otherwise, as rutis-host's catalog (share_by_name) always did. With #428 only names that have a provider on the rutis side gate rows in rutis, so Cordis rows no longer wait on each other for it. Differences an embedding application may see: a row injecting a name nothing registers waits for it (it wasUnknownService), and a Cordis row's injected names are gated in rutis like a leaf row's.ServiceCatalog::share_registered_only()is the former behaviour;share_by_name()stays (it is now the default).rutis-loader'sDeclaredgains the public fieldannounces;rutis-bridge'sruntime::RowSchemathe public fieldsannouncesandcordis;rutis-host'sconfig::NodeRuntime,BunRuntimeandPythonRuntimethe public fieldrestart. Code building them with a struct literal needs the fields (or..Default::default()).rutis-host:status::follownow takes onestatus::Followed, andShown::changestakes&Followed(both took a loader and aPeerResolverbefore).rutishas no changes; everything else is an addition, see the entries above.
- dylib: dylib plugins need to be rebuilt with the 0.12.0 SDK.
- Minimum versions unchanged: Rust 1.88, Node 22, Python 3.10, Bun 1.4, Go 1.24.
Known issues
- Go runtimes have no
restartsetting yet: a crashed Go runtime staysdown, and starts again when a row uses it once its binary changed. - As in 0.11: Bun cannot tell "the server's certificate is not trusted" from other TLS handshake failures, so a Bun dial-out treats every TLS handshake failure as an authentication failure and retries every 30 seconds; on Windows, a Node dial-out relies on the console sending Ctrl-C to child processes too in order to stop, untested on Windows.
Getting started
npx @arcships/rutis-host@0.12.0 new greeter --lang nodeuvx --from rutis-host==0.12.0 rutis-host new greeter-py --lang pythonThen read TypeScript plugins, Bun plugins, Python plugins, Go plugins, Embed rutis in a Rust application or Connect Nodes.