Skip to content

feat(config): Validate node config at startup and warn on suboptimal settings #2032

@xilosada

Description

@xilosada

Problem

The code checks for low delta buffer capacity but only when a session starts, not at node startup:

// crates/node/src/lib.rs:233-240
if capacity < MIN_RECOMMENDED_CAPACITY {
    warn!(
        %context_id,
        capacity,
        min_recommended = MIN_RECOMMENDED_CAPACITY,
        "Delta buffer capacity below recommended minimum"
    );
}

Operators may not realize their config is suboptimal until issues occur.

Proposed Solution

Add startup validation:

// In run.rs after config load
fn validate_config(config: &NodeConfig) -> Result<()> {
    if config.sync.delta_buffer_capacity < MIN_RECOMMENDED_CAPACITY {
        warn!(
            configured = config.sync.delta_buffer_capacity,
            recommended = MIN_RECOMMENDED_CAPACITY,
            "Delta buffer capacity below recommended - may cause data loss during sync"
        );
    }
    
    if config.sync.max_concurrent > 100 {
        warn!(
            configured = config.sync.max_concurrent,
            "High max_concurrent may cause resource exhaustion"
        );
    }
    
    if config.sync.timeout < Duration::from_secs(10) {
        warn!(
            configured = ?config.sync.timeout,
            "Very short sync timeout may cause premature failures"
        );
    }
    
    Ok(())
}

Acceptance Criteria

  • Config validated at startup
  • Warnings for suboptimal settings:
    • Delta buffer capacity below recommended
    • Very high max_concurrent
    • Very short timeouts
  • Validation doesn't block startup (just warns)
  • Warnings include recommended values

Estimated Effort: 30 minutes

Priority: P2 (Quick Win)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions