From 6f74186498173081ad9c7054d02033dbc3e20510 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Wed, 21 Jan 2026 09:22:12 +0800 Subject: [PATCH] feat(config): add debug logging for preview root operations, see #772 and #774 - Log preview root rebuilding with counts of different root types - Add detailed debug output when preview paths are rejected - Improve visibility into path mapping and validation processes --- py/config.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/py/config.py b/py/config.py index 8fdd5cb6..315278e6 100644 --- a/py/config.py +++ b/py/config.py @@ -490,6 +490,14 @@ class Config: preview_roots.update(self._expand_preview_root(link)) self._preview_root_paths = {path for path in preview_roots if path.is_absolute()} + logger.debug( + "Preview roots rebuilt: %d paths from %d lora roots, %d checkpoint roots, %d embedding roots, %d symlink mappings", + len(self._preview_root_paths), + len(self.loras_roots or []), + len(self.base_models_roots or []), + len(self.embeddings_roots or []), + len(self._path_mappings), + ) def map_path_to_link(self, path: str) -> str: """Map a target path back to its symbolic link path""" @@ -675,6 +683,20 @@ class Config: if candidate_str == root_str or candidate_str.startswith(root_str + os.sep): return True + if self._preview_root_paths: + logger.debug( + "Preview path rejected: %s (candidate=%s, num_roots=%d, first_root=%s)", + preview_path, + candidate_str, + len(self._preview_root_paths), + os.path.normcase(str(next(iter(self._preview_root_paths)))), + ) + else: + logger.debug( + "Preview path rejected (no roots configured): %s", + preview_path, + ) + return False def apply_library_settings(self, library_config: Mapping[str, object]) -> None: