From fe780e1879b5f786918c15eadd82b88990b6d845 Mon Sep 17 00:00:00 2001 From: Patrick <320190286+muellerei@users.noreply.github.com> Date: Sat, 3 Oct 2026 04:47:03 +0200 Subject: [PATCH] Drop the unreachable date branch in _is_incidental_page The branch matching a date in file-name form (2025_10_10, 2025-10-10, 2025/10/10) never ran: such a name holds digits and separators only, and the rule for names without a letter returns first. Digits are never letters, so no input reaches it. Removing it leaves all 3265 tests green. The behaviour the comment promised stays, now stated at the rule that does the work. ARTEFACTS gains 2025-10-10 and 2025/10/10, so each spelling is pinned by a test and not by a comment. Narrowing the no-letter rule so that separators count as letters makes the test fail on 2025_10_10 and 2025/10/10. 2025-10-10 is also caught by the ticket-number rule (\d{3,}-), so it stays pinned either way. No behaviour change. --- logseq_cli/commands/analysis.py | 5 ++--- tests/test_read_only_commands_smoke.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logseq_cli/commands/analysis.py b/logseq_cli/commands/analysis.py index 177f413..3a33818 100644 --- a/logseq_cli/commands/analysis.py +++ b/logseq_cli/commands/analysis.py @@ -212,6 +212,8 @@ def _is_incidental_page(name: str) -> bool: stripped = name.strip() if len(stripped) < 3: return True + # Also a date in file-name form (2025_10_10, 2025-10-10, 2025/10/10): digits + # and separators only, a journal under another spelling, not a gap. if not any(c.isalpha() for c in stripped): return True if re.fullmatch(r"[\W_]+", stripped): @@ -219,9 +221,6 @@ def _is_incidental_page(name: str) -> bool: # A name opening with punctuation is a tag that swallowed one: "#-AI" if not (stripped[0].isalnum() or stripped[0] in "_@"): return True - # 2025_10_10, 2025-10-10, 2025/10/10 — a journal, not a gap - if re.fullmatch(r"\d{4}[-_/]\d{1,2}[-_/]\d{1,2}", stripped): - return True # An unclosed bracket dragged in from prose: "#Active)", "3b82f6)". if stripped.endswith(")") and "(" not in stripped: return True diff --git a/tests/test_read_only_commands_smoke.py b/tests/test_read_only_commands_smoke.py index 05a11c4..b78b8dd 100644 --- a/tests/test_read_only_commands_smoke.py +++ b/tests/test_read_only_commands_smoke.py @@ -212,7 +212,8 @@ class TestFindKnowledgeGapsIgnoresArtefacts: them, while "596 orphaned pages" reads as a call to action. """ - ARTEFACTS = [")", "-", "1", "272", "-AI", "2025_10_10", "..."] + ARTEFACTS = [")", "-", "1", "272", "-AI", "2025_10_10", "2025-10-10", + "2025/10/10", "..."] def _graph(self, extra=(), trees=None): names = [*self.ARTEFACTS, "Real Knowledge Page", *extra]