From 675b3859b3f426b2f5d2f74c6811bbc9de6e6b58 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 12 Sep 2026 17:12:02 +0200 Subject: [PATCH] Match dated backups by shape, not by hardcoded name Co-Authored-By: Claude Opus 5 (1M context) --- md_naming/_tables.py | 11 +++++++++-- md_naming/rules.py | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/md_naming/_tables.py b/md_naming/_tables.py index e4a4d17..be2c0b4 100644 --- a/md_naming/_tables.py +++ b/md_naming/_tables.py @@ -14,6 +14,7 @@ from __future__ import annotations import re + #: The four namespaces. A markdown file in a kuhy-owned repo must match one. #: #: README -- what this directory is and how to run it. @@ -82,8 +83,15 @@ EXEMPT_SUBPATHS = ( "/android/app/src/", ) +#: A dated backup is never a live repo, so its markdown is not ours to name. +#: Matched by *shape* rather than by listing each one: the 2026-09-11 ~ +#: reorganisation renamed every backup into ~/archive/YYYY-MM-DD-, which +#: silently invalidated the hand-listed +#: "screen-locker-backup-20260705-200741" and left this gate red on main. +DATED_BACKUP = re.compile(r"^\d{4}-\d{2}-\d{2}-") + #: Repos under ~ that are clones of other people's work, in addition to the -#: shared THIRD_PARTY_REPOS list. A dated backup clone is not a live repo. +#: shared THIRD_PARTY_REPOS list. EXTRA_THIRD_PARTY = frozenset( { # Dotfile clones of other people's projects. These live outside ~/*/ @@ -96,7 +104,6 @@ EXTRA_THIRD_PARTY = frozenset( ".pyenv", ".fzf", ".tmux", - "screen-locker-backup-20260705-200741", "flax-editor", "flax-mcp-test", "diet-guard-peer-backup", diff --git a/md_naming/rules.py b/md_naming/rules.py index 24d5dc7..1e59e1c 100644 --- a/md_naming/rules.py +++ b/md_naming/rules.py @@ -22,6 +22,7 @@ from md_naming._tables import ( ALLOWED_PATTERN, COMMUNITY_NAMES, EXEMPT_SUBPATHS, + DATED_BACKUP, EXTRA_THIRD_PARTY, HARNESS_NAMES, MARKER, @@ -51,7 +52,7 @@ def is_third_party(path: Path) -> bool: """ parts = path.as_posix().split("/") repos = THIRD_PARTY_REPOS | EXTRA_THIRD_PARTY - return any(part in repos for part in parts) + return any(part in repos for part in parts) or any(DATED_BACKUP.match(part) for part in parts) def is_vendored(path: Path) -> bool: