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
This commit is contained in:
Will Miao
2026-01-21 09:22:12 +08:00
parent eb8b95176b
commit 6f74186498

View File

@@ -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: