Skip to content

[TD-015] Config file schema not validated #12

@LFigg

Description

@LFigg

Description

YAML config is loaded but invalid keys are silently ignored, making typos and misconfigurations hard to detect.

Location

  • File: lib/config.py around line 108-116

Impact

  • Silent misconfiguration
  • Users may not realize their settings aren't being applied
  • Debugging config issues is difficult

Suggested Fix

Add schema validation with helpful error messages:

from jsonschema import validate, ValidationError

CONFIG_SCHEMA = {
    "type": "object",
    "properties": {
        "aws": {...},
        "azure": {...},
        "gcp": {...},
    },
    "additionalProperties": False  # Reject unknown keys
}

def load_config(path: Path) -> dict:
    with open(path) as f:
        config = yaml.safe_load(f)
    try:
        validate(config, CONFIG_SCHEMA)
    except ValidationError as e:
        raise ConfigError(f"Invalid config: {e.message}")
    return config

Priority

Low

Source

TECH_DEBT.md - TD-015

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions