diff --git a/hbd/server/threshold.py b/hbd/server/threshold.py index 06125f9..ed6dad2 100644 --- a/hbd/server/threshold.py +++ b/hbd/server/threshold.py @@ -419,14 +419,28 @@ class ThresholdChecker: def _parse_config(self, config: Dict[str, Any]): """Parse threshold configuration from YAML structure. - + Supports two formats: 1. Legacy format with direct 'thresholds' section 2. New format with 'threshold_configs' and 'host_threshold_mapping' + + In all cases, THRESHOLD_DEFAULTS are seeded into threshold_configs["default"] + so the Settings page always shows the built-in defaults. + _parse_multi_config() overwrites this with the fully-merged effective defaults. """ + # Always expose built-in defaults through threshold_configs["default"] so + # the Settings page has something to display even in legacy/no-config mode. + seed: Dict[str, ThresholdConfig] = {} + for plugin_name, plugin_thresholds in THRESHOLD_DEFAULTS.get("thresholds", {}).items(): + if isinstance(plugin_thresholds, dict): + self._parse_plugin_thresholds(plugin_name, plugin_thresholds, target_dict=seed) + if seed: + self.threshold_configs["default"] = seed + self.threshold_raw_configs["default"] = {} + # Check for new multi-config format if "threshold_configs" in config: - self._parse_multi_config(config) + self._parse_multi_config(config) # overwrites threshold_configs["default"] elif "thresholds" in config: # Legacy single threshold configuration self._parse_legacy_config(config)