Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(metrics): make incomplete recording guidance discoverable (#7657)

Chanhyo Jung8e3a55d10034
diff --git a/README.md b/README.md
index f83883b669..2bb5fcb997 100644
--- a/README.md
+++ b/README.md
@@ -504,6 +504,7 @@ attempt there also replaces that backup.
- [All Features Guide](docs/features.md)
- [Search Engines Guide](docs/search-engines.md)
- [Analytics Dashboard](docs/analytics-dashboard.md)
+- [Incomplete Metrics Warning](docs/metrics-dashboard.md#incomplete-metrics-warning) — Understand recording failures and missing metrics
### Advanced Features
- [LangChain Integration](docs/LANGCHAIN_RETRIEVER_INTEGRATION.md)
diff --git a/changelog.d/7615.bugfix.md b/changelog.d/7615.bugfix.md
new file mode 100644
index 0000000000..a90fb32f3a
--- /dev/null
+++ b/changelog.d/7615.bugfix.md
@@ -0,0 +1 @@
+Make incomplete metrics warning guidance discoverable from the README and the dashboard’s Understanding Metrics help panel.
diff --git a/src/local_deep_research/web/templates/pages/metrics.html b/src/local_deep_research/web/templates/pages/metrics.html
index 91342287f4..d21b5a1504 100644
--- a/src/local_deep_research/web/templates/pages/metrics.html
+++ b/src/local_deep_research/web/templates/pages/metrics.html
@@ -66,7 +66,7 @@
{{ help_step(2, "Cost Estimates", "Costs are calculated from token usage and model pricing. Local models (Ollama) show $0.00 as they run on your hardware.") }}
{{ help_step(3, "Performance", "Response time and success rate help identify slow or problematic model configurations.") }}
{{ help_step(4, "Ratings", "Your satisfaction ratings help track which models and settings produce the best results for your needs.") }}
- </div>
+ {% set incomplete_metrics_help %}Metrics may be incomplete when token, search, or rate-limit updates cannot be recorded. Check the server logs for details and see the <a href="https://github.com/LearningCircuit/local-deep-research/blob/main/docs/metrics-dashboard.md#incomplete-metrics-warning" target="_blank" rel="noopener noreferrer">incomplete metrics warning guide</a>.{% endset %}{{ help_step(5, "Incomplete Metrics", incomplete_metrics_help) }}</div>
{{ privacy_note("All metrics are calculated locally. Your usage data never leaves your device.") }}
{% endcall %}
<div id="loading" class="ldr-loading-spinner">
diff --git a/tests/metrics/test_metric_write_health.py b/tests/metrics/test_metric_write_health.py
index a350fe9686..ee20382d7c 100644
--- a/tests/metrics/test_metric_write_health.py
+++ b/tests/metrics/test_metric_write_health.py
@@ -2,9 +2,14 @@
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
+from pathlib import Path
+import re
+from urllib.parse import urlsplit
from types import SimpleNamespace
from unittest.mock import MagicMock
+from bs4 import BeautifulSoup
+from markdown_it import MarkdownIt
import pytest
from sqlalchemy.exc import OperationalError
@@ -656,17 +661,25 @@ def test_dashboard_uses_authenticated_owner_and_fixed_reason_labels(
response = client.get("/metrics/?username=bob")
assert response.status_code == 200
assert 'id="metric-write-warning"' in response.text
- assert "Missing database credentials: 1" in response.text
- assert "Database write failures" not in response.text
+ banner = BeautifulSoup(response.text, "html.parser").select_one(
+ "#metric-write-warning[role=status]"
+ )
+ assert banner is not None
+ assert "Missing database credentials: 1" in banner.get_text()
+ assert "Database write failures" not in banner.get_text()
assert (
"Recording problems since the server started: at least 1."
- in " ".join(response.text.split())
+ in " ".join(banner.get_text().split())
)
app.dependency_overrides[require_auth] = lambda: "bob"
response = client.get("/metrics/")
- assert "Database write failures: 2" in response.text
- assert "Missing database credentials" not in response.text
+ banner = BeautifulSoup(response.text, "html.parser").select_one(
+ "#metric-write-warning[role=status]"
+ )
+ assert banner is not None
+ assert "Database write failures: 2" in banner.get_text()
+ assert "Missing database credentials" not in banner.get_text()
def test_dashboard_omits_warning_when_no_drops_recorded(health, dashboard):
@@ -684,3 +697,83 @@ def test_anonymous_dashboard_does_not_expose_counts(health, dashboard):
response = client.get("/metrics/?username=alice")
assert response.status_code == 401
assert "metric-write-warning" not in response.text
+
+
+DOC_PATH = "docs/metrics-dashboard.md"
+DOC_ANCHOR = "incomplete-metrics-warning"
+DOC_URL = (
+ "https://github.com/LearningCircuit/local-deep-research/blob/main/"
+ f"{DOC_PATH}#{DOC_ANCHOR}"
+)
+
+
+def _assert_warning_documentation_target(url):
+ target = urlsplit(url)
+ assert target.fragment == DOC_ANCHOR
+ root = Path(__file__).resolve().parents[2]
+ document = root / DOC_PATH
+ assert document.is_file()
+ tokens = MarkdownIt().parse(document.read_text(encoding="utf-8"))
+ headings = [
+ tokens[index + 1].content
+ for index, token in enumerate(tokens)
+ if token.type == "heading_open"
+ ]
+ assert "Incomplete Metrics Warning" in headings
+ assert target.fragment in [
+ re.sub(r"[^\w -]", "", heading.lower()).replace(" ", "-")
+ for heading in headings
+ ]
+
+
+def test_readme_links_to_incomplete_metrics_warning():
+ root = Path(__file__).resolve().parents[2]
+ readme = (root / "README.md").read_text(encoding="utf-8")
+ links = re.findall(r"\[[^\]]+\]\(([^)]+)\)", readme)
+ target = f"{DOC_PATH}#{DOC_ANCHOR}"
+ assert target in links
+ _assert_warning_documentation_target(target)
+
+
[email protected]("username", ["alice", "bob"])
[email protected]("has_drops", [False, True])
+def test_dashboard_help_explains_incomplete_metrics(
+ health, dashboard, username, has_drops
+):
+ app, client, require_auth = dashboard
+ # Another user's drops must not control this user's banner or static help.
+ health.record("other-user", "search", "missing_credentials")
+ if has_drops:
+ health.record(username, "tokens", "write_error")
+ app.dependency_overrides[require_auth] = lambda: username
+ response = client.get("/metrics/")
+ assert response.status_code == 200
+ page = BeautifulSoup(response.text, "html.parser")
+ banner = page.select_one("#metric-write-warning[role=status]")
+ assert (banner is not None) == has_drops
+ panel = page.select_one("#help-panel-metrics-how")
+ assert panel is not None
+ assert panel.select_one(".ldr-help-panel-title").get_text(strip=True) == (
+ "Understanding Metrics"
+ )
+ content = panel.select_one("#help-panel-content-metrics-how")
+ steps = content.select(".ldr-help-step")
+ warning_steps = [
+ step
+ for step in steps
+ if step.select_one("strong").get_text(strip=True)
+ == "Incomplete Metrics"
+ ]
+ assert len(warning_steps) == 1
+ step = warning_steps[0]
+ text = step.get_text(" ", strip=True)
+ assert "Metrics may be incomplete" in text
+ assert "cannot be recorded" in text
+ assert "server logs" in text
+ link = step.select_one("a[href]")
+ assert link is not None
+ assert link["href"] == DOC_URL
+ assert link.get_text(strip=True)
+ assert link.get("target") == "_blank"
+ assert set(link.get("rel", [])) == {"noopener", "noreferrer"}
+ _assert_warning_documentation_target(link["href"])