Skip to content

build(runtime): make the NATS planes a Cargo feature - #29

Closed
ishandhanani wants to merge 1 commit into
idhanani/p4-k8s-catalog-feederfrom
idhanani/p5-runtime-nats-feature
Closed

ishandhanani wants to merge 1 commit into
idhanani/p4-k8s-catalog-feederfrom
idhanani/p5-runtime-nats-feature

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

Stacked on the k8s catalog feeder PR. Completes Phase 5: the NATS half of compile-time optionality.

Summary

  • dynamo-runtime feature nats (default on) owns async-nats and gates: transports::nats, the NATS request plane (ingress::nats_server, egress::nats_client, PushEndpoint::start), the NATS event plane (event_plane::nats_transport), NATS service registration (component::service, register_nats_service, the component registry's services map, ComponentBuilder::build's NATS branch), kv_router_nats_*, the NATS KV store, the eight jetstream PipelineError variants, crate::service, and the NATS header helpers in logging.
  • Wire enums are untouched (TransportType::Nats, EventTransport::Nats, EventTransportKind::Nats, RequestPlaneMode::Nats), so discovery records from NATS-using workers still deserialize in a NATS-free frontend. Selecting a NATS plane in such a build fails at startup with an error naming the feature (nats_config_if, create_nats_client/server, event-plane arms, ComponentBuilder::build).
  • otel_parent_context_from_distributed and its test use plain string headers instead of a NATS header map (the extraction was already transport-agnostic).
  • dynamo-llm: nats = ["dynamo-runtime/nats", "dep:async-nats"] in defaults; the NATS request-trace sink is gated. Binary-shipping members enable nats next to etcd. Runtime dev-deps enable tokio test-util explicitly (previously unified through async-nats).
  • Docs: sidecar-backends.md build-time note covers both features.

Validation

  • cargo check -p dynamo-llm --no-default-features: builds; cargo tree -p dynamo-llm --no-default-features -e normal -i async-nats and -i etcd-client both print nothing.
  • Every shipped binary keeps async-nats (cargo tree -i async-nats for dynamo-vllm-sidecar, dynamo-sglang-sidecar, dynamo-trtllm-sidecar, dynamo-ext-proc, dynamo-mocker-backend, dynamo-py3).
  • cargo check -p dynamo-runtime --no-default-features --tests and cargo clippy -p dynamo-runtime --no-default-features --all-targets: clean. Runtime unit tests without default features, workspace check, and clippy with defaults: see the final comment.

`dynamo-runtime` gains a `nats` feature (on by default) that owns the
`async-nats` dependency and gates the NATS transport (`transports::nats`),
the NATS request plane (`ingress::nats_server`, `egress::nats_client`), the
NATS event plane (`event_plane::nats_transport`), NATS service registration
(`component::service`, `DistributedRuntime::register_nats_service`,
`kv_router_nats_*`), the NATS KV store, the jetstream error variants on
`PipelineError`, and the NATS header helpers in `logging`. Wire enums
(`TransportType::Nats`, `EventTransport::Nats`, `EventTransportKind::Nats`,
`RequestPlaneMode::Nats`) are unchanged, so discovery records from workers
that use NATS still deserialize; selecting a NATS plane in a build without
the feature fails at startup with an error naming the feature.
`otel_parent_context_from_distributed` no longer needs a NATS header map.

`dynamo-llm` forwards the feature (`nats = ["dynamo-runtime/nats",
"dep:async-nats"]`, on by default) and gates its NATS request-trace sink;
every binary-shipping member enables `nats` next to `etcd`. The runtime's
dev-dependencies enable tokio `test-util` explicitly instead of relying on
feature unification through async-nats.

Consumer: `cargo check -p dynamo-llm --no-default-features` builds with
neither `etcd-client` nor `async-nats` in the graph, while every shipped
binary keeps both. `dynamo-runtime --no-default-features` passes its unit
tests and clippy.

Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
@ishandhanani

Copy link
Copy Markdown
Owner Author

Validation results: cargo test -p dynamo-runtime --no-default-features --lib 623 passed / 0 failed (the nats_mode_requires_nats_client test now accepts the not-compiled-in error); cargo check --workspace --all-targets and cargo clippy -p dynamo-runtime -p dynamo-llm --all-targets with default features: clean; cargo clippy -p dynamo-runtime --no-default-features --all-targets: clean; docs_lint.py: 0 errors.

@ishandhanani

Copy link
Copy Markdown
Owner Author

Closed while Stack 1 (#45 to #53) and Stack 2 (#40) go upstream; the branch stays for later stacks (direct dispatch, catalog leases, runtime features). See #33.

This branch had an error being deployed

1 failed deployment
external_collaborator — 8d3208d2 Deployed Sep 3, 2026 by ishandhanani via ok-to-test #50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant