Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(workspace): log swallowed errors when reading saved exclude patterns (#3054)

ian0318git0020680eae98
diff --git a/packages/core/src/repowise/core/workspace/update/repo.py b/packages/core/src/repowise/core/workspace/update/repo.py
index edaa9a3f9..067a73709 100644
--- a/packages/core/src/repowise/core/workspace/update/repo.py
+++ b/packages/core/src/repowise/core/workspace/update/repo.py
@@ -58,7 +58,7 @@ def _local_settings_json(repo_path: Path) -> str | None:
if row and row[0]:
return row[0]
except Exception:
- pass
+ _log.debug("Could not read repo settings from local wiki.db", exc_info=True)
return None
@@ -85,7 +85,11 @@ async def _configured_settings_json(configured_url: str, repo_path: Path) -> str
finally:
await engine.dispose()
except Exception:
- pass
+ _log.warning(
+ "Could not read repo settings from the shared database; "
+ "saved exclude patterns not applied",
+ exc_info=True,
+ )
return settings_json
@@ -98,7 +102,9 @@ def _merge_settings_excludes(patterns: list[str], settings_json: str) -> None:
if isinstance(value, str) and value not in patterns:
patterns.append(value)
except Exception:
- pass
+ _log.warning(
+ "Could not parse settings_json; saved exclude patterns not applied", exc_info=True
+ )
@dataclass
diff --git a/tests/unit/workspace/test_update.py b/tests/unit/workspace/test_update.py
index 3c8c2e0fd..82883128b 100644
--- a/tests/unit/workspace/test_update.py
+++ b/tests/unit/workspace/test_update.py
@@ -1042,3 +1042,34 @@ class TestRepoUpdateResult:
assert r.symbol_count == 0
assert r.error is None
assert r.skipped_reason is None
+
+
+# ---------------------------------------------------------------------------
+# Saved exclude patterns (issue #2947)
+# ---------------------------------------------------------------------------
+
+
+class TestSavedExcludeSources:
+ def test_unreadable_shared_database_logs_a_warning(self, tmp_path: Path, caplog) -> None:
+ import asyncio
+ import logging
+
+ from repowise.core.workspace.update.repo import _configured_settings_json
+
+ caplog.set_level(logging.WARNING, logger="repowise.workspace.update")
+ with patch(
+ "repowise.core.persistence.create_engine", side_effect=RuntimeError("db unreachable")
+ ):
+ assert asyncio.run(_configured_settings_json("sqlite+aiosqlite://", tmp_path)) is None
+ assert "saved exclude patterns not applied" in caplog.text
+
+ def test_unparseable_settings_json_logs_a_warning(self, caplog) -> None:
+ import logging
+
+ from repowise.core.workspace.update.repo import _merge_settings_excludes
+
+ caplog.set_level(logging.WARNING, logger="repowise.workspace.update")
+ patterns = ["dist/**"]
+ _merge_settings_excludes(patterns, "{not json")
+ assert patterns == ["dist/**"]
+ assert "saved exclude patterns not applied" in caplog.text