Skip to content

rutis v0.13.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 04:47
· 2279 commits to main since this release
028783f

rutis 0.13.0

中文 · 0.12.1 release notes

The main change in 0.13.0 is unified events (#464): every listener on a host — of Rust plugins, of Node / Bun / Python / Go leaf plugins, of Cordis plugins, of remote runtimes and linked nodes — is on one logical bus; the five modes emit, parallel, serial, waterfall and synchronous bail mean the same everywhere, and wherever an event is emitted and wherever its listeners are, the result is the same as if every listener were in one process. This version keeps none of the old event behaviour and does not mix with runtimes or nodes of 0.12 and earlier; see "Compatibility" below and migrating to 0.13.

Packages

These packages are all at version 0.13.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 five platform host packages
PyPI rutis, rutis-host
Go github.com/arcships/rutis/go/rutis (tag go/rutis/v0.13.0)
GitHub rutis-host binaries for Linux / macOS (x64 / arm64) and Windows (x64), with SHA-256 checksums

rutis-cli is still released separately.

New

  • Unified events: one logical bus (#464, design, protocol spec, plugin API): a plugin writes ctx.on(name, listener) as before; the listener registers itself with the host and nothing is declared. Events emitted in any language, process or linked node reach it by the same rules. When every listener of a name is in the emitter's process, the dispatch runs there without the host, with the same results. Supersedes the drafts #340, #358, #359 and the event boundary rules 2–5 of requirements-protocol-plugins §5.
  • Five modes, in every language: emit (returns at once; a failing listener is reported in one line where it runs and reaches neither the emitter nor the other listeners), parallel (waits for all; failures are an AggregateError in registration order), serial (the first result), waterfall (middleware: each listener gets next last, and next may be a function in another process) and the synchronous bail (listeners elsewhere run as synchronous calls, under wait-cycle detection; an asynchronous listener fails it with AsyncListener). Rust also has waterfall_sync. Each language writes them its own way: Node / Bun leaf plugins ctx.emit / await ctx.parallel / await ctx.serial / ctx.waterfall / ctx.bail, Cordis plugins Cordis's own API, Python ctx.emit / await ctx.parallel / await ctx.serial / await ctx.waterfall / ctx.bail, Go ctx.Emit / Parallel / Serial / Waterfall / Bail, Rust the methods of the same names on ctx.events().
  • Scopes: an event's scope is the loader instance the emitter is in; a listener receives the events emitted in its scope and inside it, never a sibling instance's (events no longer leak between instances). Rust adds Ctx::scope(), Ctx::mark_scope, Ctx::mark_row; Go adds ctx.Scope(). (Amended in a later release: events are one flat bus, and a scope is a filter descriptor; see migration-0.13.)
  • Filters: filter(keep) (Rust ctx.events().filter, Node / Bun / Python ctx.filter, Go ctx.Filter) is evaluated in the emitter's process, before any listener starts, once for each candidate's descriptor (plugin, row, runtime, node, scope chain); Cordis's Context.filter uses the same mechanism, and every Context has a new read-only ctx.rutis. The listener options prepend and global (exempt from filters) exist in every language.
  • One lifecycle: on unload a row's listeners leave the bus first, and the running ones get a cancellation signal (Go context, Python task cancellation, JavaScript ctx.signal, Rust ctx.cancelled()) and are waited for, at most RUTIS_SHUTDOWN_TIMEOUT. When a runtime process or node goes away, its listeners leave the bus and calls in progress fail once (BindingError).
  • Framework events rutis/*: the host publishes rutis/service (a service appears, is replaced or withdrawn), rutis/row (a row's state) and rutis/runtime (a runtime running or down), which plugins in every language can listen to; a plugin emitting rutis/* fails with ReservedEvent. Rust types: rutis_loader::RowEvent, rutis_bridge::events::{ServiceEvent, RuntimeEvent}.
  • Events between nodes work as on one machine (connecting nodes): export / import of the node row select events too, and an item may be a prefix ending in *; the far listeners are entries on this node's bus, with the five modes, scopes, filters and every value type (before: always parallel, JSON only). Events travel one hop.
  • Values: event arguments and results cross by the rules of calls: the ten values, references to functions and objects, 64 levels. A Rust typed event is named across languages by Event::NAME and its arguments are serde-encoded (one argument per field of a tuple struct); rutis_bridge::events::Args carries any arguments by name.
  • Test tools: @arcships/rutis/testing (load, and host() for several plugins on one bus), rutis.testing (load(..., bus=, scope=), Bus) and Go's rutistest (loaded.On, rutistest.InScope) offer the same five modes, filters, scopes, unload waiting and cancelling; the real runtimes and the test tools are checked against one events expectations file (events.expected.json).
  • Plugin API 3: adds parallel, serial, waterfall, bail and filter.

Tests and quality

  • Cross-version meetings now check refusals (events/old-peer-refused): the gate's cross-version tests (tests/e2e/tests/cross_version.rs) meet 0.12.1; the old Node, Bun and Python runtimes and binaries built with the old Go SDK under the current host, the old Python remote runtime the current host dials, the current runtimes under the old host, and old and current nodes with either one dialing are all refused right after the handshake, before anything loads, saying which end to upgrade, without retrying or hanging. From 0.13.1 the previous release declares events-v2 too, and the meetings are expected to work again (bridge/cross-version-meetings).
  • The checks after publishing wait for every npm package (#457): while waiting for the registries to serve the version, every npm package node scripts/train.mjs --npm lists is waited for, @arcships/rutis-bun, @arcships/rutis and @arcships/rutis-runtime included (0.12.0's checks after publishing failed once because @arcships/rutis-bun could not be fetched yet).

Compatibility

No old behaviour is kept and there is no backward-compatible path. Each rewrite is in migrating to 0.13.

  • Mixing with 0.12 and earlier is refused: every 0.13 end declares the required capability events-v2 in its handshake; runtimes, remote runtimes, connected runtimes and nodes of 0.12 and earlier are refused before anything loads: incompatible session: the far end (<name> <version>) does not declare events-v2 (the event protocol of rutis 0.13): upgrade it to rutis 0.13 or later. A node link stops as incompatible and does not retry. A 0.13 runtime meeting an older host exits with status 1: rutis: refused: incompatible (this host does not declare events-v2 (the event protocol of rutis 0.13): upgrade rutis-host to 0.13 or later); stopping. Upgrade rutis-host, the runtime packages and every linked node together. The session protocol versions are unchanged (compat 2, endpoint 3, rutis.3).
  • Plugin API 3: 0.13 runtimes still load API 2 plugins; an older runtime refuses an API 3 plugin with the existing message.
  • Removed configuration and APIs (writing them is an error that names the replacement):
    • Rust (rutis-bridge): RuntimePlugin::emits, LocalRuntime::emits, Mount.emits, Mount.events (EventSink), Process::emit, runtime::events::{Events, EmitToCordis}, the node EventsPlugin, NodeEvent, node_event, Features { outbound, inbound }; .event / .emit of cordis::build; runtime::testing::weather_emits. Changed signatures: Mount gains ctx (without it a runtime's events stay in its process) and runtime, Process::load_row / load_row_exporting gain a last scope, runtime::testing::runtime gains a first ctx.
    • The Rust kernel (rutis): on_waterfall*, on_waterfall_sync*, WaterfallListener, SyncWaterfallListener, PatternWaterfallListener, SyncPatternWaterfallListener, Next, SyncNext, SyncEvent, EventKey::instance, every *_instance and *_keyed method, EventPattern::any_prefix, EventPattern::prefixes, EventKey::instance_id, ListenerKind::{AsyncWaterfall, SyncWaterfall}, CordisError::ReentrantEvent (a synchronous dispatch of a name may re-enter it). The call of the listener traits takes a last Call / SyncCall; the fields of EventSubscription go by name (see the migration guide). Event requires Serialize + DeserializeOwned; listeners are one kind, on(ctx, key, |ctx, e, call| ..) / on_sync; serial takes an Arc<E>; waterfall and Terminal return an Option.
    • events and emits of Cordis mount manifests and the generator: the config field <events|emits> was removed in rutis 0.13: listeners register themselves; emit with ctx.emit / parallel / serial / waterfall / bail (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md).
    • events: { out, in } of node rows: the peer config field events was removed in rutis 0.13: list events: { out } in export and events: { in } in import (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md). An old rutis.json still writing it is refused by rutis-host check and at start with that message; format stays 1 and old files without it read as before (the persisted sample rejected/peer-events/ records the refusal). In a Cordis application acting as a node, out / in of Events give the Events options out / in were removed in rutis 0.13: use export / import (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md).
    • The test tools' emits declared at load (Node / Bun load(plugin, { emits }), Python load(plugin, emits=…), the trailing event names of Go's rutistest.Load).
    • Protocol: the mount arguments events / emits, the mount feature events, runtime → host event, host → runtime emit, the nodes' events.forward.
  • Behaviour changes:
    • A failing emit listener no longer ends the process, stops the other listeners or reaches the emitter; it is reported in one line where it runs, rutis: listener of <name> in row <row> failed: <ErrorName>: <message>.
    • Go's Emit no longer waits for listeners, and its error is only a refusal; a listener is func(ctx, args ...any) (any, error).
    • parallel failures are always an AggregateError, children in registration order, even a single one (Rust used to return a single error as is and several in completion order).
    • false is no result, Rust's Some(false) too.
    • A synchronous bail meeting an asynchronous listener fails with AsyncListener, in every language (Cordis took the Promise as the result).
    • A Rust listener is called with the ctx that registered it, not the emitter's; every Rust listener is filtered by liveness and waited for on unload.
    • Unloading waits for running listeners, in every language.
    • rutis/* names are reserved.
  • Event boundary rules: rules 2–5 of requirements-protocol-plugins §5 are removed, replaced by section 3 of unified events.

Getting started

npx @arcships/rutis-host@0.13.0 new greeter --lang node

How to write events: plugin API, and the "Events" section of each language guide: TypeScript, Bun, Python, Go, Cordis, Rust.