Skip to content

enhancement(api): add dynamic API router based on runtime state#1179

Draft
tobz wants to merge 6 commits intotobz/runtime-system-state-mgmt-primitivesfrom
tobz/dynamic-api-endpoint-routes
Draft

enhancement(api): add dynamic API router based on runtime state#1179
tobz wants to merge 6 commits intotobz/runtime-system-state-mgmt-primitivesfrom
tobz/dynamic-api-endpoint-routes

Conversation

@tobz
Copy link
Member

@tobz tobz commented Feb 9, 2026

Summary

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

References

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dynamic API server that can hot-swap HTTP and gRPC route sets at runtime based on dataspace registry assertions.

Changes:

  • Introduces DynamicAPIBuilder to multiplex dynamically-updated HTTP and gRPC routers on a single listener.
  • Adds new saluki-api types (EndpointType, DynamicHttpRoute, DynamicGrpcRoute) to describe and publish dynamic routes.
  • Updates saluki-app to expose the new module and include required dependencies.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

File Description
lib/saluki-app/src/lib.rs Exposes the new dynamic_api module.
lib/saluki-app/src/dynamic_api.rs Implements the dynamic router swapping server and event loop.
lib/saluki-app/Cargo.toml Adds deps needed for swapping/services (arc-swap, async-trait, hyper).
lib/saluki-api/src/lib.rs Adds public types for endpoint selection and dynamic route publication.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +83 to +93
pub fn with_self_signed_tls(self) -> Self {
let CertifiedKey { cert, key_pair } = generate_simple_self_signed(["localhost".to_owned()]).unwrap();
let cert_chain = vec![cert.der().clone()];
let key = PrivateKeyDer::Pkcs8(PrivatePkcs8KeyDer::from(key_pair.serialize_der()));

let config = ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(cert_chain, key)
.unwrap();

self.with_tls_config(config)
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_self_signed_tls uses unwrap() twice, which can panic inside a library API. Consider changing this method to return Result<Self, E> (or Result<Self, GenericError>) and propagate failures from certificate/key generation and with_single_cert instead of panicking.

Suggested change
pub fn with_self_signed_tls(self) -> Self {
let CertifiedKey { cert, key_pair } = generate_simple_self_signed(["localhost".to_owned()]).unwrap();
let cert_chain = vec![cert.der().clone()];
let key = PrivateKeyDer::Pkcs8(PrivatePkcs8KeyDer::from(key_pair.serialize_der()));
let config = ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(cert_chain, key)
.unwrap();
self.with_tls_config(config)
pub fn with_self_signed_tls(self) -> Result<Self, GenericError> {
let CertifiedKey { cert, key_pair } =
generate_simple_self_signed(["localhost".to_owned()]).map_err(GenericError::from)?;
let cert_chain = vec![cert.der().clone()];
let key = PrivateKeyDer::Pkcs8(PrivatePkcs8KeyDer::from(key_pair.serialize_der()));
let config = ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(cert_chain, key)
.map_err(GenericError::from)?;
Ok(self.with_tls_config(config))

Copilot uses AI. Check for mistakes.
Comment on lines +212 to +216
maybe_update = http_subscription.recv() => {
let Some(update) = maybe_update else {
warn!("HTTP route subscription channel closed.");
break;
};
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the HTTP subscription channel closes, the event loop breaks without calling shutdown_handle.shutdown(). That can leave the HTTP server running while the supervisor future completes (or at least skip graceful shutdown). Consider calling shutdown_handle.shutdown() before breaking (or returning an error) so the server lifecycle is consistent.

Copilot uses AI. Check for mistakes.

maybe_update = grpc_subscription.recv() => {
let Some(update) = maybe_update else {
warn!("gRPC route subscription channel closed.");
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the HTTP subscription: if the gRPC subscription channel closes, the loop exits without triggering shutdown_handle.shutdown(). Consider shutting down the server (or returning an error) on this path as well.

Suggested change
warn!("gRPC route subscription channel closed.");
warn!("gRPC route subscription channel closed.");
shutdown_handle.shutdown();

Copilot uses AI. Check for mistakes.
Comment on lines +177 to +180
fn call(&mut self, request: http::Request<AxumBody>) -> Self::Future {
let mut router = Arc::unwrap_or_clone(self.inner_router.load_full());
Box::pin(async move { router.call(request).await })
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arc::unwrap_or_clone(self.inner_router.load_full()) will almost always clone the entire Router for every request (because the Arc is typically shared). Consider structuring this so each request avoids cloning the full router (e.g., store an Arc<Router> and call into it via a service that is cheap to clone, or keep a ready-to-use service behind the swap).

Copilot uses AI. Check for mistakes.
Comment on lines +224 to +229
debug!(?handle, "Registering dynamic HTTP handler.");
http_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if http_handlers.swap_remove(&handle).is_some() {
debug!(?handle, "Withdrawing dynamic HTTP handler.");
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log levels are inconsistent between HTTP (debug) and gRPC (info) for the same event type (register/withdraw). Consider using the same level for both to keep operational noise predictable.

Suggested change
debug!(?handle, "Registering dynamic HTTP handler.");
http_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if http_handlers.swap_remove(&handle).is_some() {
debug!(?handle, "Withdrawing dynamic HTTP handler.");
info!(?handle, "Registering dynamic HTTP handler.");
http_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if http_handlers.swap_remove(&handle).is_some() {
info!(?handle, "Withdrawing dynamic HTTP handler.");

Copilot uses AI. Check for mistakes.
Comment on lines +249 to +254
info!(handle = ?handle, "Registering dynamic gRPC handler.");
grpc_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if grpc_handlers.swap_remove(&handle).is_some() {
info!(handle = ?handle, "Withdrawing dynamic gRPC handler.");
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log levels are inconsistent between HTTP (debug) and gRPC (info) for the same event type (register/withdraw). Consider using the same level for both to keep operational noise predictable.

Suggested change
info!(handle = ?handle, "Registering dynamic gRPC handler.");
grpc_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if grpc_handlers.swap_remove(&handle).is_some() {
info!(handle = ?handle, "Withdrawing dynamic gRPC handler.");
debug!(handle = ?handle, "Registering dynamic gRPC handler.");
grpc_handlers.insert(handle, route.router);
}
AssertionUpdate::Retracted(handle) => {
if grpc_handlers.swap_remove(&handle).is_some() {
debug!(handle = ?handle, "Withdrawing dynamic gRPC handler.");

Copilot uses AI. Check for mistakes.
@pr-commenter
Copy link

pr-commenter bot commented Feb 9, 2026

Binary Size Analysis (Agent Data Plane)

Target: d3ab905 (baseline) vs 95ff3a9 (comparison) diff
Analysis Type: Stripped binaries (debug symbols excluded)
Baseline Size: 27.39 MiB
Comparison Size: 27.52 MiB
Size Change: +137.03 KiB (+0.49%)
Pass/Fail Threshold: +5%
Result: PASSED ✅

Changes by Module

Module File Size Symbols
saluki_core::runtime::supervisor +69.55 KiB 66
core +61.82 KiB 8917
agent_data_plane::internal::initialize_and_launch_runtime -22.07 KiB 2
agent_data_plane::internal::create_internal_supervisor +16.17 KiB 1
saluki_app::memory::MemoryBoundsConfiguration -13.70 KiB 5
agent_data_plane::internal::control_plane -12.16 KiB 26
std -11.00 KiB 210
anyhow +9.88 KiB 1277
[sections] +9.28 KiB 9
agent_data_plane::cli::run +8.00 KiB 76
saluki_core::runtime::process +7.40 KiB 7
agent_data_plane::internal::observability +5.60 KiB 16
saluki_core::topology::running +5.52 KiB 31
hashbrown -5.27 KiB 368
saluki_app::metrics::collect_runtime_metrics -4.74 KiB 1
tokio -4.71 KiB 2286
[Unmapped] -4.30 KiB 1
saluki_core::runtime::restart +3.50 KiB 7
alloc +2.41 KiB 823
tracing_core +2.24 KiB 413

Detailed Symbol Changes

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +1.79Mi  [NEW] +1.79Mi    std::thread::local::LocalKey<T>::with::h4e6ccdc8d18850a3
  +1.2%  +156Ki  +1.2%  +128Ki    [22461 Others]
  [NEW]  +113Ki  [NEW]  +113Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hc9074c9928b5a01d
  [NEW] +64.1Ki  [NEW] +64.0Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::hefad66e48a5859a7
  [NEW] +64.1Ki  [NEW] +64.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h7c71410799f70464
  [NEW] +59.3Ki  [NEW] +59.1Ki    _<agent_data_plane::internal::control_plane::PrivilegedApiWorker as saluki_core::runtime::supervisor::Supervisable>::initialize::_{{closure}}::h8e2dc90928ea9917
  [NEW] +48.9Ki  [NEW] +48.8Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h84d3c2121a7a9054
  [NEW] +46.0Ki  [NEW] +45.8Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h210813fd7bc5e340
  [NEW] +45.8Ki  [NEW] +45.6Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::hacb5018d30062e67
  [NEW] +44.3Ki  [NEW] +44.1Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::hc4abe89305cfea47
  [NEW] +44.1Ki  [NEW] +44.0Ki    saluki_env::workload::providers::remote_agent::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::h01cc95bc777339de
  [DEL] -44.1Ki  [DEL] -44.0Ki    saluki_env::workload::providers::remote_agent::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::hc491aca4a43dc516
  [DEL] -44.4Ki  [DEL] -44.2Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::h09452ebb66280c27
  [DEL] -45.8Ki  [DEL] -45.6Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::hfee4f92ee0f965d4
  [DEL] -46.0Ki  [DEL] -45.8Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::haf82ad2b47ecd62e
  [DEL] -48.9Ki  [DEL] -48.8Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h08a8f41b52f72e34
  [DEL] -57.9Ki  [DEL] -57.7Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h3f44cf5951d01919
  [DEL] -64.1Ki  [DEL] -64.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h6e6a9551c1fdec06
  [DEL] -84.5Ki  [DEL] -84.4Ki    agent_data_plane::internal::control_plane::spawn_control_plane::_{{closure}}::hd6ee71eb8e3b5d42
  [DEL]  -113Ki  [DEL]  -113Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hc645b34a68b8f71e
  [DEL] -1.79Mi  [DEL] -1.79Mi    std::thread::local::LocalKey<T>::with::he359acebcd355a42
  +0.5%  +137Ki  +0.4%  +108Ki    TOTAL

@pr-commenter
Copy link

pr-commenter bot commented Feb 9, 2026

Regression Detector (Agent Data Plane)

Regression Detector Results

Run ID: 7a35e356-1ae7-4269-87cf-06dc0d20b6d3

Baseline: d3ab905
Comparison: 95ff3a9
Diff

❌ Experiments with retried target crashes

This is a critical error. One or more replicates failed with a non-zero exit code. These replicates may have been retried. See Replicate Execution Details for more information.

  • quality_gates_rss_dsd_heavy
  • otlp_ingest_logs_5mb_throughput
  • otlp_ingest_logs_5mb_cpu
  • quality_gates_rss_dsd_medium

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
otlp_ingest_logs_5mb_memory memory utilization +9.09 [+8.53, +9.66] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization +0.83 [-4.18, +5.84] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_throughput ingress throughput +0.01 [-0.11, +0.14] 1 (metrics) (profiles) (logs)

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_1mb_3k_contexts_cpu % cpu utilization +11.09 [-44.01, +66.18] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_memory memory utilization +9.09 [+8.53, +9.66] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_cpu % cpu utilization +4.18 [-51.45, +59.82] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_cpu % cpu utilization +2.21 [-3.59, +8.01] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_cpu % cpu utilization +1.81 [-28.85, +32.47] 1 (metrics) (profiles) (logs)
quality_gates_rss_idle memory utilization +1.55 [+1.51, +1.58] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_cpu % cpu utilization +1.12 [-0.27, +2.52] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization +0.83 [-4.18, +5.84] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_cpu % cpu utilization +0.71 [-5.21, +6.64] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_memory memory utilization +0.66 [+0.47, +0.84] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_memory memory utilization +0.63 [+0.44, +0.82] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory utilization +0.54 [+0.41, +0.67] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory utilization +0.43 [+0.28, +0.59] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory utilization +0.40 [+0.20, +0.59] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_memory memory utilization +0.39 [+0.14, +0.64] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_memory memory utilization +0.32 [+0.12, +0.52] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_memory memory utilization +0.25 [+0.07, +0.43] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_memory memory utilization +0.21 [+0.03, +0.39] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_heavy memory utilization +0.12 [-0.00, +0.25] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_throughput ingress throughput +0.02 [-0.02, +0.06] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_throughput ingress throughput +0.01 [-0.11, +0.14] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_throughput ingress throughput -0.00 [-0.06, +0.06] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_throughput ingress throughput -0.00 [-0.18, +0.17] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_throughput ingress throughput -0.00 [-0.03, +0.02] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_throughput ingress throughput -0.00 [-0.06, +0.05] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_throughput ingress throughput -0.02 [-0.15, +0.12] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_throughput ingress throughput -0.16 [-0.28, -0.03] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_cpu % cpu utilization -1.55 [-3.78, +0.68] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_memory memory utilization -3.46 [-3.69, -3.24] 1 (metrics) (profiles) (logs)

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
quality_gates_rss_dsd_heavy memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_idle memory_usage 10/10 (metrics) (profiles) (logs)

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Replicate Execution Details

We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.

Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.

Experiment Variant Replicates Failure Logs Debug Dashboard
experiment_with_failures baseline 0 (x8) 1 (x6) Oom killed Debug Dashboard

The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.

❌ Retried Normal Replicate Execution Failures (non-profiling)

Experiment Variant Replicates Failure Debug Dashboard
otlp_ingest_logs_5mb_cpu comparison 7, 2 Failed to shutdown when requested Debug Dashboard
otlp_ingest_logs_5mb_throughput baseline 1 Failed to shutdown when requested Debug Dashboard
quality_gates_rss_dsd_heavy baseline 4 Failed to shutdown when requested Debug Dashboard
quality_gates_rss_dsd_medium baseline 2 Failed to shutdown when requested Debug Dashboard

❌ Retried Profiling Replicate Execution Failures (target internal profiling)

Note: Profiling replicas may still be executing. See the debug dashboard for up to date status.

Experiment Variant Replicates Failure Debug Dashboard
otlp_ingest_logs_5mb_throughput comparison 11 Failed to shutdown when requested Debug Dashboard

@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 64f9fcd to 93ea4b3 Compare February 11, 2026 16:24
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from e8b5919 to 52f0a8a Compare February 11, 2026 16:24
Copilot AI review requested due to automatic review settings February 20, 2026 04:26
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from 52f0a8a to 97b3a4d Compare February 20, 2026 04:26
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 93ea4b3 to ad002af Compare February 20, 2026 04:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +237 to +241
maybe_update = grpc_subscription.recv() => {
let Some(update) = maybe_update else {
warn!("gRPC route subscription channel closed.");
break;
};
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the HTTP subscription case: if the gRPC route subscription channel closes, the loop breaks without shutting down the HttpServer, potentially leaving the acceptor task running while the supervised future completes. Trigger shutdown (and/or treat this as a fatal error) before exiting the event loop.

Copilot uses AI. Check for mistakes.

/// A [`tower::Service`] that routes a request based on a dynamically-updated [`Router`].
///
/// When installed as the fallback service for a top-level [`Router`], `DynamicRouterService` dynamically routing
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc comment grammar: "DynamicRouterService dynamically routing requests" reads like it's missing a verb. Consider changing it to "DynamicRouterService dynamically routes requests" for clarity.

Suggested change
/// When installed as the fallback service for a top-level [`Router`], `DynamicRouterService` dynamically routing
/// When installed as the fallback service for a top-level [`Router`], `DynamicRouterService` dynamically routes

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +44
/// Publishers assert a `DynamicHttpRoute` under a [`Handle`] to register HTTP routes with a dynamic API server. The
/// server observes assertions and retractions via a wildcard subscription and hot-swaps its inner HTTP router.
#[derive(Clone, Debug)]
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rustdoc link [Handle] in this crate doesn't resolve (there is no Handle item in saluki-api), which can trigger broken_intra_doc_links warnings in docs builds. Use a fully-qualified external link (if you add the dependency) or change the wording to avoid an intra-doc link here.

Copilot uses AI. Check for mistakes.
chrono = { workspace = true }
chrono-tz = { workspace = true }
http = { workspace = true }
hyper = { workspace = true }
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyper is added as a direct dependency here, but this crate doesn't appear to reference hyper directly (only saluki_io::net::util::hyper::TowerToHyperService). If it's not needed for a feature flag or a public type, consider removing it to avoid carrying an unused dependency.

Suggested change
hyper = { workspace = true }

Copilot uses AI. Check for mistakes.
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from 97b3a4d to 90a9af1 Compare February 20, 2026 04:39
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from ad002af to 0aed615 Compare February 20, 2026 04:39
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from 90a9af1 to 8a17cac Compare February 20, 2026 05:20
Copilot AI review requested due to automatic review settings February 20, 2026 05:20
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 0aed615 to 0aeee50 Compare February 20, 2026 05:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

continue;
}

debug!(?handle, "Registering dynamic HTTP handler.");
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent logging level for HTTP vs gRPC handler registration. HTTP handler registration uses debug! level, while gRPC handler registration at line 249 uses info! level. These operations are equivalent and should use the same logging level for consistency.

Copilot uses AI. Check for mistakes.
}
AssertionUpdate::Retracted(handle) => {
if http_handlers.swap_remove(&handle).is_some() {
debug!(?handle, "Withdrawing dynamic HTTP handler.");
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent logging level for HTTP vs gRPC handler withdrawal. HTTP handler withdrawal uses debug! level, while gRPC handler withdrawal at line 254 uses info! level. These operations are equivalent and should use the same logging level for consistency.

Copilot uses AI. Check for mistakes.
chrono = { workspace = true }
chrono-tz = { workspace = true }
http = { workspace = true }
hyper = { workspace = true }
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hyper dependency appears to be unnecessary. The new code in dynamic_api.rs only uses types from the http crate (http::Request, http::Response) and utilities from saluki_io which already depends on hyper. There are no direct imports or usages of hyper types in the added code. Consider removing this dependency unless it's needed for other reasons not visible in this diff.

Suggested change
hyper = { workspace = true }

Copilot uses AI. Check for mistakes.
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 0aeee50 to 0b55cc8 Compare February 21, 2026 19:52
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from 8a17cac to 46ef9d0 Compare February 21, 2026 19:52
Copilot AI review requested due to automatic review settings February 25, 2026 03:25
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from 46ef9d0 to b24c86d Compare February 25, 2026 03:25
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 0b55cc8 to 5ea4172 Compare February 25, 2026 03:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +45 to +53
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicHttpRoute`] and [`DynamicGrpcRoute`]
/// assertions and retractions, and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicHttpRoute`] or [`DynamicGrpcRoute`] in the [`DataspaceRegistry`] under a [`Handle`].
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation references DynamicHttpRoute and DynamicGrpcRoute, but these types do not exist in the codebase. The actual type is DynamicRoute (defined in lib/saluki-api/src/lib.rs). Update the documentation to reference the correct type name.

Suggested change
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicHttpRoute`] and [`DynamicGrpcRoute`]
/// assertions and retractions, and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicHttpRoute`] or [`DynamicGrpcRoute`] in the [`DataspaceRegistry`] under a [`Handle`].
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicRoute`] assertions and retractions,
/// and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicRoute`] in the [`DataspaceRegistry`] under a [`Handle`].

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +53
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicHttpRoute`] and [`DynamicGrpcRoute`]
/// assertions and retractions, and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicHttpRoute`] or [`DynamicGrpcRoute`] in the [`DataspaceRegistry`] under a [`Handle`].
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation references DynamicHttpRoute and DynamicGrpcRoute, but these types do not exist in the codebase. The actual type is DynamicRoute (defined in lib/saluki-api/src/lib.rs). Update the documentation to reference the correct type name.

Suggested change
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicHttpRoute`] and [`DynamicGrpcRoute`]
/// assertions and retractions, and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicHttpRoute`] or [`DynamicGrpcRoute`] in the [`DataspaceRegistry`] under a [`Handle`].
/// background event loop subscribes to the [`DataspaceRegistry`] for [`DynamicRoute`] assertions and retractions,
/// and atomically swaps the inner routers as handlers are added or removed.
///
/// ## Publisher protocol
///
/// Any process that wants to dynamically register API routes must:
///
/// 1. Build a `Router<()>` (for HTTP, or via `tonic::Routes::into_axum_router()` for gRPC).
/// 2. Assert a [`DynamicRoute`] in the [`DataspaceRegistry`] under a [`Handle`].

Copilot uses AI. Check for mistakes.
@tobz tobz force-pushed the tobz/dynamic-api-endpoint-routes branch from 5ea4172 to 95ff3a9 Compare February 26, 2026 15:20
@tobz tobz force-pushed the tobz/runtime-system-state-mgmt-primitives branch from b24c86d to 09abd4b Compare February 26, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core functionality, event model, etc. area/observability Internal observability of ADP and Saluki.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants