Skip to content

[FEAT] Implement modular configuration#328

Merged
gbin merged 3 commits into
masterfrom
yang/feat/modular_config
May 16, 2025
Merged

[FEAT] Implement modular configuration#328
gbin merged 3 commits into
masterfrom
yang/feat/modular_config

Conversation

@makeecat

@makeecat makeecat commented May 14, 2025

Copy link
Copy Markdown
Collaborator

Overview

This PR implements a modular configuration system for Copper-rs that allows splitting large configurations into reusable components. The implementation enables parameter substitution, file inclusion, and hierarchicalcomposition - addressing a key roadmap item.

Key Features

  • File includes with relative/absolute paths
  • Parameter substitution with {{parameter_name}} syntax
    - Hierarchical inclusion with circular dependency detection (removed to support template-based configuration)
  • Well-defined merging rules for configuration components

Example Implementation

The modular_config_example directory provides a clear demonstration of the feature in action, showing how to:

  • Create reusable configuration templates
  • Apply different parameters to the same template
  • Organize configuration into logical components

@makeecat makeecat requested review from Copilot and gbin May 14, 2025 21:43
@makeecat makeecat added the enhancement New feature or request label May 14, 2025
@makeecat makeecat self-assigned this May 14, 2025
@makeecat makeecat added the documentation Improvements or additions to documentation label May 14, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a modular configuration system in Copper‑rs to allow splitting large configurations into reusable components by adding support for file includes and parameter substitution. Key changes include new RON templates for motor tasks, updated configuration deserialization and merging logic in the runtime, and enhanced documentation and compile-fail tests reflecting the new behavior.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
examples/modular_config_example/*.ron & README.md New example files and documentation demonstrating modular configuration usage
doc/modular_config.md Detailed documentation on including configuration files and parameter substitution
core/cu29_runtime/src/config.rs Updated error handling, parameter substitution, and include processing/merging logic
core/cu29_derive/tests/compile_fail/*.stderr & src/lib.rs Adjusted error messages and macro usage reflecting the new config API
README.md Updated project overview to include modular configuration details
Comments suppressed due to low confidence (1)

core/cu29_runtime/src/config.rs:1304

  • The merging logic for connections similarly skips adding a connection if one with the same source and destination already exists, which prevents later includes from overriding earlier ones as documented. Consider implementing an update mechanism for connections to ensure later includes take precedence.
if !cnx.iter().any(|c| c.src == included_c.src && c.dst == included_c.dst)

Comment thread core/cu29_runtime/src/config.rs

@gbin gbin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this is good to go, let's merge it and I'll resume the missions on top of this.

@gbin gbin merged commit 282bdfb into master May 16, 2025
9 checks passed
@gbin gbin deleted the yang/feat/modular_config branch May 16, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants