Skip to content

Commit 41af39e

Browse files
committed
fix: match directory/tutorial keywords against the bare repo name too
full_name is "owner/repo", and "/" isn't a [-_\s] word boundary, so DIRECTORY_WORDS and LEARNING_WORDS could never match a trigger word sitting at the start of the repo name itself (e.g. "awesome-dsh-plugins" never matched "awesome" via full_name). This was previously masked because "directory"/"curated" in the description usually covered for it; removing those words in the prior commit exposed real awesome-list repos slipping through. Search the bare repo name in addition to full_name and description.
1 parent f51dc8e commit 41af39e

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

scripts/sync_topic_plugins.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,13 @@ def metadata_exclusion(repo: dict[str, Any]) -> tuple[str, list[str]] | None:
604604
return "excluded", ["inactive_repository"]
605605
if int(repo.get("size") or 0) == 0:
606606
return "excluded", ["empty_repository"]
607-
if DIRECTORY_WORDS.search(full_name + " " + description):
607+
# full_name is "owner/repo"; the slash isn't a [-_\s] boundary, so a
608+
# repo named e.g. "awesome-dsh-plugins" would never match against
609+
# full_name alone. Search the bare repo name too.
610+
evidence_text = " ".join((repo.get("name", ""), full_name, description))
611+
if DIRECTORY_WORDS.search(evidence_text):
608612
return "excluded", ["directory_or_collection"]
609-
if LEARNING_WORDS.search(full_name + " " + description):
613+
if LEARNING_WORDS.search(evidence_text):
610614
return "excluded", ["tutorial_or_handbook"]
611615
return None
612616

tests/test_topic_sync.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ def test_directory_is_excluded(self):
6262
self.assertEqual(result["status"], "excluded")
6363
self.assertIn("directory_or_collection", result["reasons"])
6464

65+
def test_directory_words_match_the_bare_repo_name(self):
66+
result = topic_sync.classify(
67+
repository(
68+
name="awesome-dsh-plugins",
69+
full_name="coolbat/awesome-dsh-plugins",
70+
description="Browse every DeepSeek Harness plugin on GitHub in one place.",
71+
),
72+
"# Awesome DSH plugins",
73+
["README.md"],
74+
None,
75+
)
76+
self.assertEqual(result["status"], "excluded")
77+
self.assertIn("directory_or_collection", result["reasons"])
78+
6579
def test_directory_words_do_not_match_unrelated_technical_usage(self):
6680
result = topic_sync.classify(
6781
repository(

0 commit comments

Comments
 (0)