feat: add code-driven plugin config layer - #1
Closed
zhongxuanwang-nv wants to merge 1 commit into
Closed
zhongxuanwang-nv wants to merge 1 commit into
zhongxuanwang-nv wants to merge 1 commit into
Conversation
Augment initialize_plugins so a code-driven plugin config layer, set via the new set_code_driven_plugin_config runtime API, is merged on top of the file/CLI-resolved config before validation and activation. The code-driven layer is the highest-precedence source and overrides discovered plugins.toml / [plugins].config / --plugin-config per-field; with no layer set, behavior is unchanged so file-only configs stay compatible. nemo-relay doctor now surfaces the effective plugin config source (code-driven layer vs file/CLI) and validates the merged effective config. Docs document the layering model, precedence, and conflict behavior. Additive and Rust-only: two new public functions in nemo_relay::plugin (set_code_driven_plugin_config, apply_code_driven_plugin_config). No existing API, struct/datatype, or language-binding changes. Relates to relay-183. Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
zhongxuanwang-nv
force-pushed
the
feat/relay-183-code-driven-plugin-config-layer
branch
from
June 4, 2026 04:14
9a6665d to
4be77d6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a code-driven plugin configuration layer: a host application can supply a
PluginConfigprogrammatically that is merged on top of the file/CLI-resolved plugin config before validation and activation. This lets code apply programmatic overrides while still honoring operator files for everything it does not set.Details
What changed
crates/core/src/plugin.rs) — two additive, Rust-only public functions:set_code_driven_plugin_config(Option<PluginConfig>)— set/clear the layer.apply_code_driven_plugin_config(&PluginConfig) -> Option<PluginConfig>— returnsSome(effective)(the layer merged over the argument) when a layer is set, elseNone.initialize_pluginsapplies the layer at entry (apply_code_driven_plugin_config(&config).unwrap_or(config)); the existing validate / replace-with-rollback / store flow runs on the effective config, soactive_plugin_report()reflects what's actually active. The merge helper is private.kind(base order preserved, overlay-only appended), componentconfigobjects deep-merged (nested tables recurse, arrays/scalars replaced); top-levelversion/policycome from the layer.crates/cli/src/doctor.rs) — reports aPlugin config sourcecheck (code-driven layer vs. file/CLI), attributes validation diagnostics to the effective config, and runs exporter sub-checks against the merged config. Output is byte-identical when no layer is set.plugin-configuration-files.mdx) — documents the layering model, a Rust example, the precedence ordering, and the conflict-case table.Why
Allow code-driven plugin config to layer with materialized
plugins.tomlconfig without breaking discovery/merge semantics, and letnemo-relay doctorshow the effective config source. The code-driven layer is merged then validated, so it never bypasses validation.Constraints honored
static; merge returns the existingPluginConfig).How tested
cargo test --workspace(0 failed),cargo clippy -- -D warnings(core + cli),cargo fmt --check.[[test]]binary (plugin_layer_tests.rs) for the set/apply +initialize_pluginswiring (process-isolated to avoid global-state races); twodoctortests (file+layer and layer-only).Breaking changes
None.
Where should the reviewer start?
crates/core/src/plugin.rs—apply_code_driven_plugin_config+ the one-lineinitialize_pluginschange + the privatemerge_plugin_config_layers. Thencrates/cli/src/doctor.rs(collect_observability_layered) for the effective-source reporting.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)