Skip to content

feat: Apus data-plane server - #339

Draft
raphael-goetz wants to merge 4 commits into
mainfrom
feat/init-apus
Draft

raphael-goetz wants to merge 4 commits into
mainfrom
feat/init-apus

Conversation

@raphael-goetz

Copy link
Copy Markdown
Member

Summary

  • Ports the Apus data-plane server (hub, value conversion, flow execution, routing) from the apus repo's POC worktree into crates/taurus/src/app/apus/
  • Adds apus-protocol as a local path dependency on the sibling apus repo (pre-publish phase)
  • Wires it into app/mod.rs/app/worker.rs, makes NATS optional, adds APUS_* config/env vars
  • Replaces the Taurus → NATS → Aquila → gRPC → action data-plane path with a direct Taurus↔action connection; Aquila's gRPC control plane is unchanged

Test plan

  • cargo build --workspace
  • cargo test -p taurus — 45/45, including the 25-case Apus integration suite (handshake, routing, overload, hostile input, streams, sub-flows, returned functions, deadlines, cancel, heartbeats, client-cert identity/expiry)
  • cargo test --workspace
  • clippy/fmt have pre-existing failures on origin/main unrelated to this change (confirmed via clean-checkout comparison); not introduced here

🤖 Generated with Claude Code

Wires apus-protocol (sibling repo ../apus/rust/apus-protocol) into the
workspace as a path dependency, and adds it plus serde_json as runtime
dependencies of the taurus crate (serde_json moves from dev-only to a
real dependency: exec.rs::load_flows_file uses it at runtime). Adds
rcgen and time as dev-dependencies for the Apus integration test suite's
in-process TLS certificate generation.
Ports the Apus v1 data-plane server from the apus repo's reference
implementation (apus/worktrees/taurus-083, branch apus, built on
tucana-0.0.83-feature) into crates/taurus/src/app/apus/:

- hub.rs: the Apus server (ApusHub, Connection, CallReply,
  ServerSettings, serve/serve_on). Mutual TLS (action identity from the
  client certificate's URI SAN) or plain TCP; handshake timeout;
  connection limits; ROUTES/STATUS; call slots and admission control;
  deadlines + CANCEL; bidirectional streams; heartbeats; GOAWAY; RETURN
  of a function becomes a tucana SubFlowFunctionResult.
- convert.rs: hardened Apus <-> tucana value conversion, template
  forwarding, automatic streaming of large strings.
- exec.rs: flow execution requested over Apus (ExecContext,
  ExecutionMode {Nats, Local}, FlowSource {Kv, Memory}), flow lookup
  from the NATS KV store (cached + watched), ownership checks, local
  execution via worker::execute_flow, NATS execution via request/reply,
  load_flows_file.
- remote.rs: RoutingRemote implementing taurus_core's RemoteRuntime --
  Apus when the action is directly connected, NATS fallback otherwise.
- tests.rs: the integration test suite (raw-frame mock action driving
  serve_on) -- handshake, routing, overload, hostile input, streams
  both directions, sub-flows, returned functions, deadlines, CANCEL,
  heartbeats, client-certificate identity and expiry.

No changes needed porting onto current origin/main: the reference
implementation's mod.rs already excludes the earlier experimental
"Glue" gRPC hub.
app/mod.rs: declares pub mod apus; makes NATS optional (gated on the
new nats_enabled config flag -- when disabled there's no execution
queue, Apus only); builds an ApusHub when apus_enabled, constructs
apus::RoutingRemote (hub + optional NATS remote + timeout + trace
flag) and passes it to the worker in place of the bare NATS remote
runtime; adds start_apus_server(...), which picks the FlowSource from
either APUS_FLOWS_PATH or the NATS flow-store KV bucket, builds the
rustls TlsAcceptor from apus_protocol::tls::server_config when all
three TLS paths are configured (panics on startup if only some of the
three are set), wires watch_routes, and spawns apus::serve; on
shutdown calls hub.goaway_all(...).

worker.rs: threads RoutingRemote through in place of the bare NATS
remote runtime; after computing a flow run result, if the inbound
execution message carries a NATS reply inbox, publishes the encoded
result there, so an Apus instance that queued the execution over NATS
gets the outcome back. Makes FlowRunResult and the functions exec.rs
reuses (execute_flow, function_identifiers_by_node_id) pub(crate).
Adds Config fields (each via env_with_default) for the Apus data-plane
server: APUS_ENABLED, APUS_HOST, APUS_PORT, APUS_MAX_IN_FLIGHT,
APUS_HEARTBEAT_MS, APUS_TRACE, APUS_INSTANCE_ID, APUS_ADVERTISE,
APUS_ROUTING_PATH, APUS_TLS_CERT/_KEY/_CLIENT_CA, APUS_STREAM_THRESHOLD,
APUS_MAX_FRAME, APUS_MAX_CONNECTIONS, APUS_MAX_CONNECTIONS_PER_ACTION,
APUS_EXECUTION, APUS_FLOW_BUCKET, APUS_FLOW_CACHE, APUS_FLOWS_PATH, and
NATS_ENABLED (default true) to let NATS be disabled for an Apus-only
deployment.
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/taurus/-/pipelines/3014393834

Status: Passed
Duration: 1 minutes

Job summaries

docs:preview

Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/17643395717/artifacts/out/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant