Skip to content

feat: Layered configuration override support with /data/conf persistence#170

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-apollo-configuration
Draft

feat: Layered configuration override support with /data/conf persistence#170
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-apollo-configuration

Conversation

Copy link

Copilot AI commented Feb 23, 2026

Config loading had no override mechanism — changing defaults required modifying source files or using symlinks that polluted the tree. There was also no path toward Parameter Server integration.

Changes

New: cyber/common/config_loader.h/cc

Introduces GetProtoFromFileWithOverride() — a drop-in replacement for GetProtoFromFile() that applies a two-tier load strategy:

  1. Defaults — loaded from the in-source path (lowest priority)
  2. Persistent overrides — loaded from /data/conf/<basename> and deep-merged via proto::Message::MergeFrom() (only explicitly-set fields in the override win)
// Before
ACHECK(cyber::common::GetProtoFromFile(FLAGS_control_conf_file, &control_conf_));

// After — override in /data/conf/control_conf.pb.txt is merged automatically
ACHECK(cyber::common::GetProtoFromFileWithOverride(
    FLAGS_control_conf_file, &control_conf_));

Override files are partial — only fields you want to change need to be present:

# /data/conf/control_conf.pb.txt
max_steering_angle: 480.0   # only this field overrides; all others retain defaults

Reference adoption: modules/control/control_component.cc

Migrated to GetProtoFromFileWithOverride as the canonical example for other modules to follow.

Build: cyber/common/BUILD

Added config_loader cc_library and config_loader_test targets.

Tests: cyber/common/config_loader_test.cc

Covers: default-only load, missing-file failure, and merge semantics (overridden fields win, unset fields retain defaults).

Docs

  • docs/configuration_override.md — override priority design, merge semantics, security guidelines, migration instructions
  • docs/configuration_inventory.md — full inventory of config loading points across all modules with migration status
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Configuration management refactoring</issue_title>
<issue_description>### Use Case / Motivation

  1. The current configuration does not consider parameter services.
  2. Using symbolic links to override existing configurations will pollute the default settings.

Proposed Implementation

Epic: Refactor Apollo Configuration Management (Layered Override Support)

🧠 Background

Apollo’s configuration system currently loads config files directly with no hierarchical override support. This leads to difficulties in managing environment-specific config, persistent overrides, and live parameters from a central parameter server.

The refactor should introduce layered config overrides with controlled merge logic and security.


🎯 Goals

Create a reusable configuration loader that:

  1. Loads defaults from source
  2. Applies overrides from /data/conf/
  3. Merges with Parameter Server values as the highest priority

Additionally, ensure sensitive fields are not stored in defaults and document everything clearly.


📋 Sub-Tasks

1. Configuration Scan and Inventory

Objective:

  • Scan the codebase for all config loading points
  • Identify modules, file types, and loader functions

Deliverables:

  • JSON table or Markdown mapping file path → loader → module

2. Define Layered Override Logic

Objective:

  • Write a spec for merge priority:

    1. Defaults (lowest priority)
    2. External persistent overrides
    3. Parameter Server (highest priority)

Deliverables:

  • Design doc in Markdown

3. Implement Protobuf Deep Merge

Objective:

  • Write a merge utility for Protobuf messages using deep merge (not simple overwrite)

Deliverables:

  • C++ merge function
  • Example usage

4. Update Config Loaders

Objective:

  • Modify modules to use layered override logic in loading configs

Deliverables:

  • Refactored loader implementations

5. Secure Sensitive Fields

Objective:

  • Remove any sensitive tokens / keys from source defaults
  • Store secrets only in /data/conf

Deliverables:

  • Updated proto defs
  • Documentation

6. Documentation

Objective:

  • Document how the new override system works
  • Include usage, override order, and security guidelines

Deliverables:

  • Markdown under /docs/

🎯 Acceptance Criteria

  • ✓ All config sources are inventoried
  • ✓ Merge logic implemented and tested
  • ✓ Overrides applied in correct order
  • ✓ Sensitive info omitted from defaults
  • ✓ Documentation exists and is clear

Alternatives Considered

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: daohu527 <10419854+daohu527@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Apollo configuration management for layered overrides feat: Layered configuration override support with /data/conf persistence Feb 23, 2026
Copilot AI requested a review from daohu527 February 23, 2026 10:24
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.

[Feature]: Configuration management refactoring

2 participants